DeepSeek-V3 Architecture Explained: MLA, MoE and Sparse Attention
By LatestLLM Editorial · Published · Specs verified · 35 min read · License: MIT (V3.2, R1); DeepSeek Model License (V3)
DeepSeek-V3 is DeepSeek’s open-weight mixture-of-experts language model with 671B parameters, of which 37B are active for each token. DeepSeek-R1 uses the identical architecture with reasoning-focused training, and DeepSeek-V3.2 adds sparse attention. Four design choices keep it affordable: multi-head latent attention caches only 576 numbers per token per layer, a layer of one shared and 256 routed experts runs 8 per token, a per-expert bias balances load without a loss penalty, and the weights ship in 8-bit FP8.
Key takeaways
- DeepSeek-V3 is a text-only, decoder-only mixture-of-experts transformer: 61 layers, 671B total and 37B active parameters. DeepSeek-R1 has the identical architecture, and DeepSeek-V3.2 adds a sparse-attention indexer.
- Attention is multi-head latent attention. It caches a 512-wide latent plus a 64-wide rotary key per token per layer, 576 numbers instead of keys and values for 128 heads. Our estimate is 70,272 bytes per token, about 71 times less than plain multi-head attention at the same size.
- Layers 4 to 61 have one shared expert and 256 routed experts, of which 8 run per token; the first three layers are dense. Routing uses sigmoid scores and keeps the best 4 of 8 expert groups. The experts are about 97.8% of all parameters.
- Load is balanced with a per-expert bias used only for choosing experts, so no auxiliary loss pulls against training; a tiny sequence-wise loss remains. A multi-token-prediction module adds one extra predicted token and ships as an 11.5B-parameter layer in the checkpoint.
- DeepSeek-V3.2 adds a lightning indexer that selects the best 2,048 tokens per query, cutting the main attention’s cost on long texts; the cache itself is not smaller. Weights are published in FP8, 641.3 GiB for V3.
- The numbers on this page come from DeepSeek’s config.json files, model cards, weight documentation, reference code and the V3 and V3.2 reports. Cache sizes are our own estimates and labelled as such.
DeepSeek-V3 variants
| Size | Type | Parameters | Layers | Attention mix | Context | Inputs |
|---|---|---|---|---|---|---|
| DeepSeek-V3 | Mixture-of-experts (Latent attention, 8 of 256 experts, FP8 weights) | 671B total · 37B active | 61 | MLA on all 61 layers, every token seen | 160K tokens | text |
| DeepSeek-R1 | Mixture-of-experts (Same layers as V3, Reasoning via RL, MIT licence) | 671B total · 37B active | 61 | MLA on all 61 layers, every token seen | 160K tokens | text |
| DeepSeek-V3.2 | Mixture-of-experts (Sparse attention, Top 2,048 tokens, MIT licence) | 671B total · 37B active | 61 | MLA on all 61 layers, sparse: top 2,048 tokens | 160K tokens | text |
Inside one transformer block
Tokens: text cut into pieces
The model never sees letters or words directly. A tokenizer cuts the text into pieces called tokens and gives each piece a number from a list of 129,280 entries.
Think of it like this: Reading a sentence through a set of 129,280 word-and-fragment stamps. Each stamp has a number, and the model only ever sees the numbers.
Embedding: a list of numbers per token
Each token number is looked up in a table and turned into a list of 7,168 numbers. That list is what the layers read and rewrite.
Think of it like this: A passport photo for every token: the same 7,168 measurements are taken for each one, and everything that follows works on those measurements.
Transformer block × 61
The same two-step recipe is repeated 61 times: first attention, where words look at earlier words, then a feed-forward step that processes each word on its own. In the first 3 layers that step is one ordinary network; in the other 58 it is a team of small experts.
Think of it like this: A document passed through 61 editors. Each one adds notes in the margin and keeps what is already written.
RMSNorm: keep the numbers steady
Before each step the list of numbers is rescaled so its size is predictable. This keeps training stable in a network 61 layers deep.
Think of it like this: Turning every voice in a long relay to the same volume before passing the message on.
Multi-head latent attention (MLA)
Attention lets each word look at earlier words. To avoid re-reading them, models keep notes (keys and values) for every earlier word, and those notes take most of the memory in long chats. MLA squeezes each word’s notes into one short summary of 576 numbers and rebuilds the full per-head notes from it when needed.
Think of it like this: Instead of filing a full transcript for every word, you file one short index card. When a question comes in, you expand the cards you need.
Lightning indexer: pick what to read
In DeepSeek-V3.2 a small extra network scores every earlier token for the word being written and keeps only the best 2,048. The main attention then reads just those, so very long texts cost much less to process.
Think of it like this: Skimming the index of a long book to pick the pages worth reading, then reading only those pages closely.
Residual add: keep what was there
Each step adds its result to what was already there instead of replacing it, so earlier information is never lost.
Think of it like this: Highlighting a textbook rather than rewriting it: the original text stays and the notes pile on top.
Dense feed-forward network (first layers)
In the first 3 layers each word goes through one ordinary feed-forward network, with no experts or routing.
Think of it like this: The reception desk everyone passes before the specialist floors begin.
DeepSeekMoE: 1 shared + 256 routed experts
In layers 3+1 to 61 the feed-forward step is a team of 256 small experts plus 1 shared expert that every word uses. A router picks 8 experts for each word, so about 8 of 256 routed experts and the shared one work on it.
Think of it like this: A hospital with one general practitioner every patient sees and 256 specialists. Triage sends each patient to 8 of them.
Output head: scores for the next token
After the last layer one final normalisation and one big matrix turn each word’s list of numbers into a score for each of the 129,280 possible next tokens.
Think of it like this: A final vote: every token in the vocabulary gets a score and the model picks or samples from the highest.
Multi-token prediction module
Next to the main model sits a small extra module that guesses the token after the next one. It gives training a richer signal and, at inference time, can draft a second word per step that the main model then checks.
Think of it like this: A chess player who, while choosing a move, also writes down the likely reply.
The big picture: how DeepSeek-V3 is built
In simple words: DeepSeek-V3 is a very large language model that uses only a small part of itself for each word. It has 671 billion parameters, but about 37 billion work on any one token. Two ideas make that cheap: attention keeps a tiny summary of every word instead of full notes, and the feed-forward layers are made of 256 small specialists of which each word uses 8.
Think of it like this: A huge library where every visitor is sent to 9 of 257 specialist reading rooms, and the front desk keeps one index card per visitor instead of a full transcript.
DeepSeek-V3 was released on 26 December 2024. It is a decoder-only transformer: it reads text as tokens and predicts the next one, through 61 layers with 7,168 numbers per token. According to the model card it has 671B total parameters and 37B activated for each token. The Hugging Face download shows 685B because it also contains a 14B multi-token-prediction module that sits outside the 671B main model.
This guide covers three models that share almost all of their design. DeepSeek-V3 is the base design. DeepSeek-R1 (20 January 2025) is a reasoning model trained from V3-Base; its published configuration file is identical to V3’s apart from the version string of the library that exported it. DeepSeek-V3.2 (1 December 2025) adds one component, a lightning indexer that lets attention skip most of a long text. Use the size buttons in the diagram to switch between them.
Five design choices explain most of the model. Multi-head latent attention (MLA) caches 576 numbers per token per layer instead of keys and values for all 128 heads. DeepSeekMoE builds the feed-forward step from one shared and 256 routed experts, 8 of which run per token, in all but the first three layers. A per-expert bias keeps the experts evenly busy without a balancing penalty in the training loss. A multi-token-prediction module guesses one extra token for training and for faster decoding. And the weights are published in FP8, 8-bit floating point, with one scale for every 128×128 block.
What this adds up to: most of the 97.8% of the parameters that sit in experts are idle for any one token, the attention that every token uses is only 1.7% of the model, and the cache that attention must keep per token is about 71 times smaller than plain multi-head attention would need at the same size. Those three facts, not any single trick, are why a 671B model is practical to serve.
The numbers here come from DeepSeek’s own files: each model’s config.json, the model cards, the weight documentation, the reference code in each repository’s inference folder and the V3 and V3.2 technical reports. Where a figure is our own arithmetic, such as a cache estimate, the text says so.
Go deeper: details for practitioners
- Layer recipe: embedding, then 61 blocks of [RMSNorm, MLA, residual add, RMSNorm, feed-forward, residual add], then a final RMSNorm and the output matrix. Layers 1 to 3 use a dense feed-forward network of width 18,432; layers 4 to 61 use 256 routed experts of width 2,048 and one shared expert of the same width.
- Parameter accounting from the configuration (our arithmetic, matching the card): embedding and output matrix 1.85B, attention 11.4B, dense feed-forward layers 1.19B, experts 656.5B. The weight documentation gives 36.6B active parameters including the 0.9B output matrix, which the card rounds to 37B.
What does “active parameters” mean?
The number of parameters that actually run for one token. In a mixture-of-experts model most parameters belong to experts that this token does not use, so the active count is much smaller than the total.
What is a decoder-only transformer?
A network that reads the text so far and predicts the next token, one token at a time. Each token can only look at earlier tokens, never later ones.
Tokens and embeddings
In simple words: Text is cut into tokens, and each token becomes a list of 7,168 numbers. The tokenizer has about 129,000 entries.
Think of it like this: A box of 129,280 stamps: every stamp has a number, and a table says which 7,168 measurements describe it.
The tokenizer is a byte-level BPE with an extended vocabulary of 128K tokens according to the paper; the configuration lists 129,280 entries. Compared with DeepSeek-V2 the pre-tokenizer was changed to improve multilingual compression and to add tokens that combine punctuation and line breaks. The paper warns that such combined tokens can bias the model where a prompt ends without a line break and says it randomly splits some of them during training to reduce that effect.
The embedding table is 129,280 × 7,168, about 0.93B parameters. The output matrix is a second table of the same size, because the weights are not tied. Together they are 0.28% of the model, so the vocabulary is a small part of the cost.
Go deeper: details for practitioners
- Position is not added to the embeddings. Attention handles it with rotary embeddings on a small part of each head, described in the attention and position sections.
Multi-head latent attention: remember a summary, not every note
In simple words: To write the next word, attention needs notes about every earlier word. Those notes (the KV cache) are what fills memory in a long chat. MLA files each word under one short summary and rebuilds the per-head notes from it when they are needed.
Think of it like this: A librarian who keeps one index card per book instead of photocopying every page for each reader, and who can reconstruct the pages a reader asks for from the card.
A standard attention layer gives every head its own key and value for every token, and the cache stores all of them. DeepSeek-V3 has 128 heads with a 192-wide key (128 plain plus 64 position-carrying) and a 128-wide value, so plain multi-head attention would cache 81,920 bytes per token per layer in bfloat16, or about 5.0 MB per token across 61 layers.
MLA compresses instead. A token’s 7,168 numbers are projected down to a 512-wide latent, and that latent is what is cached, together with one 64-wide rotary key shared by every head: 576 numbers, or 1,152 bytes per token per layer. Across 61 layers that is 70,272 bytes per token. When attention needs the per-head keys and values, learned up-projections rebuild them from the latent. Queries are compressed the same way, through a 1,536-wide latent. The V2 paper says this reduces activation memory during training; it does not shrink the cache, and the query latent is not cached.
At 131,072 tokens of conversation, our estimate of the whole-model cache is 9.21 GB with MLA. The same model with a separate key and value for every head would need 655.0 GB, 71.1 times more. Grouped-query attention with 8 KV heads would need 40.9 GB and multi-query attention with a single one 5.12 GB. MLA stores about 1.8 times what multi-query attention does but keeps 128 distinct heads. The V2 paper, which introduced MLA, reports that it achieved better quality than multi-head attention in its tests while shrinking the cache; this guide does not re-measure that.
One more detail explains the shape of the cache. Rotary position embeddings rotate each key by an amount that depends on its position, and that rotation would not commute with the up-projection that rebuilds keys from the latent. DeepSeek therefore splits each head into a part without position information, which is compressed, and a 64-wide part that carries it. The position part of the key is shared across heads and cached on its own, which is the extra 64 in the 576.
Go deeper: details for practitioners
- Shapes from the reference code: wq_a 7,168→1,536, RMSNorm, wq_b 1,536→128×192; wkv_a 7,168→512+64, RMSNorm on the 512, wkv_b 512→128×(128+128); output projection 128×128→7,168. Attention per layer holds about 187M parameters, 11.4B across 61 layers.
- The reference code defaults to an absorbed implementation: the key up-projection is folded into the query so scores are computed against the cached latent directly, and the value up-projection is applied after the weighted sum. With it, decoding is a multi-query attention over a 576-wide cache shared by 128 query heads, which is also why the cache stays small at run time and not only on paper.
- The softmax scale is the usual 192^-0.5, multiplied by an extra YaRN factor, mscale squared, when the context is longer than the original 4,096 (mscale is 0.1·ln 40 + 1, about 1.37).
- The V2 paper reports a 93.3% smaller KV cache than DeepSeek 67B, a different model with a different attention, so that figure is not comparable to the estimates above.
What does “latent” mean here?
A hidden, compressed representation. The model learns a short vector from which it can rebuild what it needs, instead of storing the full thing.
Is the compression lossy?
The summary is much narrower than the full per-head keys and values, so it cannot hold everything. The model is trained with this bottleneck in place, so it learns to put what matters into it.
Positions and the 128K context
In simple words: The model marks where each word sits by rotating a small part of every query and key. A stretching method called YaRN lets it read far longer texts than it saw in early training.
Think of it like this: Numbering the pages of a book with a ruler. YaRN is a ruler whose marks are respaced so a much longer book still fits.
Rotary position embeddings (RoPE) are applied to only 64 of every 192 query and key numbers in a head, the decoupled part described above, with a base frequency of 10,000. The rest of the head carries no position information.
After pre-training on 4,096-token sequences, DeepSeek used YaRN to extend the context in two further training phases of 1,000 steps each, first to 32K and then to 128K tokens. The paper says YaRN is applied only to the shared rotary key, with scale 40, and the configuration records factor 40 from 4,096, which is 163,840 positions.
That gives two numbers for the context length. The model card advertises 128K, the length the paper trained and tested to; the configuration allows 163,840. This page uses 163,840 in its tables because that is the configured limit, and quotes 128K when it talks about what DeepSeek tested.
Go deeper: details for practitioners
- The paper’s YaRN settings are scale 40, alpha 1, beta 32, matching rope_scaling in the configuration (factor 40, beta_fast 32, beta_slow 1, original length 4,096).
What is YaRN?
A method for stretching rotary position embeddings so a model trained on short texts can read long ones, followed by a short period of training on long texts.
Normalisation and the output head
In simple words: Every sub-block is preceded by a normalisation step, and after the last layer one big matrix turns each word’s numbers into a score for every token in the vocabulary.
Think of it like this: Levelling the volume before each relay handover, and a final scoreboard at the end.
DeepSeek-V3 is pre-norm: each layer applies RMSNorm to its input, runs attention or the feed-forward step, and adds the result to the residual stream. There is no norm after a sub-block, which is the difference from the four-norm layers of Gemma 4. MLA adds two extra RMSNorms of its own, on the 1,536-wide query latent and the 512-wide key/value latent.
After the last layer there is a final RMSNorm and an untied output matrix of 129,280 × 7,168. There is no logit soft-capping. The multi-token-prediction module shares both this matrix and the embedding table, so it adds no vocabulary-sized parameters of its own.
Go deeper: details for practitioners
- The V3.2 reference code keeps the residual stream as a second tensor and passes it into each norm, which fuses the add and the normalisation. The result is the same as the plain version in the V3 code.
DeepSeekMoE: one shared expert and 256 routed ones
In simple words: After attention, most layers send each word to 8 of 256 small expert networks, plus one expert that every word uses. Only about 5.5% of the parameters work on any token.
Think of it like this: A hospital with one general practitioner every patient sees and 256 specialists. Triage sends each patient to 8 of them.
In layers 4 to 61 the feed-forward step is a DeepSeekMoE layer: 256 routed experts of width 2,048 and one shared expert of the same width. A router picks 8 routed experts for each token, so 9 experts run, and their outputs are added. The first three layers use one dense feed-forward network of width 18,432 instead.
Two ideas, introduced in the DeepSeekMoE paper, separate this from earlier mixture-of-experts layers. Experts are fine-grained: many small ones rather than a few large ones, so many more combinations are possible for the same compute. And one expert is shared: it sees every token, so common knowledge does not have to be learned again inside each routed expert.
The scale is what makes it matter. One expert holds 44.0M parameters. A layer has 257 of them, 11.3B parameters, and 58 layers hold 656.5B, which is 97.8% of the model. Per token only 9 of 257 run, which together with attention, the three dense layers and the output matrix gives the 37B active parameters (36.6B by the weight documentation’s count). The cost is memory: every expert must be loaded even though most are idle for any one token.
Go deeper: details for practitioners
- Each expert is SwiGLU: down(silu(gate(x)) × up(x)) with three 7,168 × 2,048 matrices. The shared expert is built with a width of 2,048 times the number of shared experts, which is one here.
- When decoding, the paper treats the shared expert as a routed expert that is always selected, so each token touches 9 experts per MoE layer. During serving it also describes deliberately replicating heavily used experts across GPUs to even out the load.
- DeepSeek-V3 does not drop tokens when an expert is overloaded, in training or in inference, according to the paper.
What is a router?
A small network that scores every expert for the current token and selects the best few. Different tokens usually go to different experts.
Does every token use the same 9 experts?
No. The shared expert is the same for everyone, but the 8 routed experts are chosen per token and per layer.
Routing without a balancing penalty
In simple words: A router can fall into a rut where a few experts get all the work. DeepSeek keeps them evenly busy by nudging a per-expert bias up or down, not by punishing the model in its training loss.
Think of it like this: A restaurant manager who quietly moves a sign towards the quiet counters instead of fining customers who queue at the busy one.
Scoring first. The router multiplies the token’s 7,168 numbers by one vector per expert and applies a sigmoid, so every expert gets an independent affinity between 0 and 1. A softmax would make experts compete for a fixed total; a sigmoid scores each expert on its own, and the V3 paper notes the switch as a small change from DeepSeek-V2.
Then the choice, in two steps. The 256 experts are split into 8 groups of 32. A group’s score is the sum of its two best affinities, and only the 4 best groups survive. The 8 experts with the highest scores inside the surviving groups are picked. The paper presents this as node-limited routing: each token is sent to at most 4 machines, which caps cross-machine traffic during training. The configuration lists the same idea as 8 groups of which 4 are kept.
Then the weights. The outputs of the 8 picked experts are weighted by their sigmoid scores, normalised to sum to one and multiplied by a scaling factor of 2.5. The bias that steers balance is not part of this: it is added to each expert’s score only when choosing, never when weighting.
That bias is the auxiliary-loss-free balancing method. During training, after each step, the bias of an overloaded expert is lowered by a small amount and that of an underloaded expert is raised. The paper sets the update speed to 0.001 for the first 14.3T tokens and to 0 for the last 500B. Because the bias is not part of the loss, balancing does not pull against learning to predict text. The paper still adds one complementary sequence-wise balance loss, with a weight of 0.0001, to prevent extreme imbalance inside a single sequence. So “no auxiliary loss” is the headline, but a very small one remains.
Go deeper: details for practitioners
- Reference code: scores = sigmoid(linear(x)); a learned bias per expert is added for the group and top-k selection; group score = sum of the top 2 biased scores in the group (2 is the number of routed experts, 8, divided by the groups kept, 4); weights are the unbiased scores of the chosen experts divided by their sum, times route_scale 2.5.
- In the configuration this appears as scoring_func sigmoid, topk_method noaux_tc, n_group 8, topk_group 4, norm_topk_prob true and routed_scaling_factor 2.5.
- The paper’s account of the mapping between groups and machines is for training; at inference time a deployment can place experts differently.
What is routing collapse?
When the router keeps favouring the same few experts, so the others never train and the model wastes most of its capacity.
Why keep the bias out of the weights?
If the bias changed the weights it would change what the model computes, not only who does the work. Using it only for selection moves load around while leaving each expert’s contribution to the answer based on how well it fits the token.
Multi-token prediction: one extra word per step
In simple words: A small extra module guesses the token after the next one. In training it gives the model a richer signal, and when serving it can draft a second word that the main model checks, so many steps produce two words instead of one.
Think of it like this: A chess player who, after choosing a move, also writes down the likely reply, and checks it against what actually happens.
Normally a language model is trained to predict only the next token. DeepSeek-V3 adds a multi-token-prediction (MTP) module that also predicts the one after. The paper sets the depth to 1: besides the exact next token, each position predicts one additional token. The module has its own transformer block, a projection that combines the main model’s final hidden state with the embedding of the next token, and it shares the embedding table and output matrix with the main model.
It is trained, not just attached. The MTP loss has a weight of 0.3 for the first 10T tokens and 0.1 for the remaining 4.8T. The paper argues this densifies the training signal and may make the model plan its representations ahead.
For serving, the module can be used as the draft model of speculative decoding. The paper measures that the second token is accepted 85% to 90% of the time across topics and reports a 1.8× faster decoding speed. Each step then yields on average 1 plus the acceptance rate in tokens, about 1.87 at 87%, before the cost of running the module, which is why the measured gain is a little lower.
The module ships in every checkpoint as layer 61, 11.5B unique parameters for V3 according to the weight documentation. It is not part of the 671B main model, and the reference inference code for V3 does not run it; the model card says community support for it is under development. Whether a given service uses it is up to that service.
Go deeper: details for practitioners
- Structure per the weight documentation: enorm and hnorm RMSNorms, an eh_proj projection from 2 × 7,168 to 7,168, and one transformer layer with the same attention and mixture-of-experts layout as the main layers; embed_tokens and the output head are shared.
- The V3.2 checkpoint also contains this layer, and it carries an indexer like the other layers; DeepSeek has not published a separate parameter count for it, so the compare table leaves it blank.
What is speculative decoding?
A way to generate faster: a cheap draft guesses several tokens and the main model checks them in one pass. Right guesses are kept, wrong ones are discarded, and the final text is the same the main model would have written.
DeepSeek Sparse Attention: DeepSeek-V3.2’s new part
In simple words: V3.2 adds a small indexer that picks the 2,048 most relevant earlier tokens for every new word. The main attention then reads only those, which makes very long texts much cheaper.
Think of it like this: Skimming the index of a long book to find the pages that matter and reading only those closely.
DeepSeek-V3.2 keeps everything in V3 except for one addition in each attention layer: a lightning indexer. For the word being written, the indexer scores every earlier token with 64 small heads of 128 numbers each, using a ReLU and learned weights, and in FP8 for speed. The 2,048 best tokens are kept, and MLA attends only to those.
The paper builds DSA on the multi-query form of MLA, because a sparse selection only pays off when many query heads share each cached entry. That is the same form the decoding path of MLA already uses.
It was added to an existing model rather than trained from scratch. The paper starts from DeepSeek-V3.1-Terminus, whose context had already been extended to 128K tokens. A short dense warm-up trains only the indexer to imitate the full attention’s focus, and then 15,000 steps of 480 sequences of 128K tokens, 943.7B tokens in all, train the whole model with the sparse selection switched on.
What it changes is compute, not the cache. The paper says the main attention drops from cost proportional to the square of the text length to length times 2,048. The indexer itself still scores every earlier token, so its cost still grows with the square of the length, but it is much cheaper than the full attention it replaces. The latent cache is unchanged, and the indexer adds a small cache of its own: with 128 FP8 values and one scale per token per layer, our estimate is about 132 bytes, which is 11% on top of the MLA cache.
Go deeper: details for practitioners
- Reference code: the indexer queries come from the compressed query latent through wq_b (1,536→64×128), keys from the layer input through wk (7,168→128) with a LayerNorm, both rotated by a Hadamard transform, quantised to FP8, scored with a per-head weight from weights_proj, and the top min(2048, length) positions are kept. The selection becomes an additive mask on the attention scores.
- The indexer adds about 14.0M parameters per layer, 0.85B across 61 layers, by our arithmetic. The Hugging Face weight totals differ between V3 and V3.2 by about the same amount.
- Besides the indexer, DeepSeek-V3.2 differs from V3 in training, not in layers: the model card describes a scaled reinforcement-learning stage and a large agentic-task synthesis pipeline.
Is this the same as a sliding window?
No. A window always looks at the nearest tokens. The indexer chooses tokens anywhere in the text by learned relevance, so an old but important sentence can still be read.
FP8: the weights ship in eight bits
In simple words: DeepSeek trained the model with 8-bit numbers for most of the heavy arithmetic and ships the weights in 8 bits, so the download is about 641 GiB instead of about 1.3 TB.
Think of it like this: Writing numbers to fewer digits to save paper, with a note on each page saying what scale the digits use so little is lost.
The V3 paper describes an FP8 mixed-precision training framework and reports that it was, to its authors’ knowledge, the first time such training was shown to work on an extremely large model. Most matrix multiplications run in FP8 E4M3 on all tensors, with tile-wise scaling for activations and block-wise scaling for weights, while a few sensitive operations stay in higher precision. On two smaller test models the paper reports a relative loss error of under 0.25% compared with a BF16 baseline.
The checkpoints store the weights in FP8 with one scale per 128×128 block, listed in the configuration as quantization_config with fmt e4m3 and weight_block_size 128×128. Activations are quantised dynamically at run time. The published weights total 641.3 GiB for V3 and R1 and 642.1 GiB for V3.2, counting every shard, including the MTP module. The repository also includes a script to convert the weights to BF16 for experiments.
For scale, 671B weights at one byte each are about 625 GiB; the rest of the download is the multi-token-prediction module, scales and the parts kept in higher precision.
Go deeper: details for practitioners
- V3.2’s configuration adds scale_fmt ue8m0, meaning the block scales are powers of two, and its reference code simulates an FP8 key-value cache; the estimates on this page assume bfloat16 for the cache.
What is E4M3?
An 8-bit floating-point format with 4 exponent bits and 3 mantissa bits. It has little range and little precision, which is why each block of weights carries its own scale.
What is not architecture: DeepSeek-R1 and the distilled models
In simple words: DeepSeek-R1 is built exactly like V3. What makes it a reasoning model is how it was trained afterwards, with reinforcement learning on top of V3-Base.
Think of it like this: Two chefs with the same kitchen and the same recipes, one of whom spent months practising a single technique until it became second nature.
R1 is trained from DeepSeek-V3-Base according to its model card, and its published configuration matches V3’s. Nothing in the layers changed; the difference is in the data and training. The R1 paper describes a first model, R1-Zero, trained with large-scale reinforcement learning and no supervised fine-tuning, and then R1 itself, built in stages: a small set of cold-start examples, reinforcement learning on reasoning tasks, rejection sampling and fine-tuning on the good results, and a last reinforcement-learning stage aligned with human preferences.
The reinforcement-learning algorithm is GRPO, introduced in the DeepSeekMath paper. It scores several answers to the same question against each other, so it needs no separate learned value network.
DeepSeek also released six smaller models distilled from R1: Qwen-based models at 1.5B, 7B, 14B and 32B and Llama-based models at 8B and 70B. These are different, dense architectures with Qwen or Llama layers, not scaled-down copies of V3, so they are outside this guide.
Go deeper: details for practitioners
- The R1 repository’s weight files and configuration are identical in size to V3’s: 684.49B parameters counted by Hugging Face, 641.3 GiB on disk.
What is distillation?
Training a smaller model to imitate a larger one, here by fine-tuning on reasoning text that R1 wrote.
DeepSeek-V3 compared with Gemma 4 and gpt-oss
In simple words: Gemma 4 and gpt-oss save memory by letting most layers look at only a short window. DeepSeek keeps full attention on every layer and instead makes each cached entry tiny.
Think of it like this: Two ways to carry less luggage: pack fewer days of clothes, or vacuum-seal every day.
Attention memory. Gemma 4 and gpt-oss limit how many tokens most layers remember, using a sliding window. DeepSeek-V3 gives every one of its 61 layers full attention over the whole text and shrinks what is stored per token to 576 numbers. At 131,072 tokens our estimate is 9.21 GB for DeepSeek-V3 and 4.84 GB for gpt-oss-120b, which has 36 layers, half of them with a 128-token window. V3.2 then reduces the work, not the memory.
Experts. gpt-oss-120b picks 4 of 128 experts with a softmax over only those 4, with no shared expert. DeepSeek-V3 picks 8 of 256 plus one shared expert, scores them with a sigmoid, limits the choice to 4 of 8 groups and balances load with a bias. Both are pre-norm models with untied output matrices, which differs from Gemma 4’s four norms per layer.
Numbers. All three are mixture-of-experts transformers at heart, but DeepSeek-V3 is far larger: 671B parameters against 116.83B for gpt-oss-120b, with 37B active against 5.13B. Neither guide ranks quality, and this one does not either.
Go deeper: details for practitioners
- gpt-oss ships its expert weights in 4-bit MXFP4; DeepSeek-V3 ships everything in 8-bit FP8 with block scales. See the gpt-oss guide for the 4-bit format.
V3, R1 or V3.2: which one is which
In simple words: All three have the same layers, sizes and experts. R1 is a different training of the V3 base for reasoning. V3.2 adds sparse attention for long texts.
Think of it like this: Three editions of one engine: the original, one tuned for careful step-by-step work, and one with a faster gearbox for long journeys.
DeepSeek-V3 (December 2024) is the general model and the reference for this page. It is released under DeepSeek’s model licence, which the card says supports commercial use, with the code under MIT. DeepSeek-R1 (January 2025) has the same architecture and is MIT-licensed; it writes out a long chain of thought before answering. DeepSeek-V3.2 (December 2025) is MIT-licensed and adds sparse attention. It started from V3.1-Terminus, so it is a later generation of V3 rather than a retrained R1.
Choose by task rather than by architecture: they cost the same to host per token on short inputs, and V3.2 costs less on long ones. The configuration files of V3-0324, R1-0528, V3.1 and V3.1-Terminus match V3’s apart from minor metadata such as the quantisation scale format, and V3.2-Exp’s matches V3.2’s, so what is written here applies to them too; the three models above are the ones we cross-checked against the reference code.
DeepSeek-V4, released in 2026, changes the attention, the residual connections and the routing, so it is a different architecture and is not covered here.
DeepSeek-V3 variants compared
| Spec | DeepSeek-V3 | DeepSeek-R1 | DeepSeek-V3.2 |
|---|---|---|---|
| Parameters | 671B total · 37B active | 671B total · 37B active | 671B total · 37B active |
| Layers | 61 | 61 | 61 |
| Hidden size | 7,168 | 7,168 | 7,168 |
| Normalisation | before each block (pre-norm) | before each block (pre-norm) | before each block (pre-norm) |
| Query heads | 128 | 128 | 128 |
| Attention type | Multi-head latent attention (MLA) | Multi-head latent attention (MLA) | Multi-head latent attention (MLA) |
| Cached per token per layer | 576 values (512 latent + 64 RoPE key) | 576 values (512 latent + 64 RoPE key) | 576 values (512 latent + 64 RoPE key) |
| Latent widths (query / key-value) | 1,536 / 512 | 1,536 / 512 | 1,536 / 512 |
| Per-head sizes (no-RoPE + RoPE / value) | 128 + 64 / 128 | 128 + 64 / 128 | 128 + 64 / 128 |
| Sparse attention | none (every token is read) | none (every token is read) | lightning indexer, top 2,048 tokens (64 heads × 128) |
| Type | Mixture-of-experts | Mixture-of-experts | Mixture-of-experts |
| FFN size | 18,432 | 18,432 | 18,432 |
| Leading dense layers | 3 of 61 | 3 of 61 | 3 of 61 |
| Activation | SwiGLU | SwiGLU | SwiGLU |
| Experts (active / total) | 8 / 256 | 8 / 256 | 8 / 256 |
| Expert size | 2,048 | 2,048 | 2,048 |
| Shared experts | 1 | 1 | 1 |
| Router | sigmoid scores, best 4 of 8 groups, weights × 2.5 | sigmoid scores, best 4 of 8 groups, weights × 2.5 | sigmoid scores, best 4 of 8 groups, weights × 2.5 |
| Load balancing | a per-expert bias steers the choice; no auxiliary loss (a tiny sequence-wise one is added in training) | a per-expert bias steers the choice; no auxiliary loss (a tiny sequence-wise one is added in training) | a per-expert bias steers the choice; no auxiliary loss (a tiny sequence-wise one is added in training) |
| Max context | 163,840 tokens | 163,840 tokens | 163,840 tokens |
| Position encoding | RoPE, base 10,000 + YaRN ×40 (4,096 to 163,840) | RoPE, base 10,000 + YaRN ×40 (4,096 to 163,840) | RoPE, base 10,000 + YaRN ×40 (4,096 to 163,840) |
| Weight precision | FP8 (E4M3) weights with 128×128 block scales | FP8 (E4M3) weights with 128×128 block scales | FP8 (E4M3) weights with 128×128 block scales (power-of-two scales) |
| Published checkpoint size | 641.3 GiB | 641.3 GiB | 642.1 GiB |
| Multi-token prediction | 1 extra token (11.5B parameters in the checkpoint) | 1 extra token (11.5B parameters in the checkpoint) | 1 extra token |
| Tied embeddings | no | no | no |
| Input types | text | text | text |
| Vocabulary | 129,280 | 129,280 | 129,280 |
Frequently asked questions
Is DeepSeek-V3 a dense or a mixture-of-experts model?
DeepSeek-V3 is a mixture-of-experts model. It has 671B total parameters but only 37B are active for each token, because layers 4 to 61 route every token to 8 of 256 experts plus one shared expert. The first three layers are dense.
How many parameters does DeepSeek-V3 activate per token?
About 37B of 671B, roughly 5.5%. The weight documentation counts 36.6B active parameters including the 0.9B output matrix. The Hugging Face download is 685B because it also holds a 14B multi-token-prediction module.
What is multi-head latent attention (MLA)?
MLA is DeepSeek’s attention design that caches one short latent vector per token instead of keys and values for every head. In DeepSeek-V3 that is 576 numbers per token per layer (a 512-wide latent plus a 64-wide rotary key), about 71 times less than plain multi-head attention at the same size.
How big is DeepSeek-V3’s KV cache?
Our estimate is 70,272 bytes per token across all 61 layers in bfloat16, which is about 9.21 GB at 131,072 tokens. Plain multi-head attention at the same size would need about 655 GB. V3.2 adds about 11% for its indexer cache. These are estimates; real inference engines can differ.
What is the context length of DeepSeek-V3?
The model card says 128K tokens, which is what DeepSeek trained and tested to. The configuration allows 163,840 positions because YaRN stretches the original 4,096 by a factor of 40.
How is DeepSeek-R1 different from DeepSeek-V3?
Their architecture is the same: R1’s configuration file is identical to V3’s except for a library version string. R1 was trained from V3-Base with reinforcement learning (GRPO) to reason step by step before answering, so the difference is in training, not in the layers.
What does DeepSeek-V3.2 change?
It adds DeepSeek Sparse Attention: a lightning indexer with 64 heads that picks the best 2,048 earlier tokens for each word, so the main attention reads only those. It started from V3.1-Terminus and is trained with the sparse selection on. The paper reports the core attention cost falls from the square of the text length to length times 2,048.
Does DeepSeek-V3 use multi-token prediction when generating text?
The checkpoint includes the module (11.5B parameters for V3) and the paper says it can be used for speculative decoding, with 85–90% acceptance of the second token and 1.8× faster decoding. DeepSeek’s open reference code does not run it, so whether a given service does depends on its software.
How does DeepSeek-V3 balance its experts without an auxiliary loss?
Each expert has a bias that is added to its score only when choosing which experts to use. After each training step the bias of an overloaded expert is lowered and that of an underloaded one raised. The paper also keeps a very small sequence-wise balance loss, so the penalty is nearly but not entirely absent.
How much memory do the DeepSeek-V3 weights need?
The published FP8 weights are 641.3 GiB for V3 and R1 and 642.1 GiB for V3.2, including the multi-token-prediction module. Add memory for the KV cache and activations on top.
How much did DeepSeek-V3 cost to train?
The paper reports 2.788M H800 GPU hours in total, of which 2.664M were pre-training on 14.8T tokens, and states $5.576M at an assumed $2 per GPU hour. It says this excludes earlier research and ablation experiments.
Are the DeepSeek-R1 distilled models the same architecture?
No. The six distilled models are dense Qwen and Llama models (1.5B to 70B) fine-tuned on text written by R1, so they have those models’ layers, not MLA or mixture-of-experts.
What licence does DeepSeek-V3 use?
The model card says the code is MIT-licensed and the V3 weights are under DeepSeek’s model licence, which supports commercial use. R1 and V3.2 are MIT-licensed.
Sources
Specs last verified November 21, 2026.
- DeepSeek-V3 Technical Report (arXiv:2412.19437)
- DeepSeek-V3 model card
- DeepSeek-V3 config.json
- DeepSeek-V3 weight file documentation (README_WEIGHTS.md)
- DeepSeek-V3 reference implementation (inference/model.py)
- DeepSeek-R1 model card
- DeepSeek-R1 config.json
- DeepSeek-R1 paper (arXiv:2501.12948)
- DeepSeek-V3.2 model card
- DeepSeek-V3.2 config.json
- DeepSeek-V3.2 reference implementation (inference/model.py)
- DeepSeek-V3.2 paper (arXiv:2512.02556)
- DeepSeek-V2 paper, which introduces MLA (arXiv:2405.04434)
- DeepSeekMoE paper (arXiv:2401.06066)
- Auxiliary-loss-free load balancing (arXiv:2408.15664)
- DeepSeekMath paper, which introduces GRPO (arXiv:2402.03300)
- YaRN: efficient context window extension (arXiv:2309.00071)
- Fast inference from transformers via speculative decoding (arXiv:2211.17192)
- DeepSeek API news: release dates