File size: 2,089 Bytes
8246b15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Falcon-H1-Tiny-90M scripts

All scripts expect to run inside a folder that holds the official files from https://huggingface.co/tiiuae/Falcon-H1-Tiny-90M-Instruct (`model.safetensors`, `config.json`, `tokenizer.json`, `tokenizer_config.json`, `special_tokens_map.json`, `generation_config.json`, `chat_template.jinja`) and `shakes.txt` (Tiny Shakespeare, public domain). Run `bash get_data.sh` there to fetch them. Needs `torch`, `transformers`, `safetensors`, `numpy`. The box used had 2 GB RAM: run one heavy job at a time.

The Falcon weights are under the TII Falcon-LLM license (https://falconllm.tii.ae/falcon-terms-and-conditions.html). This repository does not contain them.

| File | What it does |
|---|---|
| `widen.py` | exact widening of five axes: MLP, attention heads (GQA), Mamba heads, Mamba d_state, residual stream. `load()` and `build()` helpers |
| `t4.py` | greedy Q&A with the original and widened models (`python t4.py orig` / `inner_k2` / `res_k3`; see `run4.sh`) |
| `rt.py`, `rt2.py`, `shrink.py` | round-trip checks: widen then shrink, count differing weight elements |
| `train.py`, `runtrain*.sh` | the small early training-capacity experiment (dead copies, symmetry-breaking noise). Kept for provenance only, not part of the current zero-training scope |
| `prune.py` | importance / random / merge pruning on MLP, Mamba heads, attention heads; job format `axis:method:rate` |
| `clust.py`, `clust2.py` | k-means (weights, activations), refit, interpolation, SVD, Q4; round-trip error per layer |
| `clust3.py` | Q8 and Q4 combined with pruning, duplicate counts |
| `clust4.py` | ordered interpolation (nearest-neighbor chain, PCA; hard and soft binning) |
| `samples.py` | side-by-side greedy generations, original vs pruned 25% + Q8 |
| `heat.py` | energy map figure from `importance_scores_S.pt` (here `results/`) |
| `mktables.py`, `show.py` | turn the jsonl results into the tables used in the papers |

Important: for generation tests use the model's own `generation_config`, otherwise a model built from config alone does not stop at the end token.