Repository navigation
[Decisions] Make confidence mean the same thing on every backend (Laya reports normalized entropy, others max p or Jev's margin) #89
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Why
Every backend returns a confidence next to its choice, and System1-Agents passes it straight through to step records (tool/loop.py, browser/decision_model.py), s1a probe, s1a decide and the MCP decide tool. Right now that number means different things depending on the backend:
| Backend | Where the number comes from | What it is |
|---|---|---|
laya, laya-served |
Laya's own answer dict, passed through verbatim (s1a/decision_models/laya.py L201, served.py L372) |
Normalized entropy, 1 - H(p)/log(k) (laya.common.confidence_from_probs) |
jev, clm |
the service's answer, passed through | whatever the service reports; for Jev, TypeSafe's adapter defines choice confidence as (max p - 1/k) / (1 - 1/k) (as quoted in laya/confidence.py) |
omnijev |
recomputed in omnijev.py L110 |
Jev's formula |
cua, cua 4B |
cua.py L119, cua_four_b.py L117 |
max p |
| any noul without one | validation.validate_noul |
max(p, 1-p) |
Two recent write-ups show why this matters:
- Fast Models, Slow Evidence (arXiv:2610.02267), a paired Laya vs Jev evaluation with released raw outputs, found that Laya's
confidencefield differs frommax_k p_kby 0.299 on average (0.010 for Jev) and warns that "using that field would silently break any threshold". It recommends computing confidence asmax_k p_kand choosing thresholds on held-out data. - Laya itself now says the same thing. In
laya0.4.11 (current PyPI),laya/confidence.pydocuments thatconfidenceis normalized entropy, "does not transfer across option counts", and that "a threshold carried over from Jev selects about twice as much on Laya". It adds a separateanswer_confidence(max p) field for gating. This repo lockslaya0.3.20.
Nothing in Agents thresholds on confidence today, so this is not a live bug yet. But the conf= column in run summaries and replays, the MCP decide output, and any future confidence-gated step (for example the System-1 to System-2 delegation in SearchJev, arXiv:2610.05107) would compare numbers that are on different scales for different backends.
Proposed scope (one PR)
- Decide on one documented definition for
Choice.confidence/Noul.confidenceacross backends. The suggestion ismax_k p_kfor choice andmax(p, 1-p)for noul, both computed invalidation.pyfrom the validated probabilities, so every backend gets the same number. - Keep each backend's own number for provenance, e.g.
raw["backend_confidence"](Laya's entropy value, Jev's normalized margin), so nothing is lost and old records can still be read. - Update
docs/decision-models.md(theDecisioncontract section) and thes1a probe/decide/ MCP field descriptions to say exactly whatconfidenceis, and that it is not calibrated unless a backend says so. - Add the definition to
DecisionModelContractso a new backend can't drift.
Acceptance criteria
- Unit tests (offline, using fakes and recorded Laya/Jev/OmniJev answer dicts) show the same probabilities yield the same
confidenceon every backend. - Backend-native confidence is retained in
rawand the step records, under a name that does not collide withconfidence. - The CHANGELOG notes the change in meaning for
laya/laya-served/jev/omnijevrecords, since historicalconf=values are not comparable with new ones. - No change to which option is chosen; only the reported confidence changes.
Out of scope
- Calibrating any backend (temperature fitting, per-domain recalibration).
- Adding a confidence gate or System-2 fallback. That can be a follow-up once the number means one thing.
- Bumping
layabeyond the current lock (track separately if wanted).
References
- Fast Models, Slow Evidence: https://arxiv.org/abs/2610.02267 (code and raw outputs: https://github.com/David-DL-Space/sys1-eval)
- SearchJev (confidence-gated System-2 delegation): https://arxiv.org/abs/2610.05107
- Laya package (see
laya/confidence.py,laya/common.py::confidence_from_probs): https://pypi.org/project/laya/ - Jev confidence formula as referenced by Laya: TypeSafe
system-one-adapter-python,_utils/confidence_metrics.py; Introducing System One Models & Jev - Related: [Fix] Fit the browser front's state and questions into Laya's window #9 / [Deps] Require laya 0.3.9, lock 0.3.20, and drop the local weight-init skip #37 (Laya shaping and pin), [Feat] OmniJev as a vision decision model for the browser agents #33 (OmniJev confidence recompute)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity