Update UltraSparse README title
Browse files
README.md
CHANGED
|
@@ -1,108 +1,108 @@
|
|
| 1 |
-
# UltraSparse
|
| 2 |
-
|
| 3 |
-
**UltraSparse
|
| 4 |
-
|
| 5 |
-
A small, reproducible PyTorch language model designed for CPU experimentation. The model combines:
|
| 6 |
-
|
| 7 |
-
1. a ~10M-parameter Transformer,
|
| 8 |
-
2. SentencePiece BPE tokenization,
|
| 9 |
-
3. adaptive depth at inference,
|
| 10 |
-
4. a current-token difficulty head,
|
| 11 |
-
5. a short-horizon future-demand head,
|
| 12 |
-
6. a persistent computation ledger across autoregressive decoding,
|
| 13 |
-
7. strict zero-debt compute control,
|
| 14 |
-
8. matched-budget benchmarking and quality gates.
|
| 15 |
-
|
| 16 |
-
### Important positioning
|
| 17 |
-
|
| 18 |
-
This is an experimental/educational language model, not a state-of-the-art LLM and not instruction tuned. The persistent computation ledger is a project design feature; do not describe it as novel without a formal literature review.
|
| 19 |
-
|
| 20 |
-
## Build
|
| 21 |
-
|
| 22 |
-
```powershell
|
| 23 |
-
python -m pip install -r requirements.txt
|
| 24 |
-
|
| 25 |
-
python train_tokenizer.py `
|
| 26 |
-
--text data\corpus.txt `
|
| 27 |
-
--out artifacts\tokenizer `
|
| 28 |
-
--vocab-size 1024
|
| 29 |
-
|
| 30 |
-
python train.py `
|
| 31 |
-
--text data\corpus.txt `
|
| 32 |
-
--tokenizer artifacts\tokenizer.model `
|
| 33 |
-
--steps 20000 `
|
| 34 |
-
--batch-size 2 `
|
| 35 |
-
--seq-len 256 `
|
| 36 |
-
--threads 8 `
|
| 37 |
-
--out results\ultrasparse_v4_10m.pt
|
| 38 |
-
```
|
| 39 |
-
|
| 40 |
-
### First do a smoke test
|
| 41 |
-
|
| 42 |
-
```powershell
|
| 43 |
-
python train.py --steps 20 --batch-size 1 --seq-len 64 --threads 4 `
|
| 44 |
-
--out results\smoke_v4.pt
|
| 45 |
-
|
| 46 |
-
python -m pytest -q
|
| 47 |
-
```
|
| 48 |
-
|
| 49 |
-
Do not start a 20k-step CPU run until the smoke test passes.
|
| 50 |
-
|
| 51 |
-
## Evaluate
|
| 52 |
-
|
| 53 |
-
```powershell
|
| 54 |
-
python evaluate.py `
|
| 55 |
-
--checkpoint results\ultrasparse_v4_10m.pt `
|
| 56 |
-
--text data\corpus.txt
|
| 57 |
-
|
| 58 |
-
python quality_gate.py `
|
| 59 |
-
--checkpoint results\ultrasparse_v4_10m.pt
|
| 60 |
-
```
|
| 61 |
-
|
| 62 |
-
## Generate
|
| 63 |
-
|
| 64 |
-
```powershell
|
| 65 |
-
python generate.py `
|
| 66 |
-
--checkpoint results\ultrasparse_v4_10m.pt `
|
| 67 |
-
--prompt "It was a beautiful morning" `
|
| 68 |
-
--tokens 150 `
|
| 69 |
-
--policy predictive_ledger `
|
| 70 |
-
--temperature 0.8 `
|
| 71 |
-
--top-k 40 `
|
| 72 |
-
--top-p 0.9
|
| 73 |
-
```
|
| 74 |
-
|
| 75 |
-
## Benchmark
|
| 76 |
-
|
| 77 |
-
```powershell
|
| 78 |
-
python benchmark.py `
|
| 79 |
-
--checkpoint results\ultrasparse_v4_10m.pt `
|
| 80 |
-
--tokens 128 `
|
| 81 |
-
--threads 8
|
| 82 |
-
```
|
| 83 |
-
|
| 84 |
-
Benchmark every policy at the same budget. Report quality and compute together; never claim a speed improvement from a single timing run.
|
| 85 |
-
|
| 86 |
-
## Release checklist
|
| 87 |
-
|
| 88 |
-
- [ ] tokenizer artifact committed
|
| 89 |
-
- [ ] checkpoint loads from a clean environment
|
| 90 |
-
- [ ] tests pass
|
| 91 |
-
- [ ] quality gate passes
|
| 92 |
-
- [ ] train/validation/test split documented
|
| 93 |
-
- [ ] benchmark JSON committed
|
| 94 |
-
- [ ] parameter count measured
|
| 95 |
-
- [ ] CPU hardware and thread count recorded
|
| 96 |
-
- [ ] training corpus provenance recorded
|
| 97 |
-
- [ ] model card states limitations
|
| 98 |
-
- [ ] no API keys or secrets in repository
|
| 99 |
-
|
| 100 |
-
\n## Senior-engineering design decisions\n\n
|
| 101 |
-
- **RoPE instead of a learned absolute position table:** avoids the old positional-index failure mode when context is clipped and keeps positional parameters out of the model.
|
| 102 |
-
- **Pre-normalized residual blocks:** stable training and clean layer-prefix execution.
|
| 103 |
-
- **Tied input/output embeddings:** reduces parameters and keeps the small model focused on transformer capacity.
|
| 104 |
-
- **First-block probe + continuation:** the adaptive inference path does not intentionally execute the first block twice.
|
| 105 |
-
- **Zero-debt ledger:** a policy cannot borrow future compute; overspend attempts are counted and forced down to the highest legal depth.
|
| 106 |
-
- **Separate v3 baseline:** the old byte-token model remains useful as a historical baseline; v4 is trained from scratch because changing tokenization changes the embedding/output shapes.
|
| 107 |
-
- **Reproducibility first:** fixed seeds, saved tokenizer, config, optimizer/scheduler state, benchmark JSON, and quality gate.
|
| 108 |
|
|
|
|
| 1 |
+
# UltraSparse
|
| 2 |
+
|
| 3 |
+
**UltraSparse — CPU adaptive causal language model**
|
| 4 |
+
|
| 5 |
+
A small, reproducible PyTorch language model designed for CPU experimentation. The model combines:
|
| 6 |
+
|
| 7 |
+
1. a ~10M-parameter Transformer,
|
| 8 |
+
2. SentencePiece BPE tokenization,
|
| 9 |
+
3. adaptive depth at inference,
|
| 10 |
+
4. a current-token difficulty head,
|
| 11 |
+
5. a short-horizon future-demand head,
|
| 12 |
+
6. a persistent computation ledger across autoregressive decoding,
|
| 13 |
+
7. strict zero-debt compute control,
|
| 14 |
+
8. matched-budget benchmarking and quality gates.
|
| 15 |
+
|
| 16 |
+
### Important positioning
|
| 17 |
+
|
| 18 |
+
This is an experimental/educational language model, not a state-of-the-art LLM and not instruction tuned. The persistent computation ledger is a project design feature; do not describe it as novel without a formal literature review.
|
| 19 |
+
|
| 20 |
+
## Build
|
| 21 |
+
|
| 22 |
+
```powershell
|
| 23 |
+
python -m pip install -r requirements.txt
|
| 24 |
+
|
| 25 |
+
python train_tokenizer.py `
|
| 26 |
+
--text data\corpus.txt `
|
| 27 |
+
--out artifacts\tokenizer `
|
| 28 |
+
--vocab-size 1024
|
| 29 |
+
|
| 30 |
+
python train.py `
|
| 31 |
+
--text data\corpus.txt `
|
| 32 |
+
--tokenizer artifacts\tokenizer.model `
|
| 33 |
+
--steps 20000 `
|
| 34 |
+
--batch-size 2 `
|
| 35 |
+
--seq-len 256 `
|
| 36 |
+
--threads 8 `
|
| 37 |
+
--out results\ultrasparse_v4_10m.pt
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
### First do a smoke test
|
| 41 |
+
|
| 42 |
+
```powershell
|
| 43 |
+
python train.py --steps 20 --batch-size 1 --seq-len 64 --threads 4 `
|
| 44 |
+
--out results\smoke_v4.pt
|
| 45 |
+
|
| 46 |
+
python -m pytest -q
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
Do not start a 20k-step CPU run until the smoke test passes.
|
| 50 |
+
|
| 51 |
+
## Evaluate
|
| 52 |
+
|
| 53 |
+
```powershell
|
| 54 |
+
python evaluate.py `
|
| 55 |
+
--checkpoint results\ultrasparse_v4_10m.pt `
|
| 56 |
+
--text data\corpus.txt
|
| 57 |
+
|
| 58 |
+
python quality_gate.py `
|
| 59 |
+
--checkpoint results\ultrasparse_v4_10m.pt
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
## Generate
|
| 63 |
+
|
| 64 |
+
```powershell
|
| 65 |
+
python generate.py `
|
| 66 |
+
--checkpoint results\ultrasparse_v4_10m.pt `
|
| 67 |
+
--prompt "It was a beautiful morning" `
|
| 68 |
+
--tokens 150 `
|
| 69 |
+
--policy predictive_ledger `
|
| 70 |
+
--temperature 0.8 `
|
| 71 |
+
--top-k 40 `
|
| 72 |
+
--top-p 0.9
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
## Benchmark
|
| 76 |
+
|
| 77 |
+
```powershell
|
| 78 |
+
python benchmark.py `
|
| 79 |
+
--checkpoint results\ultrasparse_v4_10m.pt `
|
| 80 |
+
--tokens 128 `
|
| 81 |
+
--threads 8
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
Benchmark every policy at the same budget. Report quality and compute together; never claim a speed improvement from a single timing run.
|
| 85 |
+
|
| 86 |
+
## Release checklist
|
| 87 |
+
|
| 88 |
+
- [ ] tokenizer artifact committed
|
| 89 |
+
- [ ] checkpoint loads from a clean environment
|
| 90 |
+
- [ ] tests pass
|
| 91 |
+
- [ ] quality gate passes
|
| 92 |
+
- [ ] train/validation/test split documented
|
| 93 |
+
- [ ] benchmark JSON committed
|
| 94 |
+
- [ ] parameter count measured
|
| 95 |
+
- [ ] CPU hardware and thread count recorded
|
| 96 |
+
- [ ] training corpus provenance recorded
|
| 97 |
+
- [ ] model card states limitations
|
| 98 |
+
- [ ] no API keys or secrets in repository
|
| 99 |
+
|
| 100 |
+
\n## Senior-engineering design decisions\n\n
|
| 101 |
+
- **RoPE instead of a learned absolute position table:** avoids the old positional-index failure mode when context is clipped and keeps positional parameters out of the model.
|
| 102 |
+
- **Pre-normalized residual blocks:** stable training and clean layer-prefix execution.
|
| 103 |
+
- **Tied input/output embeddings:** reduces parameters and keeps the small model focused on transformer capacity.
|
| 104 |
+
- **First-block probe + continuation:** the adaptive inference path does not intentionally execute the first block twice.
|
| 105 |
+
- **Zero-debt ledger:** a policy cannot borrow future compute; overspend attempts are counted and forced down to the highest legal depth.
|
| 106 |
+
- **Separate v3 baseline:** the old byte-token model remains useful as a historical baseline; v4 is trained from scratch because changing tokenization changes the embedding/output shapes.
|
| 107 |
+
- **Reproducibility first:** fixed seeds, saved tokenizer, config, optimizer/scheduler state, benchmark JSON, and quality gate.
|
| 108 |
|