Lesson plan · about 15 min · refs checked 2026-11-07 (reference links and dates only)
Learners build an estimate from weights, KV cache and runtime overhead, check it against runner occupancy output, and separate can start, can run and can finish answering.
Lesson objectives
Split VRAM demand into weights, KV cache and runtime overhead, and explain what each varies with.
Make an arithmetic weight estimate from parameter count and quantisation bit width, and label it as an estimate.
Read runner occupancy output and judge whether CPU and GPU mixed loading occurs.
Give three fallback paths when the model does not fit and state the cost of each.
Materials
llama.cpp official README: 1.5 to 8-bit integer quantisation and CPU plus GPU hybrid inference.
Ollama official FAQ: the PROCESSOR column in ollama ps and the num_ctx context setting.
Hugging Face Transformers KV cache documentation in the repository source: cache occupancy, offloading and quantised cache.
An estimate sheet: parameter count, bit width, context length, batch size, available VRAM and available RAM.
Steps
3-minute weights: multiply parameter count by bytes per parameter and write the bit-width assumption and formula.
4-minute cache and overhead: mark items that vary with context length and batch size, and leave headroom.
4-minute occupancy check: read example output from official docs and judge loading location and whether offloading is needed.
4-minute fallbacks: smaller model, lower quantisation tier and partial offloading each get one cost and one next-step test condition.
Common misconceptions
Assuming that if weights fit the model runs fast; cache and offloading change speed and latency.
Assuming quantisation only saves VRAM; official docs describe a memory-speed tradeoff and quality must be checked on your own task.
Assuming local deployment equals data compliance; logs, permissions and outbound paths still matter.
Treating occupancy numbers in documentation examples as results on your machine; hardware and settings differ.
Assessment checks
The estimate sheet has all three items, each with assumptions and sources, and the formula can be checked.
Learners can distinguish estimate from measurement and state which conditions must be fixed for the next measurement.
Fallback paths include costs, do not write best, and do not promise specific speed numbers.
Example and interpretation
A teaching scenario, not a measured or executed site test.
Class exercise: estimate the weight magnitude of a 7B model at 4-bit, then list KV cache and runtime overhead separately. If available VRAM only covers weights, do not write can run; write that offloading and latency must be checked.
How to check your practice
Explain the example in your own words, inspect input constraints, then verify against the source. Revisit concepts if you cannot explain why; supply missing dates, fields or permissions; withdraw unsupported conclusions.