Skip to content

Laya spike result: NEEDS-FINETUNING; schema selection is separable and deployable, operations are a regression, act-vs-clarify blocks on declarative state-changes #2825

Closed

Description

@malibio

⛔ CLOSED — superseded by measurement, not implemented

Final verdict: do not adopt Laya for any of the three decisions. The body below is the original spike record and remains accurate as of when it was written; what changed is the system underneath it. Read this header first — several conclusions below were overtaken by the entity-resolution tier (#2841 / #2856).

What changed. The spike's central finding was that the noul head reads mood, not semantics: declarative state-changes scored 2/14, and that was named as the residual judgment a decision model would address. Entity grounding shipped afterwards and fixed that failure — the decision eval now passes declarative state-changes 3/3, deterministically, with no model added.

What is left is the mirror image. The agent's remaining failures are over-action: calling search_nodes on a declarative that requests nothing (0/3), and create_node on an entity the turn already resolved (0/3, tracked as #2855). Neither is a selection error — the tool surface and the resolved entity were correct in both.

Would noul fix the over-action case? Probably yes for that one scenario, and for a reason that disqualifies it as evidence. The head is biased toward "no" (10 of 14 values below 0.5), so it would likely classify a fact-report correctly — but the spike's own conclusion is that "at the default 0.5 threshold, noul earns nothing over always answering 'not a write'." A constant "no" passes that scenario too. And the same bias is what produced 2/14 on declarative state-changes — the case Gemma now handles reliably. Adopting it would trade a solved failure for an unsolved one. One of the three highest-confidence answers in the spike was also confidently wrong (a state-change at 0.1412), so the calibration would not reliably say when to trust it.

An earlier closing comment on this issue said noul's bias "points the wrong way" for over-action. That was backwards — under-acting is the right bias for a scenario whose answer is "don't act". The conclusion stands; that particular reasoning does not.

What actually fixed the motivating failure: a deterministic FTS5 lookup at ~0.12 ms — four orders of magnitude cheaper than the generative turn it informs, and ~200x cheaper than the fastest decision-model option measured here. The premise the investigation started from (typed decisions should not be made inside a generative pass) held; the mechanism turned out to be an index, not a model.

Still true and unaffected by any of the above: operations are a regression (62.5% vs Gemma's 0 off-menu in 40) with a structural cause — Laya's ~20-token-per-candidate budget cannot hold production's ~150-word tool descriptions. Schema selection measured well (40/40) but the eval shows it is not where the agent fails.

If reopened: the corpus would need to over-sample over-action cases — declaratives requesting nothing, references to entities that already exist — not the declarative state-changes this spike targeted. Those are handled. Environment and raw results remain in nodespace-experiment-nlp.


Overview

A bounded Python spike evaluated Laya (Apache-2.0, 421M ModernBERT-large, laya-typed-decisions) as a non-autoregressive decision layer for the local agent — the idea being to take typed judgments (which schema, which operation, act-vs-clarify) out of Gemma's generative pass.

Verdict: NEEDS-FINETUNING. Do not port to Rust yet. One slice — schema selection — looks deployable on its own and is separable from the rest.

Two rounds ran, both zero-shot with no prompt iteration by design. Full report and raw JSON: LAYA_SPIKE_RESULTS.md in the local nodespace-experiment-nlp scratch folder (not a repo, so this issue is the durable record).

Why this was worth measuring

The local agent currently makes schema and operation selection implicitly inside generation. Stage-1 routing — a 3-way structural choice (route_query / route_clarify / route_multi) — costs ~1.48s of autoregressive decode per turn, measured in-process. A single encoder forward pass is the obvious cheaper shape for a decision that is definitionally not generative.

Results

Measured on an M4 Pro (14 cores, 48GB), torch 2.14.0. Latency is warm inference: model loaded once, 10 warmup iterations discarded, 40-60 timed reps.

Cost — no longer the open question

Stage-1 today Laya MPS fp32
one 3-way structural choice 1.48s 25.1ms (~59x)
three decisions bundled (act+schema+op) — 97.2ms (~15x)

MPS is ~3.6-4x faster than CPU (CPU bundle 350ms). Two independent runs agree within ~2%.

fp16 halves memory and buys zero speed. 1.6852 GB → 0.8956 GB (−46.9%), load ~21s either way, latency delta 1.4% (noise) — at batch 1-3 the forward is dispatch-bound, not bandwidth-bound. The memory number matters under ADR-062 (context windows are budgeted against total RAM minus weights); the speed number should not be cited, because it is not real. Prefer fp16 over bf16: same memory, same speed, 6x less numeric drift, zero argmax flips.

Casting the whole model to fp16/bf16 on MPS aborts the process with SIGABRT (Destination NDArray and Accumulator NDArray cannot have different datatype), root-caused to laya's Python common.py hardcoding .float() and then feeding fp32 activations to fp16 heads. Encoder-only cast works. This is a laya-Python limitation; a Rust port controls its own forward and would not inherit it.

Accuracy

Probe n Result 95% Wilson CI
schema selection 40 40/40 (100%) [91.2%, 100%]
operation selection 40 25/40 (62.5%) [47.0%, 75.8%]
noul act-vs-clarify @ t=0.5 46 31/46 (67.4%) [53.0%, 79.1%]

Device/dtype parity confirmed: MPS fp32 is bit-identical to CPU fp32 across all 34 Round-1 calls; fp16 max drift 0.0007 with zero argmax changes.

The central finding: the noul head reads MOOD, not SEMANTICS

AUC
imperative-act vs question 0.9744
declarative-act vs question 0.7024

Medians: imperative 0.5460, declarative 0.2628, question 0.1660 — declarative state-changes sit nearer to questions than to imperatives. Declarative-act scores 2/14 (14.3%). Even a perfect threshold caps declarative-vs-question at 24/32.

One mechanism explains three previously-separate observations:

  1. The agent's open op-read-then-write failure — "The website redesign work is finished now" is declarative
  2. A 2025 in-repo experiment's fine-tuned Gemma 3 12B ambiguity result (2/7)
  3. Laya's zero-shot behaviour now

A declarative state-change is surface-identical to a fact-report, and every model tested treats it as one. This is not a Laya weakness; it is the problem itself, and it specifies any future corpus precisely — imperatives are near-solved and would be wasted labelling effort.

Retraction from Round 1

The motivating case "Northwind Trading has moved their booking to April" scored 0.5011 (cpu-fp32), 0.5011 (mps-fp32), 0.5009 (fp16), 0.4967 (bf16) — it crosses the decision boundary under bf16 purely because it sits 0.0011 from the threshold. Round 1 scored this as a pass on what is numerically coin-flip noise. The widened set confirms it: its whole class scores 2/14.

The second failure axis: instance vs type

Operation errors are the consequential kind, and they cluster on a distinction that is conceptually harder than the tool descriptions imply.

Per-gold accuracy: create_node 1/4, get_node 1/4, update_node 2/4, update_schema 2/4, route_clarify 2/4 — against create_schema 4/4 and search_nodes 4/4.

Both instance→type confusions are on messages explicitly about one named entity:

  • "Add Northwind Trading as a new company" → predicted create_schema (gold create_node)
  • "Store a new company called Tailspin Toys" → predicted create_schema (gold create_node)

A schema IS a node — SchemaNode, node_type: "schema", same table, same semantic_search_nodes_of_type index. So create_node vs create_schema is not "what kind of thing gets created"; both create nodes. It is what level of abstraction the new node sits at — an instance vs a type definition. The criteria given to the model stated this plainly ("Store a new record of an existing entity type" vs "Define a brand new entity type that does not exist yet") and it still failed, which means the criteria wording is not the fix.

This is a distinct failure axis from declarative-vs-imperative, and it carries larger blast radius: a spurious type definition is worse than a spurious record. It is also not Laya-specific — Gemma made the same error during this work, routing "Set up a way to track pieces of delivery work" to Node Creation instead of Schema Creation, reading a type request as an instance request. Both models blur the same boundary in both directions.

Also observed: one read-predicted-as-write ("Open the record for Contoso Ltd" → update_node), and search_nodes over-predicted 12/40 against a true prevalence of 4/40.

Caveat: every operation probe item was unambiguous about instance-vs-type. The genuinely hard cases ("Add a venue" — one venue, or the venue type?) were not tested, so 1/4 is measured on the easy version of this distinction.

Threshold and operating point

  • Overall AUC 0.8393 at n=46 (0.857 at n=11 — holds).
  • Round 1's t=0.20, applied unchanged to the wide set, scores 37/46 (80.4%) — identical to that set's own in-sample optimum, so it generalised.
  • Split-fitted (200 stratified 50/50 splits, fit and eval on separate halves): held-out mean 0.746, median 0.739, p05/p95 0.652/0.870. So recalibration is worth ~74.6%, not 80.4%.
Threshold TP FP FN TN Precision Recall
default 0.5 13 0 15 18 1.000 0.464
fitted 0.194 23 4 5 14 0.852 0.821

At the default the head has perfect precision and 0.464 recall — it will not corrupt data, but it constantly asks instead of acting. That is the reluctance failure this spike set out to fix, reproduced. FP (writing unrequested data) and FN (a needless question) are not symmetric costs, which argues for a threshold nearer the default than the accuracy-optimal 0.194 — i.e. accepting worse than 74.6% in production.

Separately, 7 of 8 unscored ambiguous cases land above 0.194, including a bare entity name ("Northwind" at 0.2882), so a recalibrated threshold would act on near-empty input. A real abstain band is needed; noul alone does not provide one.

Note a calibration defect in the checkpoint itself: it ships an out-of-range temperature (0.1006) for the choice:11+ bucket, flagged by the vendor's own load-time warning. Past 10 options mean confidence triples while accuracy falls — confidence becomes anti-correlated with correctness. Our surfaces fit under that (~10 tools, ≤5 schemas), but a gate tuned at ≤10 options would silently invert if the tool surface grew.

What this does and does not support

Does not support replacing operation selection. 62.5% is a straight regression against the current path, where the tool surface is scoped by routing::stage2_tools and llama.cpp's grammar constrains the call envelope to a registered tool name — measured at 0 off-menu in 40 rounds. There is nothing to win here.

Does support schema selection as a narrow, separable adoption. 40/40 with CI [91.2%, 100%], 26/26 on field-discriminated cases. And the one schema failure observed on Gemma during this work was a format error (delivery job vs the registered delivery_job) — structurally impossible for choice, which returns a key from a supplied dict rather than generating a string.

Blocks act-vs-clarify on one identified deficiency rather than on vague accuracy: declarative state-changes.

Recommended next step (cheap, no training)

Run the existing zero-shot noul head over a few hundred real recorded turns and measure AUC on live traffic. No corpus, no fine-tune, no Rust. If AUC holds near 0.84, threshold recalibration alone may recover most of the benefit. If it collapses, that is a clean NO-GO and the corpus was never built.

Report imperative and declarative phrasings separately — an aggregate AUC hides the entire central finding.

This depends on recorded per-turn decisions, which is what #2802 produces.

Gate for revisiting a fine-tune (all four)

  • 300-500 labelled turns, over-sampling declarative state-changes
  • noul ≥90% held-out at a threshold fitted on a separate split
  • operation ≥95%, else keep Gemma for operations and use Laya only for noul+schema
  • calibration re-verified at the deployed option count

Caveats binding on all of the above

n=40-46 per probe type, single seed, one machine, zero-shot with no prompt iteration. Enough to rule out GO and to justify NEEDS-FINETUNING; not enough to claim Laya is accurate at schema selection in general. Probe-difficulty was audited against Round 1 (schema 10/10 → new 30/30; operation 60.0% → 63.3%; noul 63.6% → 68.6%) and no item was added, reworded, or dropped after seeing a prediction.

Related

Activity

  1. added
    question
    on Sep 22, 2026
  2. malibio commented on Sep 22, 2026

    @malibio
    CollaboratorAuthor

    Correction: the two instance-vs-type failures are at different layers, not one shared mechanism

    The issue body says Laya's create_node/create_schema confusion is "not Laya-specific — Gemma made the same error during this work" and treats both as one blurred boundary. That framing is too tidy and the code does not support it. The two failures happen at different layers, for different reasons, and conflating them would send anyone investigating this to the wrong place.

    What production actually gives Gemma

    The tool descriptions already state the boundary explicitly, from both sides (packages/agent/src/local_agent/tools.rs):

    • create_node (:885) — "Create one new record of a type that already exists. Use for a single instance, never to define a new kind of record."
    • create_schema (:1273) — "Define a new entity type with its fields. Use when the user describes a kind of record the workspace does not track yet, not a single instance of an existing kind."

    Each rules out the other's case by name. This is ADR-064 rule 2 ("tool descriptions own tool selection") done properly. create_node's description alone runs ~150 words including a worked example.

    Why Laya could not have used them

    Laya's choice candidates share a fixed 192-256 token budget across all options. Ten production-length tool descriptions would blow that budget and force truncation — which is the documented mechanism behind its degradation past ~20 options (Banking77: 0.425 vs Jev's 0.870, ~3-4 tokens per candidate).

    So the terse criteria the spike used ("Store a new record of an existing entity type" / "Define a brand new entity type that does not exist yet") were not a shortcut that handicapped the model — they are the format's constraint. Gemma reads ~150 words of disambiguating prose per tool; Laya gets ~20 tokens per candidate and cannot be given more.

    This is a structural limitation of the approach that the issue body did not state, and it is more consequential than the 62.5% number alone. Any choice call over NodeSpace's tool surface is permanently working from criteria an order of magnitude thinner than what the generative path already has. That is an argument against operation selection via choice independent of accuracy measurement.

    Where Gemma's failure actually was

    Gemma's observed error — "Set up a way to track pieces of delivery work, each with a name, a target finish date and a status" routing to Node Creation rather than Schema Creation — happened at Stage 1 skill routing, which matches an embedding of the user's message against skill description properties (ADR-064 rule 3: those are retrieval index keys, not documentation). Tool descriptions were not consulted at that point; by the time they matter, the whitelist has already been scoped by routing::stage2_tools.

    Both skill descriptions do encode the distinction (packages/agent/src/skill_pipeline.rs):

    • Node Creation (:421) — "…instances of any type… add, create, or insert a new item, record, entry, or example of an existing type"
    • Schema Creation (:479) — "…a kind of thing the user hasn't stored before… defining a new entity type or schema…"

    And retrieval still put Node Creation first for a type-definition request. So the failure is embedding similarity, not instruction quality: "track pieces of delivery work, each with a name, a date and a status" embeds near Node Creation's vocabulary (create, record, item, entry) despite being a type request. This is the same class ADR-038 Finding 4 records — indirect phrasing defeating raw-message semantic push — and the same class #1980 is open against.

    Corrected reading

    Gemma's failure Laya's failure
    Layer Stage-1 skill retrieval tool selection within an offered surface
    Signal used embedding of message vs skill description ~20 tokens of criteria per candidate
    Mechanism semantic similarity favours the wrong skill criteria too thin to encode the boundary
    Fix direction better retrieval signal (#1980) not fixable within choice's budget

    They are not one mechanism. The instance-vs-type boundary is genuinely hard in both places, but a fix for one does nothing for the other.

    What stands unchanged

    • Laya operation selection 25/40 (62.5%), create_node 1/4, and the two confusions being on explicitly-single-entity messages ("Add Northwind Trading as a new company", "Store a new company called Tailspin Toys")
    • The recommendation against replacing operation selection — now with a structural reason (criteria budget) alongside the measured one
    • That a schema IS a node, so the distinction is abstraction level rather than kind of thing — the observation that prompted this correction
    • The caveat that every probe item was unambiguous about instance-vs-type, so 1/4 is the easy version

    What changes

    The declarative-vs-imperative finding remains the one genuinely shared mechanism across Gemma, the 2025 fine-tuned Gemma 3 12B result, and Laya. Instance-vs-type does not belong in that category and should not be cited as a second cross-model finding.

  3. malibio commented on Sep 22, 2026

    @malibio
    CollaboratorAuthor

    Correction: the recommended next step is not runnable as written

    This issue's "Recommended next step" says to run the zero-shot noul head over "a few hundred real recorded turns," and points at #2802's per-turn decisions as the source. That is wrong, for the same reason the equivalent step on #2841 was wrong — see that issue's corpus-correction comment. Recording it here so the defect is not rediscovered a third time.

    Why it does not work

    1. #2802 records fixture prompts, not real messages. The eval's prompts — across decisions.ts, routing.ts and agent-matrix.ts — are hand-authored to exercise routing, and guidance_is_not_contaminated_by_eval_prompts exists specifically to keep them synthetic and independent of guidance wording. They are not traffic.

    2. No corpus exists on disk. eval:decisions writes results to /tmp/decisions-<label>-<ts>.json by default and nothing is committed. The 3-rep baseline recorded on #2802 is already gone.

    3. The failure mode is inverted, not merely weak. The entity names in those fixtures (Northwind, Contoso) are absent from the graph by design, so a noul pass over them would mostly measure a shape real traffic does not have.

    Since the AUC figure is the GO/NO-GO input for the act-vs-clarify question, a number from that corpus would be worse than no number — it would be cited as evidence. ADR-056 makes exactly this complaint about its own matrix scores ("describe the harness as much as the model"). Authoring a corpus ourselves fails the same way one layer down: we would be choosing the answer.

    Revised status of the three sub-decisions

    Decision Verdict Blocked on
    Operations No — settled nothing; 62.5% vs Gemma's 0 off-menu in 40, plus the ~20-token-per-candidate criteria ceiling
    Schema selection Yes, adoptable — settled nothing, but see below on urgency
    Act-vs-clarify (noul) Open a corpus of genuine user messages, which only real usage produces

    The noul question is also gated on #2841, independently of the corpus. Today's decision-eval baseline shows the agent failing because it cannot resolve a named entity to a node — it calls no tool and asks for a node ID. If entity-grounded routing removes that, a large share of what currently reads as "should I act or clarify?" stops being ambiguous at all: the model is not weighing a judgment, it is missing a fact. Measuring noul before #2841 lands would measure a baseline about to change.

    Note this can resolve in either direction. If #2841 removes most act-vs-clarify ambiguity, Laya's remaining role shrinks, possibly to nothing. If #2841's eventual prevalence figure shows resolvable entities are a minority of messages, most turns stay genuinely ambiguous and the role grows.

    On adopting schema selection now

    It is the one slice needing no corpus — 40/40, CI [91.2%, 100%], separable from both operations and act-vs-clarify, and it eliminates a failure class structurally (choice returns a key from a supplied dict, so the delivery job / delivery_job format error Gemma produced is impossible).

    But it should be filed and left unscheduled rather than picked up. The same eval shows the agent failing upstream of schema selection — it never reaches the choice. Adopting it now would optimise a decision that is not currently being made. #2841 is the prerequisite for that slice mattering.

    What this issue is

    A durable findings record (question label), not an implementation issue. It should stay that way. The follow-on work it implies belongs in separate issues:

    The general rule worth carrying

    Fixture prompts are not a substitute for real messages, and no committed corpus of real messages exists. This defect has now appeared in two issues (#2841 and this one), both times because "use #2802's recorded decisions" was written without checking what those decisions contain. Any future measurement that says "run X over real messages" needs its corpus identified before the step is treated as actionable.

  4. malibio commented on Sep 22, 2026

    @malibio
    CollaboratorAuthor

    One gate cleared, one remains — and the measurement itself has changed shape

    #2841's entity-resolution tier landed in #2856 (d4eaf894). That resolves half of what this issue was waiting on, and changes what the remaining measurement should actually measure.

    Gate status

    Gate Status
    The act-vs-clarify baseline was about to shift under entity grounding ✅ Cleared — the tier shipped
    No corpus of real user messages exists ❌ Still blocking

    The first gate is genuinely gone. The concern was that measuring noul before entity grounding would measure a baseline about to be superseded — the model was declining to act because it could not resolve a name, not because it was weighing a judgment. That change has now happened.

    The corpus gate is untouched. eval:decisions still writes to /tmp with nothing committed, and the eval's prompts remain hand-authored fixtures. Checked directly: #2856 added no entity field to TurnRecord, so the harness does not capture resolution outcomes per turn either.

    The measurement is no longer the one this issue describes

    This matters more than the gate change. With the tier shipped, the right question is act-vs-clarify on turns where the entity resolved.

    Turns that stalled for want of an entity — the ones that produced "I need a Node ID to update the capacity for Northwind Trading" — are no longer the interesting case. They are fixed. Measuring noul across all turns would now average a solved failure together with the residual judgment, and report something about neither.

    So the recommended next step should read:

    Run the zero-shot noul head over real recorded turns where entity resolution returned a match, reporting imperative and declarative phrasings separately.

    The imperative/declarative split remains essential — an aggregate AUC hides the central finding (imperative-vs-question 0.974, declarative-vs-question 0.702, declaratives 2/14).

    An open sub-question this raises: does entity grounding change the declarative problem at all? A declarative state-change ("Northwind has moved their booking to April") is surface-identical to a fact-report whether or not the entity resolves. The tier tells the model which node is meant; it does not tell it that a change is being requested. So the 2/14 declarative result may be entirely unaffected — which, if true, makes this the clearest remaining case for a decision model and is worth establishing before anything else.

    Unchanged

    The other two sub-decisions stand, independent of all the above:

    • Operations — no. 62.5% against Gemma's measured 0 off-menu in 40, plus the ~20-token-per-candidate criteria ceiling.
    • Schema selection — adoptable, unscheduled. Still true, and the tier's arrival does not make it urgent: the agent now resolves entities before routing, so schema selection is reached more often than it was, but nothing yet shows it failing there.

    What this issue is waiting for

    Real usage producing real messages. That is a product-maturity gate rather than an engineering one — there is no task anyone can pick up to accelerate it, short of shipping and using the product.

  5. malibio commented on Sep 22, 2026

    @malibio
    CollaboratorAuthor

    Measured: entity grounding fixed the declarative failure this issue predicted — and the residual is its mirror image

    Ran eval:decisions 3 reps against 6bc23eb0 (entity tier + the declarative pair), purged database between reps, gemma-4-e4b-q4km. 9 of 11 scenarios pass, zero variance — every scenario passed 3/3 or failed 0/3.

    The declarative pair split, deterministically

    Scenario 3 reps
    declarative-state-change-resolved — "Northwind Trading signed on a different date — it was the 20th of March." ✅ 3/3 — called update_node
    declarative-fact-report-resolved — "Northwind Trading has been a customer of ours for a long time." ❌ 0/3 — called search_nodes, expected no tool call

    This inverts the spike's prediction. The Laya spike measured declarative-act at 2/14 and diagnosed the model as failing to recognise a declarative sentence as a change request — imperative-vs-question AUC 0.974 against declarative-vs-question 0.702. That failure appears fixed: with the entity resolved, the model acts on a declarative state-change reliably, 3/3.

    What is left is the opposite failure: acting on a declarative that is not a request at all.

    The other failure is the same shape

    schema-on-menu-company — "Add Northwind Trading to the companies we sell to", where Northwind now already exists — fails 0/3 by calling create_node, duplicating the entity the turn just resolved. That is #2855 reproduced in the eval.

    So both remaining failures are over-action:

    schema-on-menu-company            create_node  on an entity that already exists
    declarative-fact-report-resolved  search_nodes on a sentence requesting nothing
    

    Neither is a selection error. The tool surface was correct in both cases, the entity resolved correctly in both, and the model chose to act when the right answer was to act differently or not at all.

    What this means for the act-vs-clarify sub-decision

    The question this issue holds open was framed as "should I act or clarify?", and noul was the proposed instrument. The measured residual is "should I act at all?" — a related but different question, and the spike's own numbers point the wrong way for it:

    default threshold 0.5 — precision 1.000, recall 0.464

    A gate that under-acts does not help an agent that over-acts. At the default operating point noul is reluctant to say "yes, act", which is precisely the wrong bias for these two failures. The threshold could be moved, but the spike measured that recalibration is worth ~74.6% held-out — and moving the threshold toward acting makes the over-action worse, not better.

    So the case for a noul gate as scoped in this issue is weaker after this measurement, not stronger. Whatever addresses over-action is a different mechanism than the one the spike evaluated.

    Unchanged

    • Operations — no. Settled independently.
    • Schema selection — adoptable, unscheduled. Note schema-on-menu-company's failure is not a schema-selection error; the schema resolved fine and the model then created a duplicate. Laya's choice would not have prevented it.

    Also recorded

    • The entity tier works. All three scenarios that previously failed 0/3 asking for a node id now pass 3/3, plus entity-no-match-is-a-create at 3/3.
    • Stage-1 decision cost: 2063–2486 ms mean, up from 1602–1933 ms before the tier. Worth noting, though the tier's own lookup is ~0.12 ms, so the increase is not resolution cost — likely a longer prompt from the added entity block.
  6. malibio commented on Sep 23, 2026

    @malibio
    CollaboratorAuthor

    Closing: the question was overtaken by measurement rather than answered

    All three sub-decisions are now settled, none of them in favour of adopting Laya. Closing this as a durable findings record rather than leaving it open to imply work the evidence no longer supports.

    Final disposition

    Sub-decision Verdict Basis
    Operations No 62.5% (25/40) against Gemma's measured 0 off-menu in 40 rounds. Independently, Laya's ~20-token-per-candidate budget cannot hold production's ~150-word tool descriptions, so the gap is structural rather than a tuning problem.
    Schema selection Adoptable, but there is nothing to adopt it for 40/40, CI [91.2%, 100%], 25 ms on MPS, and it eliminates a format-error class structurally. But the decision eval now shows schema selection is not where the agent fails — and the one scenario that does fail there (schema-on-menu-company) fails by creating a duplicate after resolving the schema correctly, which choice would not have prevented.
    Act-vs-clarify The case is weaker after measurement, not stronger See below.

    Why the act-vs-clarify case did not survive

    This issue's recommended next step was to measure noul on real turns, on the theory that declarative state-changes were the residual judgment. The spike measured declarative-act at 2/14 and diagnosed the model as failing to recognise a declarative sentence as a change request.

    Measured after the entity tier shipped (3 reps, zero variance):

    declarative-state-change-resolved   3/3  update_node      ← the spike's failure, fixed
    declarative-fact-report-resolved    0/3  search_nodes     ← the residual, inverted
    

    Entity grounding fixed the predicted failure. The residual is its mirror image — acting on a declarative that requests nothing — and the spike's own operating point points the wrong way for it:

    default threshold 0.5: precision 1.000, recall 0.464

    A gate that under-acts does not correct an agent that over-acts, and moving the threshold toward acting makes it worse. The mechanism that would address the observed residual is not the one this issue proposed.

    What actually fixed the motivating failure

    Not a decision model. A deterministic index lookup at ~0.12 ms — four orders of magnitude cheaper than the generative turn it informs, and roughly 200x cheaper than the fastest decision-model option measured here.

    The investigation's premise was sound and is worth keeping: typed decisions should not be made inside a generative pass. The conclusion is narrower than expected — for the decisions this agent actually gets wrong, the alternative to generation turned out to be a lookup, not a second model.

    Carried forward

    If this is ever reopened

    The gate stated earlier still applies, with one correction: the corpus would need to over-sample over-action cases (declaratives requesting nothing, references to entities that already exist), not the declarative state-changes the original spike targeted. Those are now handled.

  7. malibio commented on Sep 23, 2026

    @malibio
    CollaboratorAuthor

    Round 3: Stage-1 routing measured — NO-GO, and it closes the last untested decision

    The one decision Rounds 1-2 never measured was Stage-1 routing — the 3-way route_query / route_clarify / route_multi structural choice. It was the best remaining fit for Laya's envelope on paper: only 3 candidates, short criteria, and the most expensive non-generative decision in the pipeline (2063-2486 ms of autoregressive decode per turn).

    Measured now. It does not work, and the failure is not a threshold problem.

    Laya never chose route_clarify once, across 66 calls in three configurations

    Configuration n=15 95% CI
    verbose (production tool descriptions) 8/15 = 53.3% [30.1%, 75.2%]
    terse (hand-written one-liners) 10/15 = 66.7% [41.7%, 84.8%]
    always answer route_query (constant) 11/15 = 73.3% [48.0%, 89.1%]

    Both variants score below a constant function. Clarify recall 0/4 in both; the route_clarify column of the confusion matrix is empty. A binary control (route_multi removed, nothing truncated) still produced 0 clarify predictions and scored exactly the constant baseline.

    p(route_clarify) carries no rank signal: AUC 0.36-0.57 against chance 0.50.

    Why this is NO-GO rather than NEEDS-MORE-DATA

    Round 1 rescued the noul head because AUC 0.857 meant the ordering was right and only the threshold was misplaced — recalibration had something to operate on. Here there is nothing to recalibrate: Laya is a constant function on this input. No threshold moves a signal that is not there.

    Consistent with Round 2's mood-not-semantics mechanism: "organize my client contacts" is a well-formed imperative, ambiguous only in reference — a property of the knowledge base, not of the sentence surface. Laya reads surface form.

    Two corrections that supersede earlier rounds

    1. Latency is ~52 ms, not the ~25 ms carried over from Round 2.

    mean p50 p95 tokens
    verbose 51.5 ms 51.4 52.4 269
    terse 47.8 ms 42.4 72.9 192

    Driven by sequence length (Stage 1's system prompt is 269 tokens), not option count. Against Gemma's 2063-2486 ms that is 40-52x, saving ~2.0-2.4 s/turn — still large, but the ~80-100x figure used when scoping this probe was wrong and should not be requoted.

    2. Round 2's "192-256 shared token budget" framing was mis-scoped, and this matters for any future Laya use anywhere.

    Reading laya/common.py:68: each option is hard-capped at 48 tokens, before head_max_len=256 is consulted at line 70. For a small option set the binding constraint is 48 per option, not the shared 256.

    Verbose truncation, decoded: route_query 98→48 tokens, route_multi 85→48. Every dropped half was the negative/guard clause — route_multi lost its entire "Do NOT use this for a single intent" guard, which predicts the observed failure exactly (3 query-gold→multi errors in verbose, falling to 1 in terse).

    But terse is fully intact and still below the constant baseline with 0 clarify predictions. So the token budget was a real defect and not the limiting factor. The verbose→terse gain is not significant (exact McNemar p=0.50; ~366 items/arm needed for 80% power).

    Confidence still does not separate correct from incorrect

    AUC(confidence → correctness) = 0.407 verbose / 0.438 terse — at or below chance, with mean confidence marginally higher when wrong. This refutes the hypothesis that 3 options would land in the well-calibrated band: this is the valid choice:3-5 bucket (temperature 1.7602) and confidence fails anyway. Mean top-1 probability is only 1.22-1.30x above uniform, versus 2.25x on Round 1's 10-option task — typical output is query 0.40 / multi 0.37 / clarify 0.21, with query and multi near-tied on nearly every item.

    What would change the verdict

    Fine-tuning only, with AUC as the cheap early gate: if a fine-tune does not move p(clarify) AUC decisively above 0.5, stop there — no threshold work will help. The corpus would need to teach referential ambiguity: vague imperatives labelled clarify against near-identical well-formed ones labelled query. Rounds 2 and 3 jointly identify that as the single blind spot.

    Net effect on this issue

    Rounds 1-2 verdicts stand undisturbed, and the last open question is now closed:

    The boundary Round 3 draws is sharper than a flat rejection: Laya is plausible at closed-set selection among well-described alternatives, and measurably not viable at judging whether a request is answerable at all.

    Full results in LAYA_SPIKE_RESULTS.md (Round 3 section; Rounds 1-2 verified byte-identical). Environment and scripts remain in the session scratchpad.

    Filed separately, independent of Laya

    Round 3 surfaced two defects in the shipped routing eval that would matter if Laya had never existed — no route_multi coverage, and two arguable scenario labels. Tracked in their own issue rather than here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendquestion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions