Skip to content

[Docs] The ~165 ms is the expert-slot refill: 0.319 ms per lent slot, on the TTFT path - #19

Merged
rwkeyes merged 1 commit into
dirigo/0.2.12-verifiedfrom
docs/trace-refill
Nov 14, 2026
Merged

rwkeyes merged 1 commit into
dirigo/0.2.12-verifiedfrom
docs/trace-refill

Conversation

@rwkeyes

@rwkeyes rwkeyes commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Problem and result

Section 6 left ~165 ms of per-request fixed cost unnamed and said naming it needed a phase timer and a build. It did
not: engine 0.1.59 already prints the prompt path when STRATA_TRACE is set, and it names the missing phase.

real tokens read refill lent slots refill per slot
127 252 ms 71.7 ms 225 0.319
457 432 ms 82.6 ms 259 0.319
1,609 1,245 ms 188.2 ms 589 0.320

The expert-slot refill runs after the prompt read and before prompt done, so the first token waits for it — 72 ms
on a short prompt, 188 ms at 1.6 k — at a constant 0.319 ms per lent expert slot. The read itself carries 109 ms of
fixed work (109 ms + 0.706 ms/token). 109 + 72 + 56 ms of cache bookkeeping is the 165 ms.

That also reconciles §6 with the dispatch: pinning the cache on raises TTFT by 148–234 ms but raises read + refill by
only 7–29 ms, so the cache-on cost is checkpoint work inside the engine's prompt span, not in the read.

The lever: the refill does not have to be synchronous — it reclaims slots the next request lends again, and decode
needs its own experts. Moving it after the first token is 72–188 ms off TTFT for a few lines of engine change. It is now
item 1 of §4.

Related discussion

Approach

  1. Ran the ladder at 75 / 512 / 2,048 target tokens with STRATA_TRACE=1, six samples per size, and parsed the prompt
    path per request (strata-trace-split.py pairs each trace block with its prompt line).
  2. Repeated the same window with conv_route: shadow to separate the cache-on cost from the read, which is how the
    §6 discrepancy was found rather than smoothed over.
  3. Recorded the attempt on a second weight set (Q2_0) and its three refusals instead of dropping it.
  4. The page gains §9 (the table, four findings, the lever, and the blocked cross-weight check); §6's item 6 now points
    at it; the ranked list gains the refill as item 1 and closes the phase-timer item as "done, no build".

Validation

Passed:

  • 0.319 ms/slot at three sizes — 0.3187, 0.3189, 0.3196 — a rate that stable is a transfer, not noise, and it makes
    the mechanism checkable by anyone with the logs.
  • The refill's position is read from the trace order, not inferred: read … 1246.9 ms → refilled 589 slots … 188.0 ms → prompt done, with the ladder's TTFT (1,463 ms at 1,610 tokens) matching read + refill + ~21 ms of server.
  • The shadow arm reproduces the §6 gap in the right place: TTFT +148/+207/+234 ms against read+refill +7/+9/+29 ms.
  • Every window restored production: :8095 http=200, engine 0.1.58, after each of the three runs.
  • Artifacts complete: both engine logs with all trace lines, both ladders, the parser, the driver, and four Q2_0
    failure logs.

Failed:

  • STRATA_TRACE prints no admission trace at --batch 0 (that block is batch-only), so the first attempt looked
    like the env had not reached the engine. The prompt path is what the question needed; the caveat is in §9.
  • The Q2_0 cross-weight arm could not start — three refusals in sequence, each fixed before the next appeared:
    duplicate split shard number (PLE shard doubled as the sibling), then is a native (IQ) pack: it needs --native,
    then REFUSED: 11158 experts are neither in VRAM nor mirrored. Root cause of the last one: the Q2_0 pack declares
    48×512 experts where the shipped profile is 48×256, so it needs its own calibration.

Not run:

  • No engine change: deferring the refill is proposed, not implemented or measured.
  • No cross-weight confirmation, so every number here stands on one weight set (IQ1_M) — stated in §10.

Limits

  • The unaccounted 56 ms is prompt-span minus read minus refill, which is subtraction, not an instrumented phase; it
    could hold more than one thing.
  • One card, one model, one run per arm; the per-slot rate is measured at three prompt sizes, not across contexts.

… on the TTFT path

No build was needed: engine 0.1.59 already prints the prompt path under
STRATA_TRACE. Per request it shows prompt start, lent N slots, read N
tokens in X ms, refill, prompt done - and the refill is the answer.

  tokens   read      refill    lent slots   refill per slot
  127      252 ms    71.7 ms   225          0.319
  457      432 ms    82.6 ms   259          0.319
  1609    1245 ms   188.2 ms   589          0.320

- the refill runs AFTER the read and BEFORE "prompt done", so the first
  token waits for it: 72 ms short prompt, 188 ms at 1.6k;
- it is one PCIe transfer per lent expert slot at 0.319 ms/slot, the same
  rate at all three sizes to within 0.3 %;
- the read itself carries 109 ms of fixed work (109 + 0.706 ms/token);
- 109 + 72 + 56 of cache bookkeeping accounts for the 165 ms section 6
  could not name, so nothing is unexplained at this resolution.

It also reconciles section 6 with the dispatch: pinning the cache on
(conv_route shadow) raises TTFT 148-234 ms but read+refill only 7-29 ms,
so the cache-on cost is checkpoint work inside the prompt span, not in
the read. Both measurements were right about different parts of it.

The lever: the refill does not have to be synchronous. It reclaims slots
the NEXT request lends again, and decode needs its own experts - moving it
after the first token takes 72-188 ms off TTFT for a few lines of engine
change. That is now item 1.

Also records the blocked cross-weight check: the Q2_0 pack (34 GB, copied
to NVMe for this) cannot start - duplicate split shard, then "native (IQ)
pack needs --native", then "11158 experts neither in VRAM nor mirrored",
because its 48x512 expert shape needs its own profile where the shipped one
is 48x256. Three failure logs shipped as evidence.
@rwkeyes
rwkeyes merged commit 8c5407f into dirigo/0.2.12-verified Nov 14, 2026
3 checks passed
@rwkeyes
rwkeyes deleted the docs/trace-refill branch November 14, 2026 23:20
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