Repository navigation
Price a new slot's deadline requests from the requests it is decoding; deadline decode rate follows the 32-token rule - #2675
Closed
jonathan308 wants to merge 5 commits into
Conversation
…nce it has a sample Deadline admission's decode rate (observedDecodeTpsEwma and the measured decode step) now follows the published rate's rule: after its first sample a request that generated fewer than 32 tokens leaves it unchanged. Any completed request still starts it, on a new slot or after the decode evidence expired, so a slot that serves only short replies keeps a decode rate and is priced for deadline requests as before. Only deadline admission reads this rate. The heartbeat's observed_decode_tps, the rate's age and performance_measurements are unchanged. Two existing tests asserted that a second short reply moved the deadline rate; they now assert it stays at the first sample's value.
Before its first completed request a slot has no decode rate, so a request with a first-content deadline that arrived while another request was decoding was refused (decode_rate_unavailable, then deadline_unreachable). Until that first sample, an uncalibrated policy now takes the slowest delivered cadence among the requests decoding on the slot: tokens after the first emission over the time since the first token, once a request has 8 such tokens. It is charged per row, which overcharges a batch. The engine's projection decides as before, so a cadence that predicts a miss still refuses; with no such request the decode rate stays unavailable. Only deadline admission reads it. The heartbeat's observed_decode_tps and performance_measurements are unchanged, and a calibrated policy is unchanged.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
1 task done
With DARKBLOOM_TTFT_ADMISSION_FIXES=0 a slot without a decode sample builds exactly the previous policy (no decode rate, no step shape), so a deadline request beside a decoding row is refused with decode_rate_unavailable as before. New test: the fixes off on a new slot with a decoding row.
Conflict in docs/developer/serving-performance-qualification.md only: both paragraphs kept (the heartbeat rate's age, then the new slot's decode rate).
jonathan308
changed the base branch from
dev
to
feat/decode-rate-age-on-heartbeat
November 24, 2026 16:01
…st has Short replies kept a short-only slot's deadline decode rate at its first reply: they refreshed the decode evidence, so it never expired, and never moved it. The rate now remembers whether a counted sample (32 tokens or more, or calibration) has moved it since it last restarted (decodeEwmaCounted, reset with ewmaInitialized on calibration or expiry). Until one has, every reply moves it exactly as before; from then on only counted samples do. Tests: a short-only slot's rate follows its short replies (as on the base); firstShortReplyStartsTheDeadlineRate now expects a short reply after a counted one to leave the rate, not after a short one, which encoded the freeze; EngineMeasurementOrderingTests is back to the base's text (two short replies blend as before).
3 tasks
Collaborator
Author
|
Closing: this branch's head (ab34fd0) is already contained in dev. |
This branch was successfully deployed
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.
Summary
Two changes to the decode rate that first-content deadline admission uses. Nothing a heartbeat carries changes.
decode_rate_unavailable), thendeadline_unreachable. Until the first sample, an uncalibrated policy now takes the slowest delivered cadence among the requests decoding on the slot (EngineV2Bridge.liveDecodeCadence): tokens after the first emission over the time since the first token, once a request has 8 such tokens. It is charged per row (no step shape), which overcharges a batch. The engine's projection decides as before, so a cadence that predicts a miss still refuses. With no request past 8 tokens, the decode rate stays unavailable. A calibrated policy is unchanged, and so is any policy withDARKBLOOM_TTFT_ADMISSION_FIXES=0(no decode rate, no step shape, as on the base).decodeEwmaCountedrecords whether a counted sample (32 tokens or more, or calibration) has movedobservedDecodeTpsEwmasince it last restarted. It resets withewmaInitialized, on calibration or when the decode evidence expired. Until a counted sample arrives, every completed request moves the rate exactly as on the base, with the same alpha and restart rule, so a short-only slot's rate follows its replies. After that, a reply shorter than 32 tokens moves neither the rate nor the measured decode step. This rule isn't underDARKBLOOM_TTFT_ADMISSION_FIXES; it applies with the fixes on or off.ecb2aa1867ab34fd0b08); tests; docs and changelogc010cabea832056d64c6DARKBLOOM_TTFT_ADMISSION_FIXES); with them off the policy is exactly the base's; test14a5cf93264fd38a1a64(this PR's base). Its only conflict was indocs/developer/serving-performance-qualification.md, and both paragraphs are keptab34fd0b08The heartbeat and
performance_measurementsstay byte-identicalThis PR is based on #2672, and the comparison is against that base. Line numbers are at this head;
EngineV2Bridge+RateObservations.swiftmoved by 3 lines inab34fd0b08.observed_decode_tpscomes only frompublishedDecodeTps, throughDecodeRateIdleAge.published(EngineV2Bridge+Capacity.swift:225-228), with the age taken fromperformanceMeasurements.observationAge("decode"). feat(provider): the heartbeat sends the published decode rate's own age #2672'sobserved_decode_tps_age_ms(:238-239) reads that value andpublishedDecodeAt, which this PR doesn't touch.publishedDecodeTpsis written only inupdatePublishedDecodeTps(EngineV2Bridge+Accounting.swift:207-221). Its only caller (EngineV2Bridge+RateObservations.swift:72-74) keeps the same condition,calibration || value.setsPublishedDecode.performance_measurementsis fed byperformanceMeasurements.observe(EngineV2Bridge+RateObservations.swift:79, unconditional for every sample as before) andEngineV2Bridge+Measurements.swift:55,186,191. None of these changed.observedDecodeTpsEwma,observedDecodeStepanddecodeEwmaCountedare read only by admission (decodeEwmaCountedonly by the update rule itself); the first two are read only atEngineV2Bridge+Admission.swift:123-127.liveDecodeCadence(EngineV2Bridge+Admission.swift:149) readsactiveand is called only at:128, only with the fixes on. The wireewma_initializedis the prefill flag (EngineV2Bridge+Capacity.swift:191,isolatedPrefillEwmaInitialized), not this one.So the published rate, its idle age and
performance_missingon the coordinator are unchanged in every state. The visible effect is fewerdeadline_unreachablerefusals on a new slot. A request's own profile reports the decode rate that priced its decision, as before.Linked issue
None. These are follow-ups to #2626/#2627 (not merged) and #2628.
Test plan
951bceb261): the new and updated tests on the same base (feat(provider): the heartbeat sends the published decode rate's own age #26724fd38a1a64), without the change. It must fail at exactly these 4 tests:NewSlotDecodeCadenceAdmissionTests.admitsAtLiveCadence,NewSlotDecodeCadenceAdmissionTests.refusesWhenCadencePredictsMiss,DecodeRateSampleLengthTests.shortRequestMovesNeitherRate,DecodeRateSampleLengthTests.firstShortReplyStartsTheDeadlineRate. Guard tests that pass there:noRowPastMinimumStaysUnavailable,fixesOffStaysUnavailable,shortReplyRestartsAnExpiredDeadlineRate,shortOnlySlotDeadlineRateFollowsShortReplies. (EngineMeasurementOrderingTestsis back to the base's text and is no longer in the set.)NewSlotDecodeCadenceAdmissionTests. A realEngineV2has one row frozen mid-decode (suspendStepExecutionAtCountForTesting), so the new prompt's steps carry decode work. The bridge has no decode sample:admitsAtLiveCadence: a decoding row at 20 tok/s; the policy's rate is that cadence with no step shape, and the engine admits with decode work in the projection;refusesWhenCadencePredictsMiss: rows at 100 and 1 tok/s; the slower one prices admission, and the engine refusesdeadline_unreachablefrom a bounded projection longer than the 1 s budget;noRowPastMinimumStaysUnavailable: a row with 7 tokens after its first; the decode rate stays nil and the engine refuses withdecode_rate_unavailable, as before;fixesOffStaysUnavailable: with the admission fixes off, a row at 20 tok/s gives no decode rate and no shape, and the engine refuses withdecode_rate_unavailable, as before.DecodeRateSampleLengthTests:shortRequestMovesNeitherRate(wasshortRequestMovesOnlyTheDeadlineRate): after a counted 101-token request, an 11-token one moves neither rate; the age still refreshes;shortOnlySlotDeadlineRateFollowsShortReplies(guard): 11-, 5- and 3-token replies give 100, then 0.3·40 + 0.7·100, then 0.3·20 + 0.7·that, as on the base;firstShortReplyStartsTheDeadlineRate: a short reply starts the rate, a counted 33-token one moves it, and a short one after that leaves it. Its old expectation (a short after a short leaves the rate) froze a short-only slot's rate at its first reply; that sequence now behaves as on the base;shortReplyRestartsAnExpiredDeadlineRate(guard): after the evidence expired, a short reply starts the rate again.EngineV2PrefillSamplingTests.shortOnlySlotAdmitsBesideDecodingRowstill passes: a short-only slot prices a deadline request beside a decoding row from its measured rate.python3 scripts/changelog.py check,python3 scripts/docs-impact-check.py --base origin/devComponents touched
Protocol / interface changes
Documentation impact
docs/architecture/inference.mddeadlines,docs/developer/serving-performance-qualification.md)Changelog
changelog.d/deadline-decode-rate-min-tokens.mdandchangelog.d/new-slot-deadline-decode-cadence.md. Corrected one sentence ofchangelog.d/published-decode-rate-min-tokens.md(Move the published decode rate only on requests of 32 or more tokens #2628, unreleased) that said short requests still feed the deadline rate.Notes for reviewers
observed_decode_tpsflap after Stop advertising a stale decode rate from an idle slot #2569 isn't addressed here. Any provider-only change would either publish 0 more often or keep a stale rate. It needs the coordinator to decay a stale published rate.Before And After
flowchart TD subgraph Before A1[deadline request, another row decoding] --> B1{decode EWMA?} B1 -->|none: new slot| C1[decode_rate_unavailable -> deadline_unreachable] B1 -->|yes| D1[projection priced] S1[short reply after the first] --> E1[moves deadline EWMA] end subgraph After A2[deadline request, another row decoding] --> B2{decode EWMA?} B2 -->|none| L2{a row has >=8 tokens after its first?} L2 -->|yes| D2[projection priced at the slowest live cadence, per row] L2 -->|no| C2[decode_rate_unavailable -> deadline_unreachable] B2 -->|yes| D3[projection priced] S2[short reply after the first] --> E2[deadline EWMA unchanged] endRefactor Pass
There was no separate refactor pass.
decodeChargegains one optional input and returns the same results whenever it is nil.