What Are Dimensions in an LLM? Hidden Size and Vectors Explained

By LatestLLM Editorial · Published · Facts verified · 8 min read

Also called: dimensions, embedding dimension, hidden size, model width, d_model, vector dimension

Before this: Embedding

In one line

A dimension is one slot in a vector, and a model's dimension or hidden size is how many numbers it uses to represent every token at each layer.

Dimension, simply and technically

In plain English

When a model turns a token into a list of numbers, the length of that list is its number of dimensions. A model with a hidden size of 2,880 describes every token with 2,880 numbers at every step of its thinking. More numbers give the model more room to keep track of different aspects of meaning at the same time.

Dimensions are one of the main dials that make a model big or small. Doubling the width roughly quadruples the size of most of the model's internal tables, which means more memory, more computation and higher running costs, but often a more capable model.

Think of it like this: Describing a house with two numbers, say price and size, tells you something. Adding bedrooms, distance to a station, year built and garden size lets you tell two similar houses apart much better. Each extra number is a dimension. A model with thousands of dimensions can tell apart very subtle differences in meaning, but every extra number costs storage for every word it describes.

Everyday example: How much space one word takes inside a model

gpt-oss represents each token with 2,880 numbers, each stored in 2 bytes.

Output:

2,880 numbers x 2 bytes = 5,760 bytes per token, per layer

What it shows: That is about the size of a short email for a single token at a single step. A long conversation of a hundred thousand tokens passes through dozens of layers, which is why big models need so much memory.

Technically

In linear-algebra terms, a vector in R^d has d dimensions. In a transformer, d_model (hidden size) is the width of the residual stream: every token is a d-dimensional vector that each block reads and adds to. Weight matrices are shaped around it, for example d x d_ffn for the feed-forward layer, so most parameters scale with d squared. gpt-oss uses d = 2,880, Gemma 4 31B uses 5,376 and DeepSeek-V3 uses 7,168.

Several other dimensions sit beside d_model. The head dimension is the width of each attention head (64 for gpt-oss, 256 for Gemma 4, 192 for DeepSeek-V3 queries and keys), the feed-forward width is typically several times d, and text embedding models choose an output dimension such as 384 for all-MiniLM-L6-v2 or 3,072 for OpenAI's text-embedding-3-large.

Technical example: Sizing tables from published dimensions

Compute an embedding table and a per-token key-value cache from gpt-oss's config values.

Input:

vocab=201088, hidden=2880, kv_heads=8, head_dim=64, layers=36, bytes=2

Code (python):

vocab, hidden = 201_088, 2_880
kv_heads, head_dim, layers = 8, 64, 36
bytes_per_value = 2  # bfloat16

embedding_params = vocab * hidden
kv_per_layer = 2 * kv_heads * head_dim * bytes_per_value  # keys + values

print(f"embedding params: {embedding_params:,}")
print(f"KV bytes per token per layer: {kv_per_layer:,}")
print(f"KV bytes per token, {layers} layers: {kv_per_layer * layers:,}")

Output:

embedding params: 579,133,440
KV bytes per token per layer: 2,048
KV bytes per token, 36 layers: 73,728

What it shows: Every size is a product of dimensions. The cache depends on the number and width of key-value heads, not on d_model, which is why grouped-query attention shrinks memory so effectively. The 36-layer figure assumes every layer caches the full context; gpt-oss's sliding-window layers need less.

Explore what a dimension is and what it costs. The top strip shows a real 384-dimensional sentence embedding from all-MiniLM-L6-v2 as a barcode, one coloured bar per dimension. Below, pick a model preset or move the sliders for vocabulary size, hidden size and precision to see how large the embedding table becomes. Vector from all-MiniLM-L6-v2; model presets use the hidden sizes and vocabularies published in gpt-oss, Gemma 4 and DeepSeek-V3 configs.

What a dimension is

In plain English: A dimension is just one position in a list of numbers. A point on a flat map has two dimensions, across and up. A point in a room has three. A model's vectors have thousands, which is impossible to picture, but the maths works the same as with two or three.

Think of it like this: Dimensions are like the number of sliders on a sound mixing desk: more sliders let you shape the sound in more independent ways.

Technically:

A d-dimensional vector is a point in R^d. Distances, angles and dot products generalise directly, so similarity between tokens can be computed in 2,880 dimensions with the same formulas as in two. High-dimensional spaces have an unintuitive property that helps models: random directions are almost orthogonal, so a large space can hold many nearly independent features.

Research on superposition suggests models exploit this by storing more features than dimensions, each as a direction, tolerating small interference between them. Dimensions are therefore a budget of capacity, not a count of concepts.

Go deeper: details for practitioners
  • Because features are directions spread across many dimensions, a single dimension usually mixes several unrelated signals. That is why inspecting one number of an embedding rarely tells you anything.
What does orthogonal mean?

At right angles. Orthogonal vectors have a dot product of zero, meaning they carry independent information.

Hidden size: the width of the model

In plain English: Inside a chatbot model, every token carries its list of numbers from layer to layer, and each layer edits it. The length of that list stays the same the whole way through and is called the hidden size. It is one of the first numbers listed when a model is released, next to the number of layers.

Technically:

The residual stream has shape n x d_model throughout the network. Attention projects it to queries, keys and values and back; the feed-forward block expands it to d_ffn and contracts it back. Published values include 2,880 (gpt-oss, both sizes), 5,376 (Gemma 4 31B), 2,560 (Gemma 4 E4B) and 7,168 (DeepSeek-V3).

The attention width need not equal d_model. gpt-oss uses 64 query heads of 64 dimensions, a 4,096-wide attention space projected back to 2,880; Gemma 4 31B uses 32 heads of 256, or 8,192. Designers pick head count and head size separately from the residual width.

Technical example: Reading width from a config file

Open a model's config.json on Hugging Face.

Input:

"hidden_size": 7168, "num_attention_heads": 128, "vocab_size": 129280

What it shows: These three DeepSeek-V3 values already fix the embedding table at 129,280 x 7,168 and the number of attention heads each token's vector is split across.

Go deeper: details for practitioners
  • Width and depth trade off. For a fixed parameter budget, scaling studies find wide-and-shallow and narrow-and-deep models land in a similar loss range, so the choice is often made for hardware efficiency, such as matrix shapes that fill accelerator tiles.
What is the residual stream?

The running vector for each token that every transformer block reads from and adds its output to.

How dimensions drive size and cost

In plain English: Every extra dimension must be stored for every token the model knows, and processed for every token you send. That is why wider models need bigger and more expensive chips, and why companies offer smaller, narrower versions of their models that are cheaper and faster but less capable.

Technically:

Parameter counts follow from dimensions. The embedding is V x d; attention weights are about 4 x d x (heads x head_dim) adjusted for grouped key-value heads; a gated feed-forward layer is 3 x d x d_ffn. With layers L, dense parameters grow roughly as 12 x L x d squared. Compute per token is about twice the parameter count in multiply-adds.

Activation memory and the key-value cache scale with the cached dimensions. Per token per layer the cache holds 2 x kv_heads x head_dim values: 2 x 8 x 64 = 1,024 for gpt-oss, 2,048 bytes in bfloat16. Techniques such as grouped-query attention and DeepSeek's multi-head latent attention attack exactly these dimensions.

What is bfloat16?

A 16-bit number format, 2 bytes per value, widely used to store model weights and activations.

Common misconceptions

  • Myth: Each dimension stands for one human concept.

    Reality: Concepts are stored as directions spread across many dimensions, and each dimension mixes several of them.

  • Myth: A model with more dimensions is always better.

    Reality: Width is one of several factors, with depth, data and training. Extra width without enough data or compute gives diminishing returns.

  • Myth: Hidden size and embedding size of a search model are the same thing.

    Reality: An LLM's hidden size is its internal width; a search embedding model's output dimension is a separate design choice.

Where you'll see this

Key takeaways

  • The number of dimensions is the length of a vector; a model's hidden size is the length of the vector it keeps for every token at every layer.
  • Most weight matrices are sized from the hidden dimension, so parameters and compute grow roughly with its square.
  • Head dimension, feed-forward width and embedding output size are separate dimensions with their own trade-offs.
  • More dimensions give more capacity, but past a point the extra width costs more memory and compute than it returns.

Frequently asked questions

What does hidden size mean in an LLM?

The number of values the model keeps for each token as it passes through the layers, for example 2,880 in gpt-oss.

Is the embedding dimension the same as the hidden size?

Inside a transformer, yes: token embeddings have exactly the hidden size. For separate text embedding models, the output dimension is its own setting.

How many dimensions do models in use today have?

Published open models range from about 1,500 to over 7,000 hidden dimensions; gpt-oss uses 2,880 and DeepSeek-V3 7,168.

Why do more dimensions make a model slower?

Most computations multiply matrices whose sides are the hidden size, so work grows roughly with its square.

Can I reduce embedding dimensions for search?

Yes, with models trained for it, such as OpenAI's text-embedding-3, or with techniques like PCA and quantisation, at some cost in accuracy.

Sources

Facts last verified November 23, 2026.

Next concept: Attention

Learn next

  • Attention (Intermediate): Attention is the step where each token looks back at the earlier tokens, scores how relevant each one is, and blends in information from the most relevant.
  • Transformer (Intermediate): A transformer is a neural network built from a stack of identical blocks, each mixing information between tokens with attention and then refining each token on its own.
  • Quantization (Intermediate): Quantization stores a model's numbers in fewer bits, for example 4 instead of 16, so it needs a fraction of the memory and often runs faster, at some cost in precision.