hbfreed commited on
Commit
9317eec
·
verified ·
1 Parent(s): a0db8da

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +11 -15
README.md CHANGED
@@ -15,9 +15,9 @@ pipeline_tag: text-generation
15
 
16
  # flex-general-2048
17
 
18
- A pruned and distilled variant of [allenai/Flex-math-2x7B-1T](https://huggingface.co/allenai/Flex-math-2x7B-1T) with a variable-width expert MLP. Expert 1 has been pruned from the full 11,008 intermediate size down to **2048** (19% of original width), then recovered via knowledge distillation.
19
 
20
- Unlike the [math-calibrated variants](https://huggingface.co/hbfreed/flex-math-2048), this model's pruning was calibrated on **general-purpose data** — meaning importance scores were computed on a broad data mix rather than math-specific data.
21
 
22
  | | |
23
  |---|---|
@@ -25,6 +25,7 @@ Unlike the [math-calibrated variants](https://huggingface.co/hbfreed/flex-math-2
25
  | **Expert 1 Parameters** | 0.8B |
26
  | **Expert 1 Width** | 2048 (19%) |
27
  | **Base Model** | allenai/Flex-math-2x7B-1T (11.6B params) |
 
28
 
29
  For full details, see the [blog post](https://hbfreed.com/2026/01/28/variable-flexolmo.html).
30
 
@@ -38,8 +39,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
38
  model = AutoModelForCausalLM.from_pretrained("hbfreed/flex-general-2048", trust_remote_code=True)
39
  tokenizer = AutoTokenizer.from_pretrained("allenai/Flex-math-2x7B-1T")
40
 
41
- input_text = "Solve: What is 15% of 200?"
42
- inputs = tokenizer(input_text, return_tensors="pt")
43
  outputs = model.generate(**inputs, max_new_tokens=256)
44
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
45
  ```
@@ -49,20 +49,16 @@ The tokenizer is the same as the base model's.
49
  ## How It Was Made
50
 
51
  1. **Structured pruning**: Neuron importance scores were computed on general-purpose data. The least important neurons in Expert 1's gate/up/down projections were removed, reducing intermediate size from 11,008 to 2048.
52
- 2. **Knowledge distillation**: The pruned model was retrained using logprobs from the full-sized teacher model.
53
-
54
- Note: 58% of the top-2048 neurons differ between general-calibrated and math-calibrated importance rankings, showing that calibration dataset matters significantly for pruning decisions.
55
 
56
  ## Related Models
57
 
58
- | Model | Total Params | Expert Width |
59
- |---|---|---|
60
- | [flex-general-8192](https://huggingface.co/hbfreed/flex-general-8192) | 10.5B | 8192 (74%) |
61
- | [flex-general-5504](https://huggingface.co/hbfreed/flex-general-5504) | 9.5B | 5504 (50%) |
62
- | [flex-general-2048](https://huggingface.co/hbfreed/flex-general-2048) | 8.1B | 2048 (19%) |
63
-
64
- Math-calibrated variants with benchmark results are also available:
65
- - [flex-math-8192](https://huggingface.co/hbfreed/flex-math-8192) | [flex-math-5504](https://huggingface.co/hbfreed/flex-math-5504) | [flex-math-2048](https://huggingface.co/hbfreed/flex-math-2048)
66
 
67
  ## License
68
 
 
15
 
16
  # flex-general-2048
17
 
18
+ A pruned and partially distilled variant of [allenai/Flex-math-2x7B-1T](https://huggingface.co/allenai/Flex-math-2x7B-1T) with a variable-width expert MLP. Expert 1 has been pruned from the full 11,008 intermediate size down to **2048** (19% of original width), then partially recovered via knowledge distillation.
19
 
20
+ Unlike the [math-calibrated variant](https://huggingface.co/hbfreed/flex-math-2048), this model's pruning was calibrated on **general-purpose data** — meaning importance scores were computed on a broad data mix rather than math-specific data. 58% of the top-2048 most important neurons differ between the two calibration approaches.
21
 
22
  | | |
23
  |---|---|
 
25
  | **Expert 1 Parameters** | 0.8B |
26
  | **Expert 1 Width** | 2048 (19%) |
27
  | **Base Model** | allenai/Flex-math-2x7B-1T (11.6B params) |
28
+ | **Distillation** | Partial (~20k steps, stopped early) |
29
 
30
  For full details, see the [blog post](https://hbfreed.com/2026/01/28/variable-flexolmo.html).
31
 
 
39
  model = AutoModelForCausalLM.from_pretrained("hbfreed/flex-general-2048", trust_remote_code=True)
40
  tokenizer = AutoTokenizer.from_pretrained("allenai/Flex-math-2x7B-1T")
41
 
42
+ inputs = tokenizer("Hello, world!", return_tensors="pt")
 
43
  outputs = model.generate(**inputs, max_new_tokens=256)
44
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
45
  ```
 
49
  ## How It Was Made
50
 
51
  1. **Structured pruning**: Neuron importance scores were computed on general-purpose data. The least important neurons in Expert 1's gate/up/down projections were removed, reducing intermediate size from 11,008 to 2048.
52
+ 2. **Partial knowledge distillation**: The pruned model was partially retrained (~20k steps) using logprobs from the full-sized teacher model. Training was stopped early — the general-calibrated model converged slower and to a higher loss than the math-calibrated variant.
 
 
53
 
54
  ## Related Models
55
 
56
+ | Model | Calibration | Expert Width | Distillation |
57
+ |---|---|---|---|
58
+ | [flex-math-8192](https://huggingface.co/hbfreed/flex-math-8192) | Math | 8192 (74%) | Full |
59
+ | [flex-math-5504](https://huggingface.co/hbfreed/flex-math-5504) | Math | 5504 (50%) | Full |
60
+ | [flex-math-2048](https://huggingface.co/hbfreed/flex-math-2048) | Math | 2048 (19%) | Full |
61
+ | **flex-general-2048** | **General** | **2048 (19%)** | **Partial** |
 
 
62
 
63
  ## License
64