DEV Community

Shivam Dwivedi
Shivam Dwivedi

Posted on Fully Autonomous

Speculative decoding changes how many experts touch memory

Eight positions using eight experts each do not necessarily touch 64 different experts. They can reuse some. They can also spread much farther across memory than a single position does.

That distinction helps explain a detail in Hugging Face's new Inkling 2 Mini inference-tuning report. Its authors report a faster speculative configuration, then revise the memory estimate to account for the union of routed experts across verification positions. The accompanying theory notes explicitly correct an earlier interpretation of the bottleneck. [1, 2]

I like that correction because it exposes the assumption behind the ceiling. A token-rate headline alone hides it.

Count the experts that stay untouched

Consider a deliberately simplified scenario: an expert pool has E members. Each position selects s distinct experts uniformly, and selections at different positions are independent. A verification group has p positions.

For one particular expert, the chance of being skipped by one position is 1 - s/E. The chance that every position skips it is (1 - s/E)^p.

Subtract from one to get the chance it is touched. Add that probability across the pool:

expected distinct experts = E × (1 - (1 - s/E)^p)

This uses linearity of expectation. Expert selections within a position can be dependent; the independence assumption is across positions for a particular expert. No independence between different experts is needed to add their indicator expectations.

An expert-pool illustration contrasts eight reused experts, an independent-routing expectation of 51.62 experts, and 64 disjoint experts, all within a pool of 128.

Original computed illustration. The middle value is an expectation under uniform, independent routing; the outer cases are constructed limits for this group.

Check the formula with exact arithmetic

For the illustrative values E=128, s=8 and p=8, the expected union is 51.62 experts, or 40.33% of the pool. Summing the positions gives 64 selections, but counts repeated experts more than once.

Here is a standard-library Python check. Save it as expert_union.py and run python3 expert_union.py.

from fractions import Fraction
from itertools import combinations, product
experts, selected, positions = 128, 8, 8
untouched = Fraction(experts - selected, experts) ** positions
expected = experts * (1 - untouched)
print("expected experts", f"{float(expected):.2f}")
print("fraction of pool", f"{float(expected / experts):.2%}")
print("naive position sum", selected * positions)
choices = list(combinations(range(4), 2))
sizes = [len(set().union(*draws)) for draws in product(choices, repeat=3)]
enumerated = Fraction(sum(sizes), len(sizes))
formula = 4 * (1 - Fraction(2, 4) ** 3)
assert enumerated == formula == Fraction(7, 2)
print("tiny exact check", len(sizes), float(enumerated))
Enter fullscreen mode Exit fullscreen mode

Output:

expected experts 51.62
fraction of pool 40.33%
naive position sum 64
tiny exact check 216 3.5
Enter fullscreen mode Exit fullscreen mode

The small check exhaustively enumerates the six ways to choose two experts from four, across three positions. All 216 combinations are equally likely under the stated model. Their average union size, 3.5, agrees exactly with the formula. This checks the derivation without sampling noise. ✅

A larger union can still be a faster step

The memory work of verification and the number of output tokens advanced are different quantities. A useful sketch is:

bandwidth ceiling ≈ bytes per second × expected tokens advanced per step / bytes read per step

Speculation can increase both the numerator and denominator. Counting only accepted tokens makes the step look cheaper than it is; counting only the larger expert union makes speculation look pointless. The ratio matters.

The illustration also gives useful counterexamples. If every position selects the same eight experts, the union is eight. If their selections are disjoint, it is 64. Real routing correlations can move the result away from the independent expectation. Equal expert counts also need not mean equal bytes, and cache reuse can change actual traffic.

The tuning report's hardware measurements and acceptance behavior belong to its authors. I have checked the probability calculation here, not run Inkling, vLLM, SGLang or a GPU benchmark. Turning this estimate into a throughput prediction requires measured routing, bytes, acceptance and timing for the actual setup.

The practical reading habit is simple: when a report changes from plain decoding to verification groups, check whether its memory model changed with it.

References

  1. Niels Rogge — Hill-climbing Inkling 2 Mini inference on one RTX PRO 6000
  2. Inkling tuning investigation — theory notes and correction
  3. Python — itertools combinations and product

Asset credits

Original expert-pool illustration, released under CC BY 4.0. Credit: Shivam Dwivedi.

AI disclosure

AI was used to draft the article.

Top comments (0)