fix(backend): rate the LLM on what it decoded, not on whether it finished #512
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/507-rate-from-exhausted-budget"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #507 (second attempt; the v4.2.1 fix in PR #509 did not hold on the bundled stack).
Live on dev after v4.2.1, the probe gave qwen3.5 the 2048-token reasoning budget and the model spent all of it thinking: 60.9 s,
finish_reason='length', no visible text, "Not measured" again. Raising the cap is the wrong lever, since the thinking is unbounded on this prompt and any cap a 3090 can finish inside is a deadline timeout on a CPU box.The premise was wrong rather than the number. 2048 tokens in 60.9 s is 33.6 tokens per second, the only figure the preflight exists to obtain. Reasoning tokens decode at the same rate as visible ones, and
measure_llm_tokens_per_runalready counts them through the same meter. The probe was discarding a good throughput sample because the model had not finished its sentence.OutputBudgetExhausted. It was the only transport raising ahead of_check_usage, which is why the probe sawcompletion_tokens: nullwhile the transport's own log printed 2048. Recorded directly rather than via_check_usage, which underjson_moderaises before reaching the meter and would replace the typed exception. Session cost telemetry gains these tokens too.ok: true,visible_text: false, rate filled in,error: "", plus anotesaying where the sample came from. An exhausted budget with no usage at all staysok: falsewith the error, so a broken endpoint still reads as broken.PROBE_MAX_TOKENS_REASONING2048 → 512: a rate sample, not room for an answer (about 100 s at 5 tok/s against the 300 s deadline).PROBE_MAX_TOKENSstays 128; the single retry for undeclared reasoning providers stays and never replaces a measurement with a failure.run_preflightalready read the rate rather thanprobe["ok"], so the band, expected-session estimate and timeout profile follow; now stated in code and covered end to end.Backend 2335 passed / 13 skipped, frontend 509 passed, ruff and eslint clean. No migration, no contract change. Goes out as v4.2.2; verification is the dev preflight showing a band at roughly 33 tok/s with the note.
🤖 Generated with Claude Code