Repository navigation
Conversation
…t samples An engine that adds a request's speculative-decoding counters when the request ends puts each request's drafts in one sample. gr8 did that (kindlingai/gr8#388 makes them live). Agent traffic finishing a request every few seconds then put one burst in nearly every window, and tool-call JSON accepts about 98% of its drafts, so finished requests read as an exact loop. _loop_signal now also needs the draft counter to have moved in loop_moving_share (0.8) of the window's samples.
|
Verified the premise and the tests locally, plus one cross-engine finding that changes how the guard behaves per engine. Premise confirmed. kindlingai/gr8#388 ("spec-decode counters move while a request decodes") is the upstream fix; this box's gr8 build still emits per-request counters (g6s2shim.py line 792, "per-request counters, added once"), so the false positive is real here. LIMCARS polls at Tests verified. On Linux: 19/19 pass in Cross-engine finding — the moving-share default misreads the counter cadence for post-#388 gr8. The guard assumes the counter advances at poll cadence. gr8 post-#388 writes the cumulative m line at most once a second (gr8#388's change list), so at
Lowering the default to ≤0.5 fixes it: burst-at-request-end engines still read ~0.1 (suppressed), post-#388 gr8 reads ~0.5 (detection works), live engines read ~1.0 (unchanged). Engines without a Separate, not your scope: post-#388 gr8 with live counters, tool-call JSON at ~98% acceptance reads |
The loop warning (
_loop_signal) assumes the engine's speculative-decoding counters move as it decodes. gr8 adds each request's draft counters to/metricswhen the request ends (kindlingai/gr8#388 changes that). That makes the warning fire on normal agent traffic:On a GLM-5.3-Flash serve, a 5 s poll of the counters showed
vllm:generation_tokens_totalrising about 50 a second while the draft counters stayed flat between request ends.Change
_loop_signalcounts a window only when the draft counter went up in at leastloop_moving_shareof its samples (new config key, default 0.8). An engine that reports counters as it decodes moves them in every sample, so the existing behaviour holds there._moving_share(logical, since): the share of samples sincesincein which a counter went up.test_loop_warning_ignores_counters_that_arrive_per_request: one burst every 5 s at 98.7% acceptance for 60 s never warns.test_loop_warning_needs_every_draft_accepted_for_loop_warn_sstill passes.Tests
python -m pytest tests/test_sampler.py: 19 passed. The new test fails without the change. The full suite on macOS has the same 13 failures with and without this change (test_portability.py,test_portability_linux.py,test_recipes.py).