How models are made
Counting memory for a multimodal modelpractitioner-perspective methodology · key facts carry official sources
Split multimodal occupancy into three bills — encoder, projector files and decoder cache — with the source, unit (GiB) and scope stated for each. The KV formula covers only a standard same-layer full-attention decoder; it does not extend to encoders or to MLA, hybrid and sliding-window designs.
This guide counts three bills
Memory for a multimodal model is the total of three separate bills, not one number.
The three are: encoder occupancy, projector and connector files, and the decoder side's weights plus cache.
This site runs no models, reads no hardware and issues no occupancy conclusion for any multimodal model. What it can give is the split, the units and the boundaries.
List the three bills separately
Asking "how much VRAM does it need" has no answer until the layers are split and each line records its own source.
- Text weights: the resident volume of the decoder backbone. A residency estimate, not the downloaded file's byte count.
- Encoder and projector: the image/audio path's own weights, which the runner loads as separate files.
- Runtime and temporary tensors: preprocessing, scheduling and CUDA-graph style overhead; left blank when not documented.
- Decoder cache: the KV that appears only after image tokens enter the context.
If one line uses the wrong unit, the total is meaningless. This page books everything in GiB and converts decimal GB first.
The encoder and projector are their own layer
Multimodal support is not the sentence "it accepts images"; it has its own files and switches.
- The runner needs the text file and the projector file at once: the official documentation describes
-m model.gguftogether with--mmproj file.gguf, one per side. Source: docs/multimodal.md. - The projector is offloaded to the GPU by default, and the same documentation gives
--no-mmproj-offloadto stop that. This decides whether the line counts as VRAM or system memory. - A projector file is more than a projection: the official quantize documentation says it may contain vision or audio encoders and other components.
- Conversion and quantisation are done separately: the documentation states that models accepting image or audio input need their encoders and projectors converted and quantised as well.
- OCR-style models carry their own prompt and input-structure requirements; the documentation points back to the model's instructions rather than chat-style feeding.
The official quantize documentation adds a precision note: these components are usually kept in a high-quality format, and using a smaller quant affects speed and memory only slightly but can affect overall quality. That is the vendor's statement, not a measurement by this site.
How many tokens an image costs: read the configuration
How many tokens an image becomes inside the decoder is set by the model and its preprocessing. It cannot be derived from file size.
- Take the figure from the official model configuration, preprocessing description or runner documentation. When none of the three gives it, this site writes that it is not stated rather than guessing from patch counts.
- The same model at another resolution, or with another resizing strategy, yields a different token count, and the cache line moves with it.
- How many images or video clips a request may carry is a limitable setting. vLLM's memory documentation lists parameters such as
limit_mm_per_prompt; see conserving_memory. - The official documentation also warns that some models need a larger context window, with an example setting the context to 8192. A longer context mainly grows the cache line.
The KV formula only applies after tokens reach the decoder
The standard decoder cache calculation is 2 × L × Hkv × D × B × C × N; divide the byte result by 1,073,741,824 to obtain GiB.
Its scope is narrow: standard full-attention MHA/GQA decoders with identical layers and complete key/value state kept at every layer.
MLA, hybrid state-space designs, sliding windows and architectures whose caches differ per layer are outside it, and encoders never produce this kind of cache.
- Count C as prompt tokens plus tokens produced from the image plus generated content, not text length alone.
- N assumes equal request lengths and no cache sharing; paging reuse and shared prefixes change the basis.
- vLLM's PagedAttention design document describes blocks holding a fixed number of tokens per head; see paged_attention.
- Cache precision is a separate setting; the same memory documentation configures cache space in GiB.
Fill the fields and see the arithmetic in the capacity workbench: context and concurrency budget.
A fictional exercise: budgeting one image input
Every number in this section is a fictional teaching assumption. It matches no real model, official page or result produced by this site.
Assume text weights of 5 GiB, an encoder plus projector total of 1.5 GiB, and 1 GiB for runtime and reserve.
Now assume each image becomes 256 tokens, one request carries 2 images, and prompt plus generated content totals 1,500 tokens, so C is 2,010 with N = 1.
Under a standard same-layer full-attention MHA/GQA assumption with L 32, Hkv 8, D 128 and B at 2 bytes, KV is about 0.2 GiB and the total about 7.7 GiB.
- If the architecture cannot be confirmed (MLA, hybrid or sliding window), this calculation is void and the official method for that architecture must be used instead.
- Against an 8 GiB task-available budget the assumption leaves 0.3 GiB headroom. That figure promises neither a successful start nor image-understanding quality.
- To shrink the result, reduce image count, context length or concurrency. Each change moves that cache line.
Check and troubleshooting entry points
- Load failures: first check whether the runner supports this architecture and projector combination; start at the failure library.
- Over budget: the entry point is memory troubleshooting. Confirm units and assumptions before changing settings.
- Acceptance: use the 20-item self-test and write checkable fields for image tasks.
- For interface-level differences (OCR, speech, embedding, reranking) see the "Task models" guide on this site; the decoder KV formula is not applied to encoders there either.
- To record cost components per task use the cost calculator; this site stores no unit prices and predicts no machine output.
How this differs from the Learn site
The Learn site's multimodal, encoder and decoder and VRAM pages are one-page explainers for users.
This guide splits occupancy into three bills and states the source and scope for each.
Same concept, different depth on each side, cross-linked without duplication. For bandwidth and cost composition see "GPU facts and cost math".
Sources
- llama.cpp multimodal documentation (libmtmd, --mmproj, and the default GPU offload of the projector; fetched directly 2026-11-06):https://raw.githubusercontent.com/ggml-org/llama.cpp/master/docs/multimodal.md
- llama.cpp quantize tool documentation (multimodal encoders and projectors need separate conversion and quantisation; fetched directly 2026-11-06):https://raw.githubusercontent.com/ggml-org/llama.cpp/master/tools/quantize/README.md
- vLLM memory-conservation documentation (limit_mm_per_prompt and cache space configured in GiB; fetched directly 2026-11-06):https://docs.vllm.ai/en/latest/configuration/conserving_memory/
- vLLM PagedAttention design document (blocks store a fixed number of tokens per head; fetched directly 2026-11-06):https://docs.vllm.ai/en/latest/design/paged_attention.html
- NVIDIA GeForce RTX 4090 official specification page (published memory capacity; fetched directly 2026-11-06):https://www.nvidia.com/en-us/geforce/graphics-cards/40-series/rtx-4090/
Base source snapshot: 2026-11-06; item-specific additions and check scope appear in the text and source labels. Check original specifications, methods and conditions.
This page appears in: Build a robot · Make video with AI