ELBennett commited on
Commit
0568838
·
verified ·
1 Parent(s): 7f15382

Add a checkpoint list and a model-details spec

Browse files
Files changed (1) hide show
  1. README.md +40 -20
README.md CHANGED
@@ -21,11 +21,36 @@ datasets:
21
 
22
  A 16,085,568-parameter recurrent decoder with post-decay pretraining weights. [Weevil-Recurrent-16M-QA](https://huggingface.co/ELBennett/Weevil-Recurrent-16M-QA) is this model fine-tuned for multiple-choice questions.
23
 
24
- Pretraining used 9.75 billion tokens of the first mix, then the entire 750 million-token decay stage. Stored weights are float32.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
- ## Use
27
 
28
- ### Score choices
29
 
30
  ```python
31
  import torch
@@ -37,6 +62,17 @@ model = AutoModelForCausalLM.from_pretrained(
37
  tokenizer = AutoTokenizer.from_pretrained("ELBennett/Weevil-Recurrent-16M-Base")
38
  model.eval()
39
 
 
 
 
 
 
 
 
 
 
 
 
40
  choices = ["cat", "dog"]
41
  prompt = "Which animal barks?\n\nA. cat\nB. dog\nAnswer:"
42
  pause_id = tokenizer.convert_tokens_to_ids("[pause]")
@@ -53,18 +89,9 @@ print(choices[int(scores.argmax())], [round(score, 3) for score in scores.tolist
53
 
54
  The prompt and pauses are prefilled once. Each choice is scored from its own copy of the recurrent state.
55
 
56
- ### Generate
57
-
58
- Continue with the model, tokenizer, and prompt above. Pass unpadded rows: right-padding is consumed by the convolution.
59
-
60
- ```python
61
- prompt_ids = torch.tensor([tokenizer.encode(prompt, add_special_tokens=False)])
62
- print(model.generate(prompt_ids, max_new_tokens=16).shape)
63
- ```
64
-
65
  ### Reuse the recurrent state
66
 
67
- `generate` prefills the GDN2 state and convolution windows, then advances them one token at a time. `past_key_values` and `recurrent_state` refer to the same object: one state matrix and one convolution window per mixer, with a separate copy for every core pass.
68
 
69
  ```python
70
  out = model(prompt_ids, use_cache=True)
@@ -116,13 +143,6 @@ Together that is **10.5 billion** content tokens: 9.75 billion from the first mi
116
 
117
  ## Architecture
118
 
119
- The model is a causal Gated DeltaNet-2 decoder with the same recurrence as the QA fine-tune.
120
-
121
- - Vocabulary: 50,368.
122
- - Factorized embedding: 128.
123
- - Hidden size: 256.
124
- - Stack: 2-layer prelude, 4-layer core, 2-layer coda.
125
-
126
  `core_passes` repeats only the core. Each core pass adds `input_scale * prelude_output` back onto the residual. Each mixer and MLP branch has a 1-lane read/write gate. Next-token logits go back through the factorized embedding. Linears run in bfloat16.
127
 
128
  `[pause]` is token id 50285. It is a special token, so the word "pause" in ordinary text is not rewritten to it. The model does not learn to emit pauses. Put them in the input.
 
21
 
22
  A 16,085,568-parameter recurrent decoder with post-decay pretraining weights. [Weevil-Recurrent-16M-QA](https://huggingface.co/ELBennett/Weevil-Recurrent-16M-QA) is this model fine-tuned for multiple-choice questions.
23
 
24
+ ## Checkpoints
25
+
26
+ | Model | Description |
27
+ |---|---|
28
+ | [ELBennett/Weevil-Recurrent-16M-Base](https://huggingface.co/ELBennett/Weevil-Recurrent-16M-Base) | Post-decay pretraining checkpoint. |
29
+ | [ELBennett/Weevil-Recurrent-16M-QA](https://huggingface.co/ELBennett/Weevil-Recurrent-16M-QA) | The Base checkpoint fine-tuned for multiple-choice questions. |
30
+
31
+ ## Model details
32
+
33
+ | Property | Value |
34
+ |---|---|
35
+ | Parameters | 16,085,568 |
36
+ | Architecture | Causal Gated DeltaNet-2 |
37
+ | Vocabulary | 50,368 |
38
+ | Factorized embedding | 128 |
39
+ | Hidden size | 256 |
40
+ | Stack | 2-layer prelude + 4-layer core + 2-layer coda |
41
+ | Pretraining | 9.75B first-mix tokens + the entire 750M decay stage = 10.5B content tokens |
42
+ | Precision | Float32 stored weights; bfloat16 linears |
43
+ | Pause token | `[pause]`, token id 50285 |
44
+
45
+ ## How to use
46
+
47
+ ```bash
48
+ pip install torch transformers
49
+ ```
50
 
51
+ ### Generate
52
 
53
+ Pass unpadded rows: right-padding is consumed by the convolution.
54
 
55
  ```python
56
  import torch
 
62
  tokenizer = AutoTokenizer.from_pretrained("ELBennett/Weevil-Recurrent-16M-Base")
63
  model.eval()
64
 
65
+ prompt = "The capital of France is"
66
+ prompt_ids = torch.tensor([tokenizer.encode(prompt, add_special_tokens=False)])
67
+ output_ids = model.generate(prompt_ids, max_new_tokens=16)
68
+ print(tokenizer.decode(output_ids[0], skip_special_tokens=True))
69
+ ```
70
+
71
+ ### Score choices
72
+
73
+ Continue with the model and tokenizer above.
74
+
75
+ ```python
76
  choices = ["cat", "dog"]
77
  prompt = "Which animal barks?\n\nA. cat\nB. dog\nAnswer:"
78
  pause_id = tokenizer.convert_tokens_to_ids("[pause]")
 
89
 
90
  The prompt and pauses are prefilled once. Each choice is scored from its own copy of the recurrent state.
91
 
 
 
 
 
 
 
 
 
 
92
  ### Reuse the recurrent state
93
 
94
+ This continues the `prompt_ids` from the scoring example. `generate` prefills the GDN2 state and convolution windows, then advances them one token at a time. `past_key_values` and `recurrent_state` refer to the same object: one state matrix and one convolution window per mixer, with a separate copy for every core pass.
95
 
96
  ```python
97
  out = model(prompt_ids, use_cache=True)
 
143
 
144
  ## Architecture
145
 
 
 
 
 
 
 
 
146
  `core_passes` repeats only the core. Each core pass adds `input_scale * prelude_output` back onto the residual. Each mixer and MLP branch has a 1-lane read/write gate. Next-token logits go back through the factorized embedding. Linears run in bfloat16.
147
 
148
  `[pause]` is token id 50285. It is a special token, so the word "pause" in ordinary text is not rewritten to it. The model does not learn to emit pauses. Put them in the input.