Skip to content

feat(provider): the heartbeat sends the published decode rate's own age - #2672

Merged
jonathan308 merged 2 commits into
devfrom
feat/decode-rate-age-on-heartbeat
Nov 24, 2026
Merged

jonathan308 merged 2 commits into
devfrom
feat/decode-rate-age-on-heartbeat

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This is the provider half of the decode-rate age. Each slot's heartbeat now carries observed_decode_tps_age_ms: the whole milliseconds since publishedDecodeAt, the newest sample that moved the published rate (a reply of at least 32 tokens, or a calibration cell). A short reply doesn't reset it. It's sent only with a published rate (encodeIfPresent, nil otherwise).

Nothing else changes: the published rate, the idle-age rule (DecodeRateIdleAge.published) and every provider decision are as before. The coordinator's ranking therefore can't change until its half lands.

The platform's coordinator ignores the field today: it decodes the heartbeat with plain json.Unmarshal (coordinator/protocol/messages.go:1366-1371), with no DisallowUnknownFields. Neither BackendSlotCapacity nor HeartbeatMessage has a custom UnmarshalJSON (the protocol package's only ones are for App Attest messages and the ProviderMessage envelope, messages.go:1300). Unknown keys are therefore dropped.

Capacity events don't fire more often: CapacityEventHeartbeats compares slots field by field and doesn't read this one, so a changing age triggers no extra heartbeat.

Coordinator half (design, for its release): read the field, and decay a stale published rate toward the fleet median by the forecast.ExploredRate rule instead of the provider dropping it to 0. Its five steps are wire, snapshot, decay, forecast evidence, and rollout with tests; the full note is below.

Commit What it does
8f9ac92b52 The field, its encoding and decoding, the heartbeat value (DecodeRateIdleAge.publishedAgeMilliseconds) and the tests
4fd38a1a64 Docs (protocol-messages.md row, inference.md, serving-performance-qualification.md) and the changelog fragment

Linked issue

None. Follows #2628 (N1).

Test plan

  • Red control: Red control for #2672: tests without the change (do not merge) #2671 (draft, head ada4fd2317): the new tests on the base, with the property declared but never set or encoded. It must fail at exactly publishedRateCarriesItsAge and ageWireShape.
  • CI (dev) on the exact head.
  • New tests (DecodeRateIdleAgeTests):
    • publishedRateCarriesItsAge: no age without a rate; 60,000 ms after a qualifying sample; still the qualifying sample's age (160,500 ms) after a short reply, with the rate unchanged; no age once the idle rule drops the rate.
    • ageWireShape: the key is absent when nil, present when set, and decodes back.
  • python3 scripts/changelog.py check, python3 scripts/docs-impact-check.py --base origin/dev

Components touched

  • provider-swift (Swift CLI)
  • docs

Protocol / interface changes

  • Yes. There's one new optional heartbeat field, observed_decode_tps_age_ms (an int64 in milliseconds, omitted when there's no published rate). The coordinator ignores it until its half lands. The console's TypeScript telemetry mirror needs the same optional field when the platform adds it.

Documentation impact

  • Canonical documentation updated

Changelog

  • Added changelog.d/decode-rate-age-on-heartbeat.md.

Notes for reviewers

There was no local build because the Macs are booked.

Coordinator half (design)

The provider half (d-inference PR "the heartbeat sends the published decode rate's own age") adds an optional
observed_decode_tps_age_ms to each slot. It's the milliseconds since the newest sample that moved observed_decode_tps, and replies under 32 tokens don't reset it. The coordinator ignores the field today: heartbeats are decoded with plain json.Unmarshal (coordinator/protocol/messages.go:1366-1371), there's no DisallowUnknownFields, and the slot types have no custom UnmarshalJSON.

  1. Wire: add ObservedDecodeTPSAgeMS *int64 \json:"observed_decode_tps_age_ms,omitempty"`toprotocol.BackendSlotCapacity(messages.go ~510). nil means an older provider, so behaviour stays as today. Clamp it incapacityvalue.normalize` (non-negative, at most a day).
  2. Snapshot: routing_snapshot.go:75 copies it beside observedDecodeTPS (and so does candidate_snapshot.go).
  3. Decay: in performance.Rates (rates.go), take the slot's own rate through forecast.ExploredRate's rule when the age is known:
    • at or under EvidenceExplorationAfter, the own rate as is;
    • past it, interpolate per-token time from the own rate to the fleet median, reaching the median at IdleMeasurementMaxAge, in whole minutes, so a reservation's quote and its commit read the same price;
    • with no median, keep the own rate.
      This replaces the provider's idle zeroing as the defence against a stale stacked rate.
  4. Forecast evidence: first_content_evidence.go:22 passes the decayed rate. A slot serving only short replies stays "known" (no performance_missing, forecast.go:223-225) at a rate that drifts toward the median instead of being dropped. A slot that is both busy and stale is priced near the median, not at its old rate.
  5. Rollout: coordinator first (the field is optional both ways). Once it's live, the provider can default DARKBLOOM_DECODE_RATE_IDLE_MAX_AGE_SECONDS to off, so the rate isn't zeroed; that's a separate provider PR. Tests:
    • fresh, stale and very stale ages against the median;
    • no median;
    • nil age (an old provider) leaves pricing unchanged;
    • the quote and the commit read the same price within a minute.

Before And After

flowchart LR
  subgraph Before
    S1[slot capacity] --> H1["observed_decode_tps"]
  end
  subgraph After
    S2[slot capacity] --> H2["observed_decode_tps (unchanged)"]
    S2 --> A2["observed_decode_tps_age_ms = now - publishedDecodeAt"]
    A2 -.ignored until the coordinator's half.-> C2[coordinator]
  end
Loading

Refactor Pass

Refactor pass: done; no behaviour-preserving changes warranted.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Each slot's capacity now carries observed_decode_tps_age_ms: whole milliseconds since publishedDecodeAt, the newest sample that moved the published rate (a reply of at least 32 tokens, or a calibration cell), so a short reply doesn't reset it. It is sent only with a published rate (encodeIfPresent; nil otherwise). The rate, the idle-age rule and every provider decision are unchanged; the coordinator's json.Unmarshal of the heartbeat (protocol/messages.go:1366-1371, no DisallowUnknownFields, no custom UnmarshalJSON for the slot) ignores the field until it reads it. Capacity events compare slots field by field, so the changing age triggers none.
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Nov 24, 2026 3:30pm UTC
darkbloom-status Ready Ready Preview Nov 24, 2026 3:30pm UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 24, 2026 3:30pm UTC

Request Review

@jonathan308 jonathan308 added the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 24, 2026
@github-actions github-actions Bot removed the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 24, 2026
@jonathan308 jonathan308 added the run-release-ci One-shot: run SDK 27 release and qualification on this PR (removed when the run starts) label Nov 24, 2026
@github-actions github-actions Bot removed the run-release-ci One-shot: run SDK 27 release and qualification on this PR (removed when the run starts) label Nov 24, 2026
@jonathan308 jonathan308 added the run-release-ci One-shot: run SDK 27 release and qualification on this PR (removed when the run starts) label Nov 24, 2026
@github-actions github-actions Bot removed the run-release-ci One-shot: run SDK 27 release and qualification on this PR (removed when the run starts) label Nov 24, 2026
jonathan308 added a commit that referenced this pull request Nov 24, 2026
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
jonathan308 merged commit 1971c46 into dev Nov 24, 2026
41 of 43 checks passed

This branch was successfully deployed

3 active deployments
Preview – eigen-homepages-darkbloom — 4fd38a1a Deployed Nov 24, 2026 by vercel[bot]
Preview – d-inference-landing — 4fd38a1a Deployed Nov 24, 2026 by vercel[bot]
Preview – darkbloom-status — 4fd38a1a Deployed Nov 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant