Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

Merge pull request #938 from keemsisi/feat/laya-java-routing

Nandakishor507066545098
diff --cc laya-java/laya-java/src/main/java/com/convaiinnovations/laya/decode/Decoder.java
index 1d5e3ae2,0284552b..63fe2692
--- a/laya-java/laya-java/src/main/java/com/convaiinnovations/laya/decode/Decoder.java
+++ b/laya-java/laya-java/src/main/java/com/convaiinnovations/laya/decode/Decoder.java
@@@ -124,11 -124,19 +124,20 @@@ public final class Decoder
* plausible for a well-trained head, which is what makes it the wrong kind of bug.
*/
public static float[] actionProbabilities(float[] actLogits) {
- int width = Math.max(2, actLogits.length);
+ if (actLogits.length == 0) {
+ // Published as NaN before this. The reference indexes act[r, 0] and raises; an
+ // escalation signal that reads NaN is worse than one that refuses.
+ throw new IllegalArgumentException(
+ "the graph produced no action logits, so there is no action probability");
+ }
+ // The width the graph actually produced. Padding a single column up to two turned a
+ // probability of 1.0 into sigmoid(logit) -- a plausible-looking number for a value the
+ // model never produced, in the field callers gate escalation on.
+ int width = actLogits.length;
double max = Double.NEGATIVE_INFINITY;
- for (int i = 0; i < width && i < actLogits.length; i++) {
- max = Math.max(max, actLogits[i]);
+ for (int i = 0; i < width; i++) {
+ double value = i < actLogits.length ? actLogits[i] : 0.0;
+ max = Math.max(max, value);
}
double[] exponentials = new double[width];
double total = 0.0;