Mistral 7B
Mistral AI · Mistral · open weights
- GQA
- Sliding window
- RoPE
- Pre-norm
Facts and where they come from
| Released | 2023-09 | labmodel cardHF repository created September 2023 |
|---|---|---|
| Licence | apache-2.0 | config.jsonconfig.jsonREADME metadata: license |
| Total parameters | 7B | labmodel cardmodel name Mistral-7B |
| Active parameters | not disclosed | not disclosed |
| Context length | 32K tokens | config.jsonconfig.jsonmax_position_embeddings |
| Norm placement | pre | codemodelling codetransformers 5.18.0 / repo modelling code for mistral: input_layernorm before attention, post_attention_layernorm before the MLP |
| Norm type | RMSNorm | codemodelling codetransformers 5.18.0 / repo modelling code for mistral: input_layernorm before attention, post_attention_layernorm before the MLP |
| QK-norm | no | codemodelling codeno q/k normalisation in the attention block |
| Positional encoding | RoPE | codemodelling coderotary on the full head (default) |
| Parallel attention and MLP | no | codemodelling codetransformers 5.18.0 / repo modelling code for mistral: input_layernorm before attention, post_attention_layernorm before the MLP |
Architecture, drawn from the data
GQA 32q/8kv, window 4096. Each column is one layer: its token mixer above, its feed-forward block below. Paler columns reuse another layer’s keys and values.
Modelled costs
From the cost model, batch size 1. Totals the lab states are in the table above; differences come from rounding, from what a lab counts, or from parts the model does not describe (listed on the about page).
| Parameters (modelled) | 7.24B |
|---|---|
| Active per token (modelled) | 7.24B |
| Without embeddings and output head | 6.98B total, 6.98B active |
| Published weights (Hugging Face count) | 7.24B |
| KV cache per token, BF16 (layers that grow with context) | 0 B |
| KV cache + state at 32K tokens, BF16 | 512 MiB |
| Decode FLOPs per token at 4K context | 16.4 GFLOP |
| Prefill FLOPs for a 4K prompt | 61.6 TFLOP |
KV cache against context
Every architecture field
| Field | Value | Source |
|---|---|---|
| d_model | 4,096 | config.jsonconfig.jsonhidden_size |
| vocab | 32,000 | config.jsonconfig.jsonvocab_size |
| tied_embeddings | false | config.jsonconfig.jsontie_word_embeddings |
| mixers.full.type | attn | codemodelling codeattention block |
| mixers.full.heads | 32 | config.jsonconfig.jsonnum_attention_heads |
| mixers.full.kv_heads | 8 | config.jsonconfig.jsonnum_key_value_heads |
| mixers.full.head_dim | 128 | codemodelling codetransformers 5.18.0: head_dim = hidden_size / num_attention_heads |
| mixers.full.window | 4,096 | config.jsonconfig.jsonsliding_window |
| ffns.dense.type | dense | codemodelling codeMLP block |
| ffns.dense.d_ff | 14,336 | config.jsonconfig.jsonintermediate_size |
| ffns.dense.gated | true | codemodelling codeMLP: gated (SwiGLU/GeGLU) |
| layout | 32× full/dense | config.jsonconfig.jsonnum_hidden_layers |
Sources
- config.json @ 27d67f1
- model card
- arXiv 2310.06825
- modelling code · transformers 5.18.0 modelling code, or the model repository's own modelling file at the pinned revision