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
fix(evidence): a boolean `items` is a malformed calibration entry, not a count
Aashishab6d8f2610d9
diff --git a/laya/evidence.py b/laya/evidence.pyindex 69692a63..5d609c0a 100644--- a/laya/evidence.py+++ b/laya/evidence.py@@ -44,7 +44,11 @@ def inspect_calibration(config: Dict[str, Any]) -> Dict[str, Any]:return _entry(UNKNOWN, "training metadata present but no calibration block; checkpoint predates #933")types: Dict[str, Any] = {}for name, entry in calibration.items():- if not isinstance(entry, dict) or not isinstance(entry.get("items"), int):+ # `isinstance(True, int)` is True, so a JSON `true` in `items` read as a count of one and a+ # `false` as zero. Both are type errors, unlike a negative count, which stays reported+ # because #964 deleted the floor that judged the number.+ if (not isinstance(entry, dict) or isinstance(entry.get("items"), bool)+ or not isinstance(entry.get("items"), int)):types[name] = _entry(UNKNOWN, "calibration entry is malformed")continueitems = entry["items"]diff --git a/tests/test_evidence.py b/tests/test_evidence.pyindex 9d9a92fb..99af9bf7 100644--- a/tests/test_evidence.py+++ b/tests/test_evidence.py@@ -81,6 +81,27 @@ check("mixed types overall -> INSUFFICIENT", mixed["state"], evidence.INSUFFICIEmalformed = calib({"training": {"laya_train_calibration": {"choice": {"temperature": 1.0}}}})check("malformed entry -> UNKNOWN", malformed["types"]["choice"]["state"], evidence.UNKNOWN)+# A JSON `true` is not a count, but `isinstance(True, int)` makes it one. Before this guard+# `{"items": true}` answered PRESENT with "fitted with no recorded issues on 1 items" and+# `{"items": false}` answered MISSING with "zero calibration items": two verdicts about a fit that+# the artifact never reported, and the second one is the state a genuinely unfitted type gets.+for _flag in (True, False):+ _t = calib({"training": {"laya_train_calibration": {+ "choice": {"items": _flag, "temperature": 1.1, "issues": []}}}})+ check("items=%r is a malformed entry, not a count" % _flag, _t["types"]["choice"]["state"],+ evidence.UNKNOWN)+ check("items=%r keeps the malformed reason" % _flag, _t["types"]["choice"]["reason"],+ "calibration entry is malformed")+ check("items=%r leaves the overall undecided" % _flag, _t["state"], evidence.INSUFFICIENT)++# The guard is about the type of `items`, not its value: a negative count stays reported, because+# #964 deleted the local floor that judged it and nothing here is supposed to re-introduce one.+_neg = calib({"training": {"laya_train_calibration": {+ "choice": {"items": -5, "temperature": 1.1, "issues": []}}}})+check("negative items are still reported, not judged", _neg["types"]["choice"]["state"], evidence.PRESENT)+check("negative items keep their own count in the reason", _neg["types"]["choice"]["reason"],+ "fitted with no recorded issues on -5 items")+# ------------------------------------------------------ one numeric source of truth# `items` is reported here, never judged: #964 deleted the local `_thresholds()` that compared it# against copies of `MIN_TYPE_N`/`CALIB_WARN_N`, and the comment describing that mechanism stayed