Repository navigation
0.3.4: repetition_penalty + auto max_inference_depth (decoding-only) - #61
Merged
Merged
Conversation
Two decoding-side fixes on the shared_first serving path, measured on the shipped 50M en-zh SFT checkpoint and five matched 30-min 15M arms. No kernel code, no retraining. Callers that leave repetition_penalty=1.0 see no behaviour change. repetition_penalty is threaded through speculative_generate, generate_stream, the OpenAI/Ollama serving adapter, and the ollama_server HTTP layer. The CTRL rule is applied on the raw logits before draft and verify so speculative rejection sampling still draws exactly from the full-depth target (Leviathan et al. 2023). Default 1.0. max_inference_depth now auto-selects at load time: the runtime picks the largest depth d whose cumulative trained dt is <= 1.15, keeping the iterated map inside the Lipschitz region. On the 50M CPT checkpoint (trained dt_sum 1.825) the selector picks d=3 (cum 1.108), the measured sweet spot. Opt out per checkpoint with config.auto_inference_depth or process-wide with CHRONOS_AUTO_INFERENCE_DEPTH=0. Combined on the shipped 50M SFT checkpoint, 60-token greedy unique_ratio goes 0.129 -> 0.692 and max_4gram 8.83 -> 2.33 with no retraining. Experiments landed under experiments/loop_depth_15m/results_abc with findings. Kernel is not wrong; current preset recurrent_depth=4 is over-budgeted for small checkpoints — documented, no default change. Tests: tests/test_0_3_4_decoding.py (6 cases); existing speculative and serving suites unchanged (14+57 passing). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What this is
Two decoding-side fixes on the shared_first serving path, measured on the shipped 50M en-zh SFT checkpoint and five matched 30-min 15M arms (base, A_dtcap, B_plain, C_periter, obj_lm). No kernel code, no retraining. Callers that leave
repetition_penalty=1.0see no behaviour change.Changes
repetition_penaltythreaded throughchronos.runtime.speculative.speculative_generate,chronos.serving.runtime.generate_stream,chronos.serving.adapter.ChronosServingAdapter.generate, and the Ollama/OpenAI HTTP layer. CTRL rule applied on the raw logits before draft and verify so speculative rejection sampling still draws exactly from the full-depth target (Leviathan et al. 2023). Default 1.0.max_inference_depthauto-select at load time. The runtime picks the largest depthdwhose cumulative traineddt[:d] ≤ 1.15, keeping the iterated map inside the Lipschitz regionL ≤ 1. On the 50M CPT checkpoint (traineddt_sum = 1.825) this picksd = 3(cum_dt = 1.108), the measured sweet spot in the depth sweep. Opt out withconfig.auto_inference_depth=FalseorCHRONOS_AUTO_INFERENCE_DEPTH=0.unique_ratio0.129 → 0.692;max_4gram8.83 → 2.33. No retraining.What this does not do
repetition_penalty=1.15still produces "Paris is the capital of the United States" / "水的沸点是水中水". The remedy is more data / tokens, not a kernel knob.recurrent_attention_mode. per_iteration (C_periter) is the cleanest decoder in the ABC runs (max_4gram 10.7 vs 18.6) but costs 4× KV memory, disables inference-time depth override, and disables speculative decoding.Experiments
experiments/loop_depth_15m/results_abc/— five 30-min 15M arms, each with its.pth,metrics.jsonl, probe JSON, and a final findings file.Tests
tests/test_0_3_4_decoding.py— 6 new cases.tests/test_speculative.py(14 cases) and all 57 serving-related tests pass.🤖 Generated with Claude Code