Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -13,66 +13,59 @@ library_name: pytorch
|
|
| 13 |
|
| 14 |
# KB-Diffusion Model B — word-level masked diffusion
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
[KB-Diffusion](https://github.com/PastelRuntime/KB-Diffusion-Optimized)
|
| 19 |
-
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.
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
|
| 34 |
-
##
|
| 35 |
|
| 36 |
-
|
| 37 |
-
5-letter words:
|
| 38 |
|
| 39 |
-
|
|
| 40 |
|---|---|---|
|
| 41 |
-
|
|
| 42 |
-
|
|
| 43 |
-
|
|
| 44 |
-
| Greedy ancestral (no sampling) | 100% | 1/64 ("bales") |
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
rule from corrupted examples" effect, at 8000 classes instead of 4.
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
output depending only on how commitments are made. Coherence is bought
|
| 54 |
-
with iteration, not parameters.
|
| 55 |
-
2. 68.4% of outputs were valid English but only 66.4% came from the training
|
| 56 |
-
list — it generalizes past its vocabulary, producing words it never saw.
|
| 57 |
|
| 58 |
## Usage
|
| 59 |
|
| 60 |
```python
|
| 61 |
import torch
|
| 62 |
-
from
|
| 63 |
|
| 64 |
-
model = Net()
|
| 65 |
-
sd = torch.load("
|
| 66 |
model.load_state_dict(sd)
|
| 67 |
model.eval()
|
| 68 |
-
#
|
| 69 |
```
|
| 70 |
|
| 71 |
-
See the GitHub repo for the full training/eval script and writeup.
|
| 72 |
-
|
| 73 |
## Intended use & limitations
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
| 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 |
|
| 54 |
```python
|
| 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.
|