|
Download README.md from BurnyCoder/transformer-visualized-models: direct link, hf CLI and curl.
- Browser
- Download file 2.14 kB
-
https://huggingface.co/BurnyCoder/transformer-visualized-models/resolve/main/README.md
- Command line
-
hf download hf://BurnyCoder/transformer-visualized-models/README.md
-
curl -L -o README.md https://huggingface.co/BurnyCoder/transformer-visualized-models/resolve/main/README.md
2.14 kB
| license: mit | |
| library_name: transformer-lens | |
| tags: [mechanistic-interpretability, induction-heads, toy-model, transformer-circuits, visualization] | |
| # transformer-visualized: tiny 2-layer transformers (trained, hand-crafted, controls) | |
| Weights for **[transformer-visualized](https://github.com/BurnyCoder/transformer-visualized)**, an interactive, animated visualization of a two-layer | |
| transformer (live site: https://burnycoder.github.io/transformer-visualized/). Every run of the preregistered study is here under `runs/<run_id>/`: | |
| - `final.safetensors`: final weights (TransformerLens 3.9.0 `HookedTransformer` names; biases are zero and omitted) | |
| - `checkpoints/step_*.safetensors`: ~40 log-spaced training checkpoints | |
| - `config.json`: architecture and training spec | |
| - `metrics.jsonl`: validation metrics logged during training | |
| - `eval_val.json` / `eval_test.json`: full evaluation (losses with bootstrap CIs, G, head scores, circuits, ablations) | |
| **Architecture.** 2 layers, 2 heads × 8 dims, ReLU MLP of width 64, d_model = 32, n_ctx = 24, vocabulary of 26 | |
| words; no LayerNorm, zero biases (the simplifications of *A Mathematical Framework for Transformer Circuits*). | |
| **Data.** A toy word grammar (exact bigram chain) in which each later sentence repeats an earlier one with | |
| probability 0.5. The splits are in the companion dataset repo. | |
| **Key results (test set).** Gain fraction G (share of the achievable in-context gain; 0 = bigram oracle, | |
| 1 = Bayes-optimal): main 2-layer model 0.981 [0.971, 0.990] over 5 seeds; hand-crafted 0.853 [0.851, 0.855]. | |
| **Load.** | |
| ```python | |
| from transformer_lens import HookedTransformer, HookedTransformerConfig | |
| from safetensors.torch import load_file | |
| cfg = HookedTransformerConfig(n_layers=2, d_model=32, n_ctx=24, d_head=8, n_heads=2, d_mlp=64, d_vocab=26, | |
| act_fn="relu", normalization_type=None) | |
| model = HookedTransformer(cfg) | |
| model.load_state_dict(load_file("runs/main_s0/final.safetensors"), strict=False) # biases stay zero | |
| ``` | |
| Token ids: see `src/tfviz/grammar.py` in the code repository (0 = `<bos>`, 1 = `.`). | |
| Author: Libor "Burny" Burian. License: MIT. | |