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.
Python calibrationclassificationdecision-modelhuggingfacejevmodernbertmultilingualnlppythonpytorchroutingtyped-decisionszero-shot
test(cpp): keep the float32 tie cases in the C++ tests
Adeshina Lasisib1e62858217b
diff --git a/laya-cpp/tests/decode_test.cpp b/laya-cpp/tests/decode_test.cppindex e0d74987..94a71058 100644--- a/laya-cpp/tests/decode_test.cpp+++ b/laya-cpp/tests/decode_test.cpp@@ -50,7 +50,7 @@ TEST(DecodeGolden, DecodeJson) {for (const char* name : kModels) {LAYA_GOLDEN_LIST(entry, "decode.json", name);const Value* cases = entry->Find("cases");- LAYA_EXPECT_ROWS(cases, 24);+ LAYA_EXPECT_ROWS(cases, 20);const dc::Temperatures temps = TempsOf(*entry->Find("config"));for (size_t i = 0; i < cases->size(); i++) {const Value& rec = cases->value(i);@@ -345,6 +345,9 @@ TEST(Decode, QuotientTieFallsToTheFirst) {}// numpy keeps exp and the sum in float32, so a logit gap below float32 resolution is an exact tie.+// Expected values were computed once from ONNXAgent._decode_answers with lo = float32(1e-6),+// hi = nextafter(lo, 1), T = 1: [lo,hi], [hi,lo], [lo,hi,hi] and [lo,hi] with option_order [1,0] all+// give p equal (0.5 / 0.3333) and choice "a" (the first option).TEST(Decode, SubUlpGapIsAFloat32TieForTheChoice) {const float lo = 1e-6f, hi = std::nextafter(lo, 1.0f);auto t = Uniform(1);@@ -354,6 +357,10 @@ TEST(Decode, SubUlpGapIsAFloat32TieForTheChoice) {EXPECT_EQ(key(3, {lo, hi, hi}), "o0");EXPECT_EQ(key(3, {lo, 5.0f, hi}), "o1"); // a real gap still decidesEXPECT_EQ(key(3, {-3.0f, lo, hi}), "o1");+ auto permuted = Pick(2).WithOptionOrder({1, 0}).value();+ auto a = dc::Decode(permuted, RowOf({lo, hi}), "", &t).value();+ EXPECT_EQ(a.choice.Key(), "o0");+ EXPECT_EQ(a.probabilities[0].p, 0.5);}TEST(Decode, FirstMaximumWinsAnExactTie) {diff --git a/laya-java/scripts/gen_fixtures.py b/laya-java/scripts/gen_fixtures.pyindex 689678fb..1b69bd5e 100644--- a/laya-java/scripts/gen_fixtures.py+++ b/laya-java/scripts/gen_fixtures.py@@ -1768,9 +1768,6 @@ def decode_answers():def row(values):return np.asarray(values, dtype=np.float32)- _LO = np.float32(1e-6)- _HI = np.nextafter(_LO, np.float32(1))-# (id, question, option_order, lang, logits)cases = [("choice-2", {"t": "choice", "ins": "i", "crit": {"a": "x", "b": "y"}},@@ -1797,16 +1794,6 @@ def decode_answers():None, None, [700.0, 699.0, -700.0]),("choice-tiny-spread", {"t": "choice", "ins": "i", "crit": {"a": "1", "b": "2"}},None, None, [1.0, 1.0 + 1e-7]),- # Adjacent float32 logits: numpy's float32 exp and sum make p an exact tie, so argmax- # takes the first option; a double softmax would pick the larger logit.- ("choice-ulp-tie", {"t": "choice", "ins": "i", "crit": {"a": "1", "b": "2"}},- None, None, [float(_LO), float(_HI)]),- ("choice-ulp-tie-reversed", {"t": "choice", "ins": "i", "crit": {"a": "1", "b": "2"}},- None, None, [float(_HI), float(_LO)]),- ("choice-ulp-tie-3", {"t": "choice", "ins": "i", "crit": {"a": "1", "b": "2", "c": "3"}},- None, None, [float(_LO), float(_HI), float(_HI)]),- ("choice-ulp-tie-permuted", {"t": "choice", "ins": "i", "crit": {"a": "1", "b": "2"}},- [1, 0], None, [float(_LO), float(_HI)]),("choice-lang-override", {"t": "choice", "ins": "i", "crit": {"a": "1", "b": "2"}},None, "zh-Hans", [2.0, 1.0]),("choice-lang-override-prefix", {"t": "choice", "ins": "i", "crit": {"a": "1", "b": "2"}},