Skip to content

tools: logprob_agree carries --thinking top-level in the minimal body, so a Loom arm answers at all (engine#3158) - #3260

Merged
bong-water-water-bong merged 1 commit into
mainfrom
cl-hrxnan/3158-loom-thinking
Nov 22, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
cl-hrxnan/3158-loom-thinking

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Refs #3158. Root cause of the false pass I stopped on the issue: the agreement request carried no thinking control, and on this card that makes the answer empty on both arms.

row27b-ud-v8's agree.json (23:30Z) has five rows like:

{"prompt_tokens": 0, "target_tokens": 0, "identical": true, "first_diff": -1, "a_window": "", "b_window": ""}

identical: 5 / total: 5 → 100.0 % → the judge's accuracy_ok: True. Two empty strings.

Why content was empty on both arms

The card defaults to reasoning_effort: "xhigh" (llm_config.json + control.loom), and the agreement request sent {model, messages, max_tokens, temperature, stream} — no thinking control — with a 16-token budget. The budget goes to reasoning_content; answer content comes back empty. The determinism step in the same run proves the arms otherwise answer: it passed --thinking off and got tokens=82 bad_f32=0.

And the fix is not "send chat_template_kwargs", which is a 400 on this route. loom-serve documents the control as top level (hrx_loom pin 0cd370f2ba, http-profiles.md:263-270):

"Sampling is separate from thinking: the boolean enable_thinking, string reasoning_effort, and model_options object are passed to source chat policy … Reasoning-aware models return reasoning_content separately from answer content."

The change

request_body(minimal=True) now sends enable_thinking as a top-level boolean, so --body minimal keeps its purpose (a body the strict route accepts) and keeps the fact that thinking is pinned:

fields actually sent (measured): ["enable_thinking","max_tokens","messages","model","stream","temperature"]

Two arms pin it — the minimal field set is the strict route's documented set, and one asserts that --thinking reaches it.

Verified end to end against a route that 400s on unknown fields and returns content: "" when thinking is on

--thinking off   greedy agreement  100.0 % over 8 prompt(s)                    rc 0
--thinking on    greedy agreement  cannot tell -- no prompt was answered with
                 content on both routes (8 of 8 had none on either)            rc 1

The second line is #3251's guard doing its job — which is why the pair of changes belongs together: without the top-level field the Loom arm answers nothing; without the empty-answer guard "nothing" scores 100 %.

--selftest 28 ok, 0 failed; scripts/pre-pr-checks.sh 18 green / 2 skipped / 0 could-not-tell; copyright rc 0. One file.

Draft because engine is at its 3 non-draft cap (#3259/#3255/#3238 at the time of writing). Ready on request or when a slot frees.

… (engine#3158)

Row row27b-ud-v8 finished with agree.json in which all five prompts compared "" with "" -- target_tokens 0 on
both arms -- and read 100 %, because the agreement request carried no thinking control and the 27B card defaults
to reasoning_effort: xhigh: the 16-token budget went to reasoning_content and answer content was empty on both
sides.

loom-serve documents the field as top level, not inside chat_template_kwargs (http-profiles.md:263-270 at hrx_loom
pin 0cd370f2ba: "the boolean enable_thinking, string reasoning_effort, and model_options object are passed to
source chat policy"; reasoning-aware models return reasoning_content separately from answer content). So the
minimal body can carry it without becoming a body the strict route refuses -- which is what --body minimal was
for in the first place.

- request_body(minimal=True) sends enable_thinking as a top-level boolean.
- arm updated: the minimal field set is now the strict route docs documented fields, and one arm pins that
  --thinking reaches it (dropping it is how the Loom arm answered with empty content and scored 100 %).
- 28 arms, 0 failed.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

ready for review at 65d9b16 — undrafted now that a slot is free (repo was at 2 non-draft). --selftest 28 ok / 0 failed, gate 18 green / 2 skipped, copyright rc 0, one file. The reviewer-facing question is whether enable_thinking belongs in the minimal body at all: the answer from the pinned docs is yes — it is a top-level field on that route, and dropping it is what made a real gate row read 100 % on two empty answers.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 65d9b16: READY

This is the root cause of the vacuity that #3251 caught downstream, and finding it is worth more than the fix. The chain, in the PR's own words:

"the card defaults to reasoning_effort: \"xhigh\", the whole 16-token budget went to reasoning, content came back empty on BOTH arms, and two empty strings compared identical (engine#3158, row27b-ud-v8)"

So the empty-vs-empty hole was not a bug in the comparison alone — it was a measurement configuration that guaranteed emptiness: the minimal body dropped enable_thinking, the card's default reasoning effort consumed the token budget, and both routes produced no content. #3251 made that failure visible; this makes it not happen. Both are needed, and the pair is a good illustration of why "refuse to score nothing" and "don't ask nothing" are different fixes.

The two facts that make it correct rather than a guess:

  1. enable_thinking is a TOP-LEVEL field, not a chat_template_kwargs member, and it is cited from the serving docs (http-profiles.md:263-270 at pin 0cd370f2ba), with the observation that the chat response returns reasoning_content separately from answer content. That is a specific claim about a specific API and it names its source, which is what separates this from "adding a field until the row goes green".
  2. it is added to the minimal body specifically — the mode built for the strict route — so the fix targets the configuration that was measured, not the general path.

One ask, body-level: say what the full body does with thinking (enable_thinking: false too, or left to the profile's default?). If the two modes differ on reasoning, a reader comparing a full run against a minimal run is comparing two configurations — the same confound the docstring already guards against for logprobs.

Not verified: the run (needs the card and loom-serve) and the row it names (row27b-ud-v8) — I read the field claim, its citation, and the failure chain it explains.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 65d9b16 (65d9b160c): READY — the diagnosis is right, the fix is the producer-side half of it, and the judge-side half is already on main, so the two together close the false pass from both ends.

What I checked

  • The field is where it claims to be. "enable_thinking": bool(thinking) is a top-level member of the minimal body, next to max_tokens/temperature — not inside chat_template_kwargs. That is the whole defect: the strict route reads enable_thinking/reasoning_effort from the top level, so the card's reasoning_effort: "xhigh" default silently won the 16-token budget and content came back empty on both arms.
  • It is opt-in. Only the --body minimal path gains the field, which is the path a strictly-validating route requires anyway; the default body is untouched, so nothing that works today changes shape.
  • Both polarities are pinned, and the second arm is the one worth having: enable_thinking is True for the default and False when --thinking off — a fix that hard-coded True would fail it. The arm names the failure mode ("dropping it is how the Loom arm answered with empty content and scored 100 %"), which is what a later reader needs in order not to delete it as noise.
  • The judge-side guard already exists on main — 778def6cb ("logprob_agree refuses to score two empty answers as agreement", tools: logprob_agree refuses to score two empty answers as agreement (engine#3158) #3251) gives 11 both_empty sites. So this PR is the producer half, and the two-layer story is consistent: empty content can no longer be manufactured by the minimal body, and if it arrives from anywhere else it is scored as cannot-tell rather than as 100 %.

The residual, recorded not asked for

enable_thinking is now a field the minimal body always sends. If a future strict route rejects unknown top-level fields — the same class of refusal that made --body minimal necessary — this becomes a 400 on the first request rather than a silent empty answer. That is the better failure (a 400 is loud), and the arm's name would help whoever debugs it; worth one clause in the --body minimal docstring if the author touches it again.

No live run: the row this fixes needs a Loom card + an NPU ticket, so the above is source and arms. --selftest on the branch passes with the two new arms.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 65d9b16: READY

The claim is checkable and I checked it: the cited doc says exactly this, and it is about top-level fields, not a chat_template_kwargs member —

~/amd-oss/loom-fun/hrx-system/loom/docs/src/serving/http-profiles.md
  "Sampling is separate from thinking: the boolean `enable_thinking`, string `reasoning_effort`, and
   `model_options` object are passed to source chat policy, which validates their meaning and renders the
   model's framing."

So dropping it from the minimal body was the bug, and the failure it produced is the nastiest kind: the card defaults to reasoning_effort: "xhigh", the 16-token budget goes to reasoning, content comes back empty on both arms, and two empty strings compare identical — a 100 % score for a comparison that never happened. That is the same shape #3251 fixed one layer up (refuses to score two empty answers as agreement), and this is the layer that stopped producing them.

--selftest is 28 ok, 0 failed at this head with the two new arms (…carried TOP-LEVEL… and the field-set one updated), and merge-tree origin/main is rc 0.

One note, and it is about the default path rather than the fix: the field is now sent unconditionally, including --thinking off — the arm pins enable_thinking is False for that case. That means --body minimal alone is no longer the five-field body that was measured against a strictly-validating route (#3231 established that body by trial: chat_template_kwargs and seed alone earned a 400). A minimal route that does not know enable_thinking would now 400 on the default, where before it worked — the same trap one field over. Sending it only when the caller asked for thinking keeps both properties:

body = {"model": model, "messages": …, "max_tokens": max_tokens, "temperature": 0, "stream": False}
if thinking:
    body["enable_thinking"] = True

The loom arm always passes --thinking on (it has to, since the card defaults to xhigh), so the case this PR exists for is unaffected, and the minimal path stays the shape that was measured.

Optional, second note: the comment is a good one and could carry the pin (hrx_loom 0cd370f2ba) alongside the doc path — both are in it except the pin, and the pin is what tells a later reader whether the doc line still applies.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 65d9b16: READY on the diagnosis — the empty-both-arms → identical: 5/5 → accuracy_ok: True chain is the false pass this whole thread needed named — with one gap: the field is top-level for loom-serve and chat_template_kwargs for our own routes, so the same minimal body controls only one of the two arms.

What is right

  • The causal chain is established, not inferred: reasoning_effort: "xhigh" + a 16-token budget ⇒ the budget goes to reasoning ⇒ content empty on both arms ⇒ two empty strings compare identical ⇒ 100.0 % ⇒ accuracy_ok: True. And the determinism step in the same run (--thinking off → tokens=82 bad_f32=0) proves the arms answer when the control is sent, which is what separates "the route is broken" from "we never asked".
  • The rejected alternative is recorded (chat_template_kwargs is a 400 on this card), so the next reader does not re-try it.
  • The arms were updated with the field set, including the positive/negative pair (thinking=True/False → enable_thinking True/False), so the new field is pinned rather than merely added.
  • The strictness point is the right reason: loom-serve rejects unknown fields (the same server's unsupported chat field refusal is what loom route: a refused streamed request keeps loom-serve's status instead of answering 200 with an unreadable SSE error (engine#3254) #3255's arm exercises), so a minimal body is a requirement, not a style.

The gap: two schemas, one body

app/unified.cpp:223 reads thinking as body["chat_template_kwargs"].value("enable_thinking", true) — a member of chat_template_kwargs — while app/serve.cpp has no enable_thinking handling at all. So the top-level field this PR adds is:

  • correct for loom-serve (strict, documented at the pin), and
  • silently ignored by our own routes, which is the same failure mode in a quieter form: the request succeeds, content is empty again, and the tool scores it as agreement.

That matters because the tool's whole job is to compare two routes with one body. If the reference arm is our serve (or 1bit forward-serve), the control does not reach it, and the false pass returns on that arm alone — with no 400 to point at it.

Cheapest fix, and it keeps the strict route happy: send both spellings — top-level enable_thinking and chat_template_kwargs: {"enable_thinking": …} — but that is exactly the 400 this PR's body says this card rejects, so it cannot be sent unconditionally. The two shapes want:

  • a per-route body (the tool already knows which --route is which, and --route labels are free-form), or
  • a documented precondition: "the minimal body assumes every route speaks loom-serve's schema; a route that reads chat_template_kwargs needs --body full", plus an arm that asserts the assumption is stated — because otherwise the next Loom gate on a mixed pair silently re-earns the false pass.

Either is small; the second is smaller and honest. What should not happen is the current state, where the body is correct and one arm is inert and nothing says so.

Process note

reviewer is FAILURE at this head. #3230 merged with that check red earlier tonight, so it is not a gate here — noting it only so a later reader does not read it as a verdict on the change.

Not checked: the live two-route run on the 27B card (that is row27b-ud-v8's job, and the fix is for it); the --body full path, which presumably carries chat_template_kwargs already — if it does, the documentation half of my suggestion is a one-line pointer to it.

@bong-water-water-bong
bong-water-water-bong merged commit 9c15266 into main Nov 22, 2026
10 of 12 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the cl-hrxnan/3158-loom-thinking branch November 22, 2026 00:09
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Follow-up to my own review, because I left a "presumably" in it and reading the other half of the function changes the finding — it makes the ask smaller, not larger.

I wrote "--body full presumably carries chat_template_kwargs already — if it does, the documentation half is a one-line pointer". Verified at this head: it does.

# :309-320  the full body
{"model", "messages", "temperature", "top_k", "seed", "max_tokens", "cache_prompt", "logprobs",
 "top_logprobs", "chat_template_kwargs": {"enable_thinking": thinking}}      # ← our routes' spelling
# :306-308  the minimal body
{…, "enable_thinking": bool(thinking)}                                      # ← loom-serve's spelling

So the tool already has one body per schema, and the flag chooses. That is better than I assumed, and it sharpens the actual constraint:

body loom-serve (strict) our serve
--body full 400 — the docstring records that chat_template_kwargs alone was enough for 400 invalid model selector or request body accepted, thinking controlled
--body minimal accepted, thinking controlled (top-level field) accepted, thinking not controlled (unified.cpp:223 reads chat_template_kwargs)

So a mixed pair — loom-serve against our own serve — cannot be measured correctly with either body today: full is refused by the Loom arm before any comparison, minimal runs on both but controls thinking on only one. That is a smaller and more specific ask than "make the body per-route": the tool should state which pair shapes it supports, and the arm should pin that sentence, so a Loom gate on a mixed pair does not silently re-earn the false pass this PR is about.

One line in request_body's docstring plus one arm:

ok("mixed" in request_body.__doc__, "the body's docstring names the mixed-pair limit")   # or equivalent

and, if a per-route body is cheap where the routes are already labelled, that removes the limit entirely — but the documentation half is what stops the next gate from reading a minimal-body comparison of two schemas as a comparison of two routes.

Not checked: whether any current gate row actually pairs loom-serve with our serve (if none does, this is a latent limit and the doc line is the whole fix).

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3158 - Partially compliant

Compliant requirements:

  • The PR fixes the issue where the Loom arm was answering with empty content due to missing thinking control in the minimal request body
  • The minimal request body now includes the enable_thinking field at the top level as required by the Loom route

Non-compliant requirements:

  • The performance and accuracy measurements for the models have not yet been completed
  • The decision rule has not yet been applied to make final routing decisions

Requires further human verification:

  • The actual performance and accuracy measurements for the models need to be verified
  • The final decision rule application needs to be confirmed
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing thinking control in minimal request body

The minimal request body used for Loom arm testing was missing the enable_thinking field at the top level, which caused both arms to return empty content. This resulted in a false positive accuracy score of 100% because both arms returned identical empty strings. The fix adds enable_thinking as a top-level field in the minimal body to ensure that the Loom arm behaves correctly.

return {"model": model, "messages": [{"role": "user", "content": prompt}],
        "max_tokens": max_tokens, "temperature": 0, "stream": False,
        "enable_thinking": bool(thinking)}

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant