config.json decoder — an LLM's configuration in plain language
Every model on Hugging Face ships a config.json — a few dozen fields that decide its memory, its speed and how far it can read. Pick a model and this page answers the questions those fields settle, in plain language, and points at the lines of the file behind every answer.
Pick a model to read its config
Or start from one of these:
Once a model is picked, this page answers:
- What kind of model is it?
- How big is it?
- How far can it read?
- What does each token cost in memory?
- How do its attention heads share memory?
- Is it a mixture of experts?
- What precision are the weights stored in?
- How many tokens does it know?
- What does my software need to load it?
- Which fields can serving ignore?
How the config is read
config.json is the file Hugging Face Transformers, vLLM and other engines read to build a model before they load its weights. It records the architecture — layers, widths, attention heads, experts, positions, vocabulary and precision — but not the weights, and not the parameter count, which LLMScale takes from the Hugging Face API.
- KV cache per token = 2 × layers × key-value heads × head_dim × bytes
- with MLA = layers × (kv_lora_rank + qk_rope_head_dim) × bytes
- maximum context = max_position_embeddings (linear and YaRN scaling reach it as original × factor; Llama 3 scaling does not multiply out)
- GQA ratio = attention heads ÷ key-value heads
Every answer names the fields it used and highlights them in the file, with its arithmetic shown beneath. Fields the glossary does not know are listed as unexplained, with their raw value, rather than guessed at. Gated repositories such as Llama and Gemma cannot be read from a browser; for those the page falls back to the architecture in LLMScale's built-in database, and says so.
Questions
- Where is the parameter count in config.json?
- It isn't there. A config describes the shape of a model, not its size on disk. LLMScale reads the count from the safetensors metadata on the Hugging Face API, which is how the page can show it next to the config.
- What is the difference between num_attention_heads and num_key_value_heads?
- num_attention_heads is how many query heads each layer runs; num_key_value_heads is how many key and value heads they share. When the second is smaller the model uses grouped-query attention, and its KV cache shrinks by the same ratio — Llama 3.1 8B shares 8 key-value heads among 32 query heads, a quarter of the cache full multi-head attention would need.
- Does max_position_embeddings mean the model works well at that length?
- It means the model is configured for that length. Engines start from it but may default lower — Ollama sizes it to your VRAM, and vLLM defaults LongRoPE models to their original length. How well the model holds up near the limit depends on how it was trained, which the config cannot tell you.
- Why does trust_remote_code matter?
- An auto_map entry means the repository ships its own Python modelling code, and Transformers only runs it when you pass trust_remote_code=True. That code runs with your permissions, so read it — or prefer a version of the model that Transformers supports natively.