Skip to content

Experiment: add offline residency simulator - #902

Merged
JustVugg merged 1 commit into
JustVugg:devfrom
terrizoaguimor:pr/cnre-simulator-clean
Aug 10, 2026
Merged

Experiment: add offline residency simulator#902
JustVugg merged 1 commit into
JustVugg:devfrom
terrizoaguimor:pr/cnre-simulator-clean

Conversation

@terrizoaguimor

Copy link
Copy Markdown
Contributor

Summary

This is the self-contained Phase 0 offline residency experiment requested in PR #893 review. It adds no runtime behavior, backend changes, routing changes, or prefetch.

It provides a reproducible simulator for the question raised by #884: under a fixed expert-residency byte budget, can admission/frequency policies reduce predicted critical-path felt wait without overfitting?

Included

  • Strict GLM ROUTE_TRACE parsing and contiguous call/batch validation.
  • First-seen batch unions plus per-row selection multiplicity.
  • GLM 64-expert working-set block replay.
  • LRU, LFU, synthetic pinned-LRU, SLRU, and frequency-admission policies.
  • Uniform and policy-specific dynamic layer capacity allocation.
  • Separate resident bytes, read bytes, and felt miss costs.
  • Category-held-out decision gate: at least 10% mean improvement and no category worse than 3%.
  • Layer-specific felt-cost sensitivity and aggregate PROF=1 calibration parsing.
  • Complete JSON output with trace sources, specs, allocations, gates, and sensitivity.
  • Deterministic synthetic fixtures demonstrating both locality wins and overfit regressions.
  • 29 focused tests.

Real-trace context

The H200 pilot used 13 GLM-5.2 traces collected before this split: 8 training and 5 held-out across coding, chat, reasoning, multilingual, and long-context prompts. The offline results were:

Expert budget Candidate Mean held-out gain Worst category
120 GB Uniform frequency +39.91% +34.84%
120 GB Dynamic frequency +40.45% +35.41%
160 GB Uniform frequency +53.35% +49.92%
160 GB Dynamic frequency +54.50% +50.66%
200 GB Uniform frequency +65.31% +62.64%
200 GB Dynamic frequency +66.29% +63.07%

These are simulator predictions, not runtime speedup claims. The pilot also showed that hit rate alone is insufficient: RAM_GB=120, PIPE=0 measured 1.66 tok/s at 57.2% hit, while RAM_GB=120, PIPE=1 measured 2.00 tok/s at the same hit rate.

Related issue

This is the simulator half of #893 and supports #884. It is intentionally independent of the placement/backend issues in #887, #892, #813, #585, #759, #766, #767, #687, #856, #885, #848, #662, and #783.

Verification

  • Full Python suite on the source branch: 407 passed, 57 skipped.
  • Focused simulator tests: 29 passed.
  • No C runtime files are changed by this PR.

The next step is a separate runtime policy PR only after maintainers accept the methodology and held-out gate.

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.

2 participants