PastelRuntime commited on
Commit
e77f2db
Β·
verified Β·
1 Parent(s): 8ca186e

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +36 -29
README.md CHANGED
@@ -13,41 +13,48 @@ library_name: pytorch
13
 
14
  # KB-Diffusion Model B β€” word-level masked diffusion
15
 
16
- Masked diffusion language models trained on 8,000 five-letter English
17
- words. The "generalization companion" experiment from
18
  [KB-Diffusion](https://github.com/PastelRuntime/KB-Diffusion-Optimized)
19
  (an educational masked-diffusion project by Bijan Bowen / OminousIndustries):
20
  swap the repo's four keyboard layouts for thousands of words and see if the
21
  same recipe still works. It does β€” and iterating on decoding strategy turned
22
- out to matter more than more parameters.
 
23
 
24
- Two checkpoints, same LLaDA-style recipe (t ~ U(0.05, 1) masking, 1/t-weighted
25
  CE, bidirectional transformer, no causal mask):
26
 
27
- | | v2 | v3 |
28
- |---|---|---|
29
- | Params | 4.75M (6 layers) | 6.33M (8 layers) |
30
- | Steps | 8,000 | 12,000 + cosine LR |
31
- | Best valid English | 95.5% | **98.4%** |
32
- | Unique words / 512 | 409 | **428** |
33
- | Unigram TV vs exact Bayes | 0.0374 | **0.0135** |
34
 
35
- ## The headline finding
36
 
37
- Identical v2 weights, different decoding:
 
 
38
 
39
- | Decoding | Valid English | Cost (passes) |
40
- |---|---|---|
41
- | Ancestral, temperature 1.0 | 68.8% | 5 |
42
- | Ancestral, temperature 0.5 | **95.5%** | 5 |
43
- | Revision-capable (re-mask weak commits) | 77.1% | 22.5 |
44
 
45
- A 27-point validity jump from temperature alone, at zero extra compute. The
46
- sampler is half the model β€” twice over.
 
 
 
 
47
 
48
- Full methodology, negative results (revision sampling not worth it at N=5;
49
- rare-prefix Bayes tracking degrades), prompting study, and per-sampler
50
- tables: see `docs/model-b.md` in the GitHub repo.
 
 
 
51
 
52
  ## Usage
53
 
@@ -55,17 +62,17 @@ tables: see `docs/model-b.md` in the GitHub repo.
55
  import torch
56
  from model_b_word_diffusion_v3 import Net, CH, MASK, N # from the GitHub repo
57
 
58
- model = Net(layers=8) # v3
59
  sd = torch.load("modelb_v3.pt", map_location="cpu", weights_only=True)
60
  model.load_state_dict(sd)
61
  model.eval()
62
- # ancestral confidence-commit sampler, temperature 0.5 β€” see repo script
63
  ```
64
 
65
  ## Intended use & limitations
66
 
67
- Educational artifact, not a production model: 27-token vocab, 5-position
68
  sequences. It exists to make the masked-diffusion mechanism (parallel
69
- prediction, confidence commits, re-masking, posterior sharpening)
70
- measurable β€” and to show how much decoding strategy contributes to
71
- generation quality on frozen weights.
 
13
 
14
  # KB-Diffusion Model B β€” word-level masked diffusion
15
 
16
+ Masked diffusion language models trained on English words. The
17
+ "generalization companion" experiment from
18
  [KB-Diffusion](https://github.com/PastelRuntime/KB-Diffusion-Optimized)
19
  (an educational masked-diffusion project by Bijan Bowen / OminousIndustries):
20
  swap the repo's four keyboard layouts for thousands of words and see if the
21
  same recipe still works. It does β€” and iterating on decoding strategy turned
22
+ out to matter as much as architecture, with sequence length flipping which
23
+ sampler wins.
24
 
25
+ Three checkpoints, same LLaDA-style recipe (t ~ U(0.05, 1) masking, 1/t-weighted
26
  CE, bidirectional transformer, no causal mask):
27
 
28
+ | | v2 (N=5) | v3 (N=5) | N=10 |
29
+ |---|---|---|---|
30
+ | Params | 4.75M (6 layers) | 6.33M (8 layers) | 6.34M (8 layers) |
31
+ | Steps | 8,000 | 12,000 + cosine LR | 12,000 + cosine LR |
32
+ | Best valid English | 95.5% (T=0.5) | **98.4%** (T=0.5) | 74.2% (revision + T=0.5) |
33
+ | Unique words / 512 | 409 | **428** | 200 |
34
+ | Unigram TV vs exact Bayes | 0.0374 | **0.0135** | 0.019 |
35
 
36
+ ## The headline findings
37
 
38
+ **1. Temperature is the free win** (v2, frozen weights): ancestral sampling
39
+ at T=1.0 gives 68.8% valid English; T=0.5 gives 95.5%. Same weights, same
40
+ 5 forward passes, +27 points.
41
 
42
+ **2. Decoding strategy > extra parameters**: v2 read well (95.5%) beats v3
43
+ read poorly (82.6% at T=1.0).
 
 
 
44
 
45
+ **3. Sequence length flips the sampler winner.** At N=5, revision-capable
46
+ sampling (un-commit weak letters, re-mask, retry) *loses* to plain
47
+ low-temperature sampling (77.1% vs 95.5%). At N=10 it *wins* (74.2% vs
48
+ 63.3%) β€” early mistakes poison enough downstream positions that
49
+ un-committing them pays for its 4x compute. The "diffusion can revise"
50
+ capability has a measured regime where it wins.
51
 
52
+ **4. The parallel/iterative gap explodes with length**: one-shot sampling
53
+ falls 2.0% (N=5) β†’ 0.0% of 512 samples (N=10). This is why real diffusion
54
+ LMs commit few tokens at a time.
55
+
56
+ Full methodology, negative results, and per-sampler tables: `docs/model-b.md`
57
+ in the GitHub repo.
58
 
59
  ## Usage
60
 
 
62
  import torch
63
  from model_b_word_diffusion_v3 import Net, CH, MASK, N # from the GitHub repo
64
 
65
+ model = Net(layers=8) # v3; use model_b_word_diffusion_n10.py for N=10
66
  sd = torch.load("modelb_v3.pt", map_location="cpu", weights_only=True)
67
  model.load_state_dict(sd)
68
  model.eval()
69
+ # ancestral confidence-commit sampler, temperature 0.5 β€” see repo scripts
70
  ```
71
 
72
  ## Intended use & limitations
73
 
74
+ Educational artifact, not a production model: 27-token vocab, 5/10-position
75
  sequences. It exists to make the masked-diffusion mechanism (parallel
76
+ prediction, confidence commits, re-masking, revision, posterior sharpening)
77
+ measurable β€” and to map how decoding strategy and sequence length interact
78
+ on frozen weights.