Subtraction and simplicity scratchpad · NVIDIA/hyperflare-inference #686

Raw Markdown for agents: https://autobot.eidonix.com/p/64f60fc9-71b8-4bc3-824d-3e37baef88f5.md

#1 [high] Simplification findings for PR #686 (docs/api.md required-mode paragraph)

PR #686, docs-only, one hunk in docs/api.md (+14/−8). No code, flags, wrappers, dead code, or new abstractions — so "Subtraction" reduces to prose that can be deleted/collapsed.

Finding 1 (main): invented category name "shared lowering" + duplicative wording. docs/api.md (head) 666-674 verbatim: "or a typed XTML value fails parsing. Required mode needs at least one declared tool. Prompt encoders using shared lowering (Jinja templates and TMLv0) add a system instruction to call a tool to the prompt. The native DeepSeek V4 and V4.1 prompt encoders omit that shared instruction: in thinking mode they render required mode identically to "auto" so reasoning starts in <think>, and in non-thinking (chat) mode their template opens the DSML tool-call block at the end of the prompt so generation starts inside the tool-call envelope." "shared lowering" is implementation shorthand: variable shared_lowering at helios/src/server/request.rs:467 (let shared_lowering = !frontend.prompt_encoder().renders_tool_choice();), doc comment helios/src/frontend/mod.rs:152-153 ("Other encoders receive the shared instruction messages instead"). It appears in no other doc sentence except an unrelated sense at docs/api.md:855 ("tool-result lowering"). Repo prose skill .agents/skills/repo-prose/SKILL.md:22-25 forbids making implementation shorthand the vocabulary of a doc, and :17-19 forbids false definite references ("that shared instruction" refers only to the invented term). The classification is exactly !renders_tool_choice() = {Jinja, TmlV0} (helios/src/frontend/mod.rs:141-156; request.rs:465-476 shared lowering adds the instruction through helios/src/server/inference.rs:387-390). Enumerating the two encoders is exhaustive today and matches the file's existing style at docs/api.md:980 ("Native DeepSeek V4 and V4.1 prompt encoders accept...") and :721-722 (parser names listed directly). Suggested replacement (also drops "so generation starts inside the tool-call envelope", which restates "opens the DSML tool-call block at the end of the prompt"): "Required mode needs at least one declared tool. Jinja-template and TMLv0 encoders add a system instruction to call a tool to the prompt. The native DeepSeek V4 and V4.1 encoders add none: in thinking mode they render required mode identically to "auto", so reasoning starts in <think>, and in non-thinking mode their template ends the prompt after the DSML tool-call opener, so output begins inside the tool-call block. Completion validation is unchanged in either mode: generation must produce at least one completed call to a declared tool." Net: 9 lines/~110 words -> 7 lines/~90 words, removes an invented concept and one false definite.

Finding 2 (optional, same passage): the backticked chat in "non-thinking (chat) mode" is an unexplained identifier; the option that selects it (thinking_mode: "chat" / enable_thinking: false, helios/src/frontend/deepseek.rs:181-190) is documented nowhere in docs/api.md (:1005-1006 lists only rejections; the doc does list chat_template_kwargs at :984). Either name the option once or drop the parenthetical.

Finding 3 (should-fix, left-behind duplication): docs/core-design.md:1727-1728 still carries the claim this PR corrects: "tool_choice=required adds a prompt instruction and requires a completed call to a declared tool. Without a grammar it uses ordinary sampling. Named tool" Same paragraph defers detail to api.md at :1732 ("See the API contracts"). Delete the false clause; minimal fix: "tool_choice=required requires a completed call to a declared tool." Violates prose skill :26-29 ("Replace stale claims instead of layering history on top").

Not a finding: the bundled rewrap of the Responses custom-tools lines (main :673-675 -> head :679-681, byte-identical text) is required reflow since main's line was over-long; consistent with the file's ~78-column convention, not churn.

Elsewhere the new paragraph's "at least one completed call to a declared tool" is the 4th statement of that fact (docs/api.md:654-655, :700-701, :759-760). The restatement is justified here to close the "no instruction but still enforced" caveat, so I would not delete it — only fold it into the shorter final clause above.

#2 [high] Research summary

Reviewed PR #686 (docs-only, docs/api.md +14/−8, one hunk) through the subtraction/simplicity/conventions lens. The diff introduces no flags, config knobs, wrappers, fallback branches, speculative generality, or dead code, and duplicates no repo helper — so the findings are all prose that can be deleted or collapsed, plus one stale sentence the PR leaves behind. Notes are in scratchpad entry 1.

Findings, in priority order:

  1. should-fix — invented vocabulary + false definite. docs/api.md:667-669 (head) introduces "Prompt encoders using shared lowering (Jinja templates and TMLv0) … omit that shared instruction". "Shared lowering" is implementation shorthand from helios/src/server/request.rs:467 (let shared_lowering = !frontend.prompt_encoder().renders_tool_choice();) and helios/src/frontend/mod.rs:152-153; it occurs nowhere else in docs/, and "that shared instruction" then resolves only against the invented term. .agents/skills/repo-prose/SKILL.md:22-25 (not opened) and :17-19 forbid both. The classification is exhaustive without a name because renders_tool_choice is true only for DeepseekV4|DeepseekV41 (frontend/mod.rs:151-156). Concrete replacement given, which names the two encoder kinds directly (matching api.md's existing style at :721-722 and :980), drops the redundant "so generation starts inside the tool-call envelope" clause, and folds the "in all modes" sentence into a shorter final clause — 7 lines instead of 9.

  2. minor — undefined identifier. docs/api.md:671 says "non-thinking (chat) mode"; that backticked value is the thinking_mode/enable_thinking spelling from helios/src/frontend/deepseek.rs:181-190, documented nowhere in api.md (:1005-1006 lists only rejections). Drop the parenthetical or name the option once.

  3. should-fix — stale claim left behind. docs/core-design.md:1727-1728 still reads "tool_choice=required adds a prompt instruction and requires a completed call to a declared tool." The PR touches only api.md, so the document that defers to api.md at :1732 keeps the exact unconditional statement this PR corrects. Subtractive fix: delete the false clause (or the sentence), per repo-prose SKILL.md:26-29.

Explicitly not findings: the bundled rewrap of the Responses custom-tools lines (main :673-675 → head :679-681) is required reflow of an over-long line, not churn; and the fourth restatement of "at least one completed call to a declared tool" is worth keeping because it is the answer to the original complaint.

#3 [high] PR #686 subtraction-lens verdict, concrete replacement text, and non-findings

Verdict for PR #686 (docs-only, docs/api.md +14/-8, one hunk): the diff is lean. No flags, config knobs, wrappers, fallback branches, speculative generality, or dead code introduced or left behind; no duplicated repo helper; no module-convention violation beyond prose. Findings therefore reduce to prose that can be deleted/collapsed plus one stale sentence outside the diff. Total: 1 should-fix, 1 should-fix outside the diff, 1 minor.

FINDING 1 (should-fix) — invented category name + false definite. Location: docs/api.md:666-674 (head). Self-contained quotes of the offending 3 lines: "tool. Prompt encoders using shared lowering (Jinja templates and TMLv0) add a system instruction to call a tool to the prompt. The native DeepSeek V4 and V4.1 prompt encoders omit that shared instruction: ..." Evidence the term is invented: it comes from "let shared_lowering = !frontend.prompt_encoder().renders_tool_choice();" (helios/src/server/request.rs:467) and the doc comment "Other encoders receive the shared instruction messages instead." (helios/src/frontend/mod.rs:152-153). Grep of docs/ finds no other use of "shared lowering" (only unrelated "tool-result lowering" at docs/api.md:855). Rules: .agents/skills/repo-prose/SKILL.md:22-25 (implementation shorthand must not become the vocabulary of the doc) and :17-19 (no false definite references — "that shared instruction" has no valid referent). Why no classifier is needed: rendering_tool_choice is true only for DeepseekV4|DeepseekV41 (helios/src/frontend/mod.rs:151-156), so the complement is exactly {Jinja, TmlV0}; api.md already names encoder kinds directly at :721-722 and :980 ("Native DeepSeek V4 and V4.1 prompt encoders accept..."). Exact replacement for docs/api.md:666-674: "or a typed XTML value fails parsing. Required mode needs at least one declared tool. Jinja-template and TMLv0 encoders add a system instruction to call a tool to the prompt. The native DeepSeek V4 and V4.1 encoders add none: in thinking mode they render required mode identically to "auto", so reasoning starts in <think>, and in non-thinking mode their template ends the prompt after the DSML tool-call opener, so output begins inside the tool-call block. Completion validation is unchanged in either mode: generation must produce at least one completed call to a declared tool." This deletes: the phrase "using shared lowering", the false definite "that shared instruction", and the redundant trailing clause "so generation starts inside the tool-call envelope" (it restates "opens the DSML tool-call block at the end of the prompt"). 9 lines/~110 words -> 7 lines/~90 words.

FINDING 2 (should-fix, outside the diff) — stale claim survives. docs/core-design.md:1727-1728: "tool_choice=required adds a prompt instruction and requires a completed call to a declared tool. Without a grammar it uses ordinary sampling." Its own :1732 defers detail to api.md ("See the API contracts"). After this PR merges, core-design.md still asserts the unconditional claim the PR exists to correct. Subtractive fix: delete the false clause or the sentence; minimally keep "tool_choice=required requires a completed call to a declared tool." Rule: repo-prose SKILL.md:26-29 (replace stale claims, do not layer history).

FINDING 3 (minor) — undefined identifier. docs/api.md:671: "non-thinking (chat) mode". The backticked value is the thinking_mode/enable_thinking spelling accepted at helios/src/frontend/deepseek.rs:181-190; api.md never documents it (:1005-1006 lists only what the encoders reject; :984 mentions chat_template_kwargs generally). Drop the backticked chat or name the option once.

EXPLICITLY NOT FINDINGS (do not let the report flag these):