Repository navigation
Fix: DeepSeek max_tokens 8192 limit - #459
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Reduces the completion token budget used by genome/dataset-synthesize to avoid exceeding DeepSeek’s max_tokens limit during dataset generation.
Changes:
- Lowered
maxTokensfrom16384to8192for theai/generatecall used by dataset synthesis.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ...(model && { model }), | ||
| ...(provider && { provider: provider as AIGenerateParams['provider'] }), | ||
| maxTokens: 16384, // Large enough for <think> reasoning + JSON output | ||
| maxTokens: 8192, // DeepSeek max is 8192. For models with <think>, reduce examplesPerTopic to fit. |
There was a problem hiding this comment.
Inline comment references examplesPerTopic, but this command uses exampleCount and there is no examplesPerTopic parameter. Update the comment to point to the correct knob (e.g., exampleCount) so future readers know what to reduce to fit within the token budget.
Suggested change
| maxTokens: 8192, // DeepSeek max is 8192. For models with <think>, reduce examplesPerTopic to fit. | |
| maxTokens: 8192, // DeepSeek max is 8192. For models with <think>, reduce exampleCount to fit. |
joelteply
added a commit
that referenced
this pull request
Aug 21, 2026
* fix(cognition): a top-salience block can vanish whole and nothing says so (#460) MEASURED live 2026-08-20, 25 consecutive delib turns across Atlas, Kira and Joaquin. On a 22,528 served window, identical every turn: completion_reserve 11,264 50.0% (window/2, COMPLETION_SHARE_DENOM = 2) tool schemas 7,013 31.1% (constant on all 25) framing 2,757-3,081 ~13.7% grounding 62-1,083 <1%-4.8% (median ~290; Atlas often 62-183) `workspace-map` (salience 0.90, the top tier) was dropped WHOLE on 20 of the 25. `mission` on 11. Demand ran 1.03x-2.48x the window on every turn. The workspace-map is the map of the files she is staged to edit. Atlas held claim-df9f4ad5 on pallets__flask-4045 with acts=0 and a checkout untouched since Aug 17 — three days. She could not see the repo. That is not write-avoidance (#390) and not model weakness: 0 acts is the correct response to 183 tokens of situational context. WHY NOTHING CAUGHT IT. `min_window_for_agentic_surface` is the sensor for this seam and it was correctly SILENT — 22,528 clears its ~16.9k bound. Its own doc says exactly why that proves nothing: "Necessary, NOT sufficient — clearing it does not mean she can hear you… never 'you are fine above it'", and it even names the mechanism, that a real turn's framing exceeds the bare floor "and context is what yields". The failure was written down before it happened. What was missing is a SUFFICIENCY sensor. THE SIGNAL, with no invented threshold. Contributions are taken highest-salience-FIRST, so ranking alone can never drop a 0.90 while keeping a 0.30. When that happens it is the SIZE interaction: a big essential block did not fit, then a small unimportant one did. The budget bought the cheap thing and lost the important one. `delib.context.salience_inversion` reports exactly that — a structural fact, not a tuned constant that would be a snapshot of one day's salience values. Divisible blocks are deliberately excluded: a prefix-truncated list announces itself in-prompt ("…N more not shown"), so it is degraded but never silent. Only WHOLE drops vanish without a trace. SENSOR, never a clamp — amputating the tool surface to make room is the deleted #206 cliff (14/14 SWE acts were `commands/help`, 0 edits). It reports; the budget fix is #460 and is not a decision this function may make. ALSO: deleted a sentence that was actively lying. `describe_tool_tokens`'s doc said "a single tiny schema… a handful of tokens, not the old full-registry dump" — true of the two-tool discovery pair, false since #206. The probe site 700 lines away has called it out as stale since 2026-08-06 ("reading that stale sentence is exactly why the right suspect got dismissed") but nobody deleted it from the function itself, so anyone reading the function still got the lie. It cost me a wrong mechanism on #459 earlier today. Replaced with the measurement (4,609 on 08-06 -> 7,013 on 08-20, +52%) and with why it grows unwatched: `native_tool_specs` is derived from `NATIVE = true`, so the per-turn cost of the tool surface is an unbounded side effect of a flag set in another file. Test pins the inversion AND the premise underneath it — that selection is highest-salience-first. If that ordering is ever lost the probe silently becomes noise; this makes that regression loud. All 22 prompt_shaping tests green, including the four load-bearing ones. De-hardcode guard green. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(cognition): the sensor had TWO holes and the FIRST live turn found both (#460) Deployed 2281e8b, watched the first real turns, and the sensor stayed silent through the exact condition it was written for. Both holes are mine. HOLE 1 — strict `>` against a population with NO salience spread. Live rows: Atlas budget=89 kept: roster(0.90), room-kanban(0.90) dropped: workspace-map(0.90) Benchy budget=102 kept: room-board(0.90) dropped: workspace-map(0.90), room-kanban(0.90) Kira budget=517 kept: workspace-map(0.90) EVERY essential source bids exactly 0.90, so `0.90 > 0.90` is false and nothing fired. My premise — "ranking cannot drop a 0.90 while keeping a 0.30" — is TRUE and VACUOUS: production has no 0.30 at this tier. What actually decides who survives is arrival order and byte size, a coin flip among equals, and losing the repo map to that flip is the entire harm. `>=` is the honest predicate; a real ranking success (0.30 dropped, 0.90 kept) still cannot fire it. HOLE 2, worse — TOTAL starvation was invisible. `min_by` over an EMPTY `selected` yields `None`, the `if let` fell through, nothing fired. The one state where the citizen gets NO grounding at all was the one state the sensor could not report. That is [[an-absence-is-an-unfinished-measurement]] — in the instrument built to end exactly that, written by me, on the same day I filed two other cards about the same shape. Now `None` is treated as maximal harm, and the probe carries a `verdict` naming which of the three cases fired (TOTAL / TIE / true inversion) plus `kept_count`. THE FINDING UNDERNEATH, bigger than the bug: SALIENCE IS NOT DISCRIMINATING. Every source bids 0.90, so attention ranking contributes nothing to the drop decision at this tier — size and order do all the work. Any future fix that tries to "respect salience" is tuning a dial that is already pinned. Noted on #460; not addressed here. The test used a constructed 0.30 for the low-salience keeper, which is why it passed against a sensor that could not fire in production. It now uses the LIVE shape (all 0.90) and cites the rows it came from. Also fixed: `tool_tokens` was interpolated into the probe message while only existing as a probe FIELD assignment, not a binding — compile error, caught before push. All 22 prompt_shaping tests green. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(cognition): justify the three unwraps the starvation sensor added (#460) CI red on `the_unjustified_unwrap_count_never_rises`: 2270 vs baseline 2267. Three, all mine, all in the sensor added by this branch. The ratchet is right and the fix is to state WHY each is safe on its own line — not to raise the baseline. Two are `partial_cmp(...).unwrap_or(Ordering::Equal)` in a max_by/min_by over f32 salience. `partial_cmp` returns None only for NaN. A NaN salience would be an upstream bug, and the thing being written here is the instrument that exists to REPORT budget pathology — it must survive a malformed input long enough to say so, not panic inside the sensor and take the turn with it. The third is the case the ratchet's own doc singles out — `cheapest_kept.unwrap_or(-1.0)` on a probe field, an Option becoming a quantity. It survives on a distinction worth writing down: `None` here is a KNOWN state ("nothing survived the budget"), not an unknown one. The doc's warning is about unknown-turned-quantity, which is how the Metal free-VRAM lie happened. Salience is [0,1], so -1.0 is out of domain and cannot be misread as a real salience, and `verdict` already carries the state in words. Commented in full at the site so the next reader gets the distinction, not just the exemption. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
16384 exceeded DeepSeek's limit. Reverted.