How to check what is really inside a GGUF file
The filename is a label someone typed. The header is what llama.cpp will actually load. They disagree more often than you would expect.
You download 19 GB. You load it. The context window is 4,096 instead of the 32,768 you expected, or the model answers like something much smaller than the name suggests. By then the file is already on disk and the download cost is sunk.
Every one of those facts is written in the first few kilobytes of the file, in plain structured form. Reading them takes less time than opening the model.
What the header actually holds
A GGUF file starts with a fixed preamble and a key-value block. In order:
GGUF— the four magic bytes. Anything else is not a GGUF file, whatever the extension says.- Version — 2 or 3 in practice. Version 1 files exist and have a different layout; a parser written for v2 silently misreads them.
- Tensor count and metadata count, both 64-bit. These two numbers tell a parser how much to read next, and they are the reason a hostile file can be dangerous: a header claiming four billion tensors is a lie, and any code that trusts it before validating will try to allocate for four billion.
- The key-value block — typed metadata. Strings, integers, floats, booleans, arrays. This is where architecture and configuration live.
- Tensor info list — for each tensor: name, dimensions, type, and offset into the data section.
All of that sits in the first tens of kilobytes. The 19 GB after it is weights, and you never need to touch it to answer "what is this file".
The keys that matter
| Key | What it tells you | Why it matters |
|---|---|---|
general.architecture | llama, qwen2, gemma3, … | Determines which runtime code path loads the file |
{arch}.block_count | Number of transformer layers | Offloading decisions; a mismatch with the name means a frankenstein merge |
{arch}.context_length | Trained context window | The single most-faked number. Raising it past training does not gain you memory |
{arch}.embedding_length | Hidden dimension | With block count and vocab size, gives parameter count |
{arch}.attention.head_count | Query heads | Together with head_count_kv, sets the KV cache size |
general.name | Free text | Whatever the converter wrote. A claim, not a fact |
general.file_type | A quantization enum | One number for the whole file — which is why it can be misleading (below) |
Quantization is per-tensor, not per-file
This is the part almost everyone gets wrong. A Q4_K_M file is not uniformly 4-bit. "M" means medium: the conversion recipe assigns higher precision to the tensors that hurt most when quantized and lower precision to those that do not.
In a typical Q4_K_M file you will find a mixture:
token_embd.weightandoutput.weightat Q6_K — the vocabulary projections are sensitive- Most attention and feed-forward weights at Q4_K
- A handful of
attn_v.weighttensors bumped up, which is what the "M" buys you over Q4_K_S - Normalization weights at F32 — these are tiny and always kept exact
So general.file_type is a summary label written by the converter, not a description of every tensor. If you want to know whether a file really is Q4_K_M, count the tensor types. A file labelled Q4_K_M that contains only Q4_0 is either a relabel or a different recipe, and the difference shows up in output quality long before it shows up in file size.
Parameter count is not stored — it is derived
There is no "parameter count" field in GGUF. It is computed from tensor shapes written in the info list, summing the products of each tensor's dimensions. Useful sanity checks fall out of that:
token_embd.weighthas shape[embedding_length, vocab_size]. Multiply those and you have the embedding parameters alone, which for a 150k-vocab model is a few hundred million — enough to shift a "7B" model's real total.- Block count times the per-block parameter count should reproduce the advertised size within a few percent. A 27B label on a 14B architecture is arithmetic that does not close.
An embedding-inclusive count is also why two files with the same architecture can legitimately be called 7B and 8B. Both are honest; they counted different things. Whatever the total, the number that decides whether the model runs is file size plus KV cache, not the label.
Why you should never hand a GGUF to a naive parser
A model file is an untrusted binary you downloaded from a stranger. The header declares lengths, and a malicious or simply corrupt file can declare absurd ones — a metadata array of 260 entries, a string length of 8 GB, a tensor count that overflows a 32-bit multiply.
Code that allocates based on declared lengths, before checking that the file is even large enough to contain them, will attempt an enormous allocation and die — at best. This is not hypothetical: parsing untrusted formats is where most memory-safety bugs in inference tooling live.
The defensive pattern is simple and cheap: bound every read by the bytes actually present, cap the number of entries you are willing to iterate, and validate offsets against file size before seeking. Reading only the header — and never the weight data — removes most of the attack surface entirely.
Reading the header without uploading the model
Uploading a 20 GB file to find out its context length is a bad trade even when you trust the server: it is slow, it is unnecessary, and the file may be something you would rather not hand over.
- Open GGUF inspector and drop the
.gguffile in. - It reads the first 64 KB — the preamble, the metadata block and the tensor info list — and nothing else. That is why it finishes instantly and why memory use does not track file size.
- Read architecture, quantization mix, layer count, context length, tensor count and parameter estimate from the card.
- Cross-check the parameter estimate against the filename. If they disagree, believe the header.
Two limits worth stating plainly: it supports GGUF v2 and v3 only, and it reports what the header declares. A file can declare a 32k context that the weights do not support — the header is evidence, not proof of quality.
Where this pays off
The checks that save the most time, in order:
- Before a long download finishes elsewhere — if you already have the file, checking takes a second; if the label matters, check before mirroring it.
- After a merge — mergekit output routinely has a
general.namefrom the base model and a block count from the donor. Both are in the header, and disagreement is a red flag. - When memory math does not add up — feed the real layer count and embedding size into VRAM estimator instead of the numbers on the download page.
- When a model behaves out of character — wrong quantization, truncated download, or an unexpected architecture all show in the header before they show in a chat log.
Frequently asked
Is the model file uploaded to a server?
No. The file is read directly in the browser via a local file handle, and only the first 64 KB is parsed. Nothing is transmitted, which also means the check works with the network disconnected.
Why does the tool finish instantly on a 20 GB file?
Because it never reads the weights. Architecture, quantization and layer count all live in the header block at the start of the file. Parsing that header is kilobytes of work regardless of whether the file is 2 GB or 200 GB.
Can it tell me if a model will fit in my VRAM?
Only partly. It gives you the real layer count, embedding size, head counts and quantization, which are the inputs the memory calculation needs. The KV cache and runtime overhead depend on your context length and runtime, so use those numbers in a dedicated fit calculator.
The filename says Q4_K_M but the tensor types differ. Which is right?
The tensor types. Quantization is assigned per tensor by the conversion recipe, so a Q4_K_M file legitimately contains Q6_K and F32 tensors as well as Q4_K. The filename is a label written at conversion time; the per-tensor list is what the runtime actually loads.