LOADOUT
Will this model fit? A fully client-side VRAM planner for local LLMs.
Drop in a .gguf file — or paste a Hugging Face link — and watch weights, KV cache, and compute buffers pack into your GPUs like cargo into a hold. Before you download 40 GB, know whether it fits, at what context length, and what to change if it doesn't.

▶ Live demo
Why
Every local-LLM forum thread starts the same way: "Can I run the 70B on a 4090?" The answer is always "it depends" — on quant, context length, KV cache type, flash attention, and how many layers you offload. Loadout turns "it depends" into a picture. It reads the actual tensor table from the GGUF header and models llama.cpp's allocation behavior, so the answer is specific to your file and your hardware.
Features
- Local file or Hugging Face URL. Local files are parsed from a growing prefix slice — a 40 GB file is never fully read. HF links are fetched with HTTP
Range requests (16 MiB first, growing to a 512 MiB cap): header bytes only, never weights.
- Real tensor-table math. Weight sizes come from each tensor's dimensions and its quant's true block geometry (
Q4_K = 144 bytes per 256 elements, etc.), not from a bits-per-weight rule of thumb.
- Full runtime model. KV cache (exact formula), compute buffer (estimated), CUDA context, OS VRAM reserve (Windows/WDDM vs. Linux), and multi-GPU split overhead.
- Multi-GPU layer split. Layers are assigned across GPUs proportional to usable VRAM, mirroring llama.cpp's default split; the token embedding table stays on CPU as llama.cpp does.
- Live packing visualization. A canvas "hardware bay" showing every allocation as a block, with a 4 GiB tick ruler per device, hover tooltips, and animated re-packing as you drag sliders. Overflow glows red.
- Fix suggestions. When a plan doesn't fit, Loadout binary-searches settings and offers one-click fixes in practicality order: shrink context → quantize KV cache → offload N layers to CPU → (informational) use a smaller quant.
- llama.cpp flags, generated. The summary panel emits the matching command line (
-ngl 32 -c 8192 -ub 512 --flash-attn -ctk q8_0 …) with a copy button.
- Calibration mode. Paste a real llama.cpp startup log and get a predicted-vs-actual table with per-device deltas.
- PNG export. One click renders the current packing diagram (plus model name and totals) to a shareable PNG.
Everything runs in your browser. No server, no telemetry, no uploads — a static site with zero runtime dependencies.
Quick start
npm install # dev deps only: typescript, vite, vitest
npm run dev # dev server at http://localhost:5173
Other scripts:
npm run build # static site → dist/
npm run preview # serve the built dist/
npm run typecheck # tsc --noEmit (strict, noUncheckedIndexedAccess)
npm test # vitest (54 tests)
Then either:
- Drop a
.gguf anywhere on the stage (or use LOCAL FILE), or
- Paste a Hugging Face URL — any
…/blob/main/model.gguf or …/resolve/main/model.gguf link (also hf.co) — and hit FETCH.
Set your GPUs (presets for common cards, or Custom), pick Windows or Linux, and drag the context slider. The bay re-packs live.
How the model works
The pipeline is: GGUF header → ParsedModel → AllocationPlan → canvas.
1. Weights — exact
The GGUF tensor table lists every tensor's name, dimensions, and ggml type. Loadout computes each tensor's bytes from its quant's block geometry:
bytes = ceil(elements / blockElems) × blockBytes
Tensors are grouped by layer (blk.17.* → layer 17) so each layer becomes one visual block sized by its true on-disk footprint. Mixed-quant models (e.g. Q4_K FFN + Q6_K output) are shown per-tensor-type, color-coded.
2. KV cache — exact
Per layer:
kv_layer = nCtx × nHeadKv × (headDimK × bytesPerElem(typeK) + headDimV × bytesPerElem(typeV))
bytesPerElem uses real cache-quant sizes (F16 = 2, Q8_0 = 34/32, Q4_0 = 18/32). GQA models (nHeadKv < nHead) are handled since the formula uses KV heads, not attention heads. Legal cache types are validated — llama.cpp only accepts F16/BF16/Q8_0/Q5_1/Q5_0/Q4_1/Q4_0.
3. Compute buffer — estimated (±15%)
llama.cpp sizes this from the actual computation graph at runtime; Loadout approximates it from activations (nEmbd × nUbatch), an attention scratch term when flash attention is off, and a fixed floor. MoE models get a visible warning — their compute graphs vary too much for the estimate to be trusted.
4. Overheads — calibrated defaults
All constants live in src/model/constants.ts, each tagged // CALIBRATE:
| Constant |
Default |
Meaning |
cudaContextBytesPerGpu |
500 MiB |
fixed CUDA context cost per GPU |
wddmUsableFraction |
0.93 |
usable share of VRAM on Windows (WDDM reserve) |
linuxUsableFraction |
0.98 |
usable share on Linux |
perExtraDeviceOverheadBytes |
100 MiB |
staging/comm buffers per extra split device |
computeNonOutputFraction |
0.6 |
compute-buffer share on non-output GPUs |
5. Placement
Layers are distributed across GPUs proportional to usable VRAM (after overheads), -ngl caps how many leave the CPU, and the token embedding table is always CPU-side — matching llama.cpp's default behavior. Whatever exceeds a device's capacity is drawn as overflow, and the suggestion engine kicks in.
How accurate is this?
Honest ledger:
- Weights — exact. Read tensor-by-tensor from the GGUF tensor table using real block geometry.
- KV cache — exact. Closed-form from model metadata and your settings.
- Compute buffer — estimated, ±15%. Graph-dependent; MoE models are flagged as less reliable.
- Overheads — calibrated defaults. Measured starting points, not physics. Driver versions and desktop compositors shift them.
Treat a plan that fits with < 500 MiB headroom as "maybe."
Calibration — help tighten the numbers
The estimated parts improve with real data. If you run llama.cpp:
- Copy the startup log (the lines like
CUDA0 model buffer size = 6942.00 MiB, plus KV and compute lines).
- In Loadout, open 05 CALIBRATE, paste, hit COMPARE.
- You get a per-device predicted-vs-actual table — green ≤ 3% off, yellow ≤ 10%, red beyond — and the log's own
n_ctx / n_ubatch / flash_attn so you can spot settings mismatches.
- Click Copy calibration JSON and open an issue with it, plus your GPU and OS.
Reports across different hardware are exactly what turns the // CALIBRATE defaults into measured values.
Project structure
src/
gguf/ binary format layer
reader.ts little-endian DataView reader; 64-bit ints as BigInt → toSafeNumber()
types.ts GGUF value types, TensorInfo, ParsedModel
quants.ts GgmlType enum, block geometry table, tensorBytes()
parser.ts GGUF v2/v3 header + metadata + tensor-table parser
hf.ts HF URL normalization + ranged prefix fetch (16 MiB → 512 MiB cap)
model/ allocation math (pure functions, all sizes in bytes)
constants.ts every tunable, // CALIBRATE tagged
kv.ts exact KV-cache formulas
compute.ts compute-buffer estimate
overheads.ts usable-VRAM model (WDDM/Linux, CUDA context)
split.ts proportional multi-GPU layer assignment
alloc.ts plan(): devices → segments (overhead/weights/kv/compute)
suggest.ts overflow fixes via binary search over settings
calib/ llama.cpp log parsing + predicted-vs-actual diff
ui/ no-framework UI: single mutable store w/ subscribe(), canvas view,
tooltip, controls, PNG export
test/ vitest suites + a synthetic GGUF fixture generator
Design rules the codebase holds itself to:
- Zero runtime dependencies —
"dependencies": {}; dev-deps are typescript, vite, vitest only.
- No
any — grep -rn ": any" src/ returns nothing; unknown data is unknown + narrowing.
- All 64-bit reads are BigInt, converted via a checked
toSafeNumber() — a corrupt header can't silently truncate.
- Every binary read is explicit little-endian DataView.
- Bytes everywhere — sizes flow as byte counts; MiB/GiB appear only at render time.
Testing
npm test
54 tests cover the binary reader (including truncation and malformed-magic cases), quant block math, the GGUF parser against generated fixtures, HF URL normalization, KV formulas vs. hand-computed values, layer splitting, the allocation planner, the suggestion engine (including "does the suggested fix actually fit?"), and log parsing/diffing. The fixture generator (test/fixtures/gen.ts) builds real GGUF binaries in memory, so the parser is tested against the format, not against mocks.
Not affiliated with llama.cpp
Loadout is an independent tool. It models the allocation behavior of llama.cpp but is not affiliated with or endorsed by that project. Behavior tracks roughly b3000–b4000-era builds; buffer sizing and log formats drift over time, so treat predictions as guidance, not guarantees.
License
MIT