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.
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.
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.
Choosing an embedding dimension for search
In plain English: Search systems also choose how many numbers to use per document. Fewer numbers make the index smaller and faster; more numbers can capture finer differences. Some modern embedding models even let you cut the list short and still get useful results.
Technically:
Retrieval cost is linear in dimension for storage and brute-force scoring: a million 384-dimensional float32 vectors take about 1.5 GB, while 3,072 dimensions take about 12 GB. OpenAI's text-embedding-3 models are trained with a Matryoshka-style objective so the first k dimensions remain useful, letting you truncate 3,072 to 256 or 1,024 to trade quality for size.
Quantising embeddings to int8 or binary reduces storage further, and many vector databases support it. The right dimension is an empirical choice measured on retrieval benchmarks for your own data.
What is Matryoshka representation learning?
Training an embedding so its leading dimensions form a good smaller embedding on their own, like nested dolls.
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
- gpt-oss architecture: gpt-oss keeps a 2,880-wide residual stream but a 4,096-wide attention space.
- Gemma 4 architecture: Gemma 4 sizes range from 1,536 to 5,376 dimensions with 256-dimensional heads.
- DeepSeek-V3 architecture: DeepSeek-V3 uses 7,168 dimensions and compresses its cache with latent attention.
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.