Inference Optimization

How far can a $2,000 homelab rig get toward frontier inference?

And what actually blocks the rest. A measurement study on consumer hardware, with the method published alongside the result.

every claim carries a provenance mark  ·  [M] measured   [D] derived   [S] sourced   [T] theory   [F] framework

A 125-billion-parameter model runs at 77 tokens/second for $3,250. That is faster than the same model on the card the engine's own documentation benchmarks it against, and flat across every context depth tested. Frontier inference is still out of reach, and this paper says why in arithmetic rather than in adjectives.

Evidence marks: [M] measured here · [D] derived from measurement · [S] sourced · [T] theory. Full data, harnesses and failures are published alongside this summary.


The answer

Throughput is bandwidth divided by the bytes moved, times the tokens produced per pass:

tok/s  =  (bandwidth ÷ bytes-per-token)  ×  tokens-per-pass

Measured residual: 1.0000× across three queue depths [M]. Not a fitted curve — the bound. Every optimisation below is one of those three terms.

configurationmodeldecodecontext behaviour
3 cards, VRAM-residentdense 27B47.6 tok/s [M]flat 2 K → 128 K
1 card, VRAM-residentdense 27B15.7 → 4.3 [M]−72 %
32 GB, expert file tierMoE 125B23.8–39.8 [M]dies after 2–4 requests
128 GB, residentMoE 125B70.3–80.9 [M]flat 2 K → 128 K

$3,250 delivers 125B-class inference at 1.6× the decode of a dense 27B on the same hardware — while running a model 4.6× larger.


Where the wall is

Not PCIe width. The ×8 Gen4 link was worth 8 % on prefill and 2 % on decode against a ×1 Gen3 link [M]. A bandwidth-starved rig would have shown far more.

Not card count — card sequentiality. Three cards in a layer split deliver roughly one card's bandwidth, because layer N+1 cannot start before layer N finishes. The engine reports it directly: graph splits = N+1.

Three cards against one, VRAM-resident:

context3 cards1 cardratio
2,04847.57 [M]15.723.03×
16,38447.32 [M]9.924.77×
131,07247.41 [M]4.3410.92×

Adding cards did not raise the ceiling; it delayed the fall. That is a capacity wall, not a bandwidth wall — which is why the fix was memory, not another GPU.

Frontier models remain impossible, and the arithmetic is short: a 400B dense model at 4-bit needs ~200 GB; a frontier dense model ~700 GB–1 TB. This rig has 48 GB of VRAM and 128 GB of RAM, on PCIe with no P2P. No tuning addresses that.


The measurements

The file tier was the floor

At 32 GB the engine cannot hold the experts, so it reads them from NVMe every token: 1,145 MB per request, 2,492 major faults, 13.3 % of expert traffic from storage [M]. Decode 23.8–39.8 tok/s, and the engine died after two to four requests.

The second tier removed it

At 128 GB, with --resident-experts, the engine page-locks the experts in RAM. In its own words [M]:

resident RAM mode: 28.61 GiB of experts in RAM (page-locked) ... (no file reads)
expert tiers:      RAM blobs; files 0 blobs

files 0 blobs. The storage path is gone.

Decode is flat in depth once resident
Decode is flat in depth once resident
depthpromptprefill ratedecodecache
2 K1,286582 tok/s80.8693.0 %
16 K9,7861,223 tok/s78.4692.4 %
64 K38,9241,515 tok/s70.3593.5 %
128 K77,7862,473 tok/s78.9193.6 %

Mean 77.1 tok/s; 10 of 10 sequential requests succeeded.

Two things were not predicted. Prefill rate rises with depth — short prompts are dominated by fixed per-request overhead, long ones amortise it. And decode is flat across a 60× range of prompt depth, where the file-tier configuration collapsed. A single depth would have reported whichever effect dominated that prompt, which is the argument for measuring a curve rather than a point.

Against other people's numbers

Comparison against vendor and community figures
Comparison against vendor and community figures
sourceconfigurationshort chat128 Kprefill
vendor [S]RTX 5070 12 GB, 64 GB RAM79 tok/s63 tok/s2,090 tok/s
this rig [M]one 5060 Ti, 128 GB resident80.978.9582–2,473
community [S]one card, layer split19.6——
this rig [M]one card, 32 GB file tier23.8–39.8——

At short context this rig matches the vendor's card. At 128 K it is 25 % ahead — because depth costs almost nothing once the experts are resident, which is exactly what the second tier bought.

The community one-card figure lands inside this rig's file-tier band. Same configuration, same task, different storage — and the agreement is the strongest independent check here.

The honest caveat: conditions differ between every row. This compares configurations a person could own, not silicon on equal footing.


What it cost

the rig as measured$2,0003 × RTX 5060 Ti 16 GB, Ryzen 5 5500, 32 GB DDR4
+ the upgrade+$1,250128 GB DDR4-3600 + Ryzen 9 5900XT
total$3,250

The $1,250 changed three things at once — RAM, CPU, and an unplanned PCIe Gen3→Gen4 link from the CPU swap. So "it bought 1.8×–3.4×" is a combined claim; separating them would need a controlled build, which has not been done.

The gain was predicted before the hardware arrived. At 32 GB, 13.3 % of expert traffic came from storage. Only that fraction can be removed by RAM, which bounded the gain at 1.0×–2.9× [D] — predicting 40–90 tok/s. The measurement was 70.3–80.9. Stating the projection in advance is why it can be checked.

One lever is free and easy to overstate: XMP took memory from 2133 to 3200 MT/s for +50 % where the working set did not fit in VRAM — and for +0.4 %, inside the noise, once the model was resident [M]. Both measurements are here because publishing only the first would imply a lever that does not exist.


What is not established


Two directions forward

Neither is a recommendation, and neither is dismissed.

Finish the levers already evidenced. Every lever above has a measured effect on a real configuration; the work is execution. For: measured effects, known costs, low risk. Against: the largest remaining lever is capacity, and capacity is the expensive one — this improves a working configuration without changing what is possible.

Abandoned software on discarded hardware. Professional accelerators are discarded while functional, and the software that would use them well is often unmaintained. For: the hardware is cheap, and the bandwidth-per-dollar metric that disfavours it is specifically a decode metric — the workload consumer cards already win. Against: that disfavour is measured, not assumed, and it constrains which workload to attempt.

The criterion: a direction is worth pursuing when its claim can be made false by one measurement. Both pass. Neither has been attempted.


Method, and why it is in the summary

This project produced measurements that were wrong in ways that looked plausible, and the three that shaped the method are worth naming:

The rules that came out of it: one variable per arm · state the denominator · separate cold from warm · trust the engine's own telemetry over your theory · record the binary's version, not the one you meant to install · publish the failures.

The full paper — methods, bug catalogue, retractions, artifacts, reproducible harnesses — is published alongside this summary, with every figure traceable to the named script that produced it.