BERT-Large
Google · BERT · open weights · encoder
- MHA
- Learned absolute
- Post-LN
Facts and where they come from
| Released | 2018-10 | paperarXiv 1810.04805arXiv v1, October 2018 |
|---|---|---|
| Licence | apache-2.0 | config.jsonconfig.jsonREADME metadata: license |
| Total parameters | 340M | paperarXiv 1810.04805§3: BERT-LARGE (L=24, H=1024, A=16, total parameters=340M) |
| Active parameters | not disclosed | not disclosed |
| Context length | 512 tokens | config.jsonconfig.jsonmax_position_embeddings |
| Norm placement | post-ln | codemodelling codetransformers 5.18.0 bert: LayerNorm after each residual add |
| Norm type | LayerNorm | codemodelling codetransformers 5.18.0 bert: LayerNorm after each residual add |
| QK-norm | no | codemodelling codeno q/k normalisation in the attention block |
| Positional encoding | learned absolute | codemodelling codetransformers 5.18.0 bert: learned absolute position embeddings |
| Parallel attention and MLP | no | codemodelling codetransformers 5.18.0 bert: LayerNorm after each residual add |
Architecture, drawn from the data
MHA 16q/16kv. 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) | 334M |
|---|---|
| Active per token (modelled) | 334M |
| Without embeddings and output head | 302M total, 302M active |
| Published weights (Hugging Face count) | 336M |
| KV cache per token, BF16 (layers that grow with context) | 96 KiB |
| KV cache + state at 512 tokens, BF16 | 48 MiB |
| Decode FLOPs per token at 4K context | 1.07 GFLOP |
| Prefill FLOPs for a 4K prompt | 3.3 TFLOP |
KV cache against context
Every architecture field
| Field | Value | Source |
|---|---|---|
| d_model | 1,024 | config.jsonconfig.jsonhidden_size |
| vocab | 30,522 | config.jsonconfig.jsonvocab_size |
| tied_embeddings | true | codemodelling codeMLM head tied to word embeddings |
| mixers.full.type | attn | codemodelling codeattention block |
| mixers.full.heads | 16 | config.jsonconfig.jsonnum_attention_heads |
| mixers.full.kv_heads | 16 | config.jsonconfig.jsonnum_attention_heads |
| mixers.full.head_dim | 64 | codemodelling codetransformers 5.18.0: head_dim = hidden_size / num_attention_heads |
| mixers.full.bias | true | codemodelling codebiases |
| ffns.dense.type | dense | codemodelling codeMLP block |
| ffns.dense.d_ff | 4,096 | config.jsonconfig.jsonintermediate_size |
| ffns.dense.gated | false | codemodelling codeMLP: two matrices, no gate |
| ffns.dense.bias | true | codemodelling codeMLP has biases |
| layout | 24× full/dense | config.jsonconfig.jsonnum_hidden_layers |
| extra_embedding_params | 526,336 | codemodelling codeposition and token-type embeddings |
Sources
- config.json @ 6da4b6a
- model card
- arXiv 1810.04805
- modelling code · transformers 5.18.0 modelling code, or the model repository's own modelling file at the pinned revision