mjerge commited on
Commit
1078a5f
Β·
verified Β·
1 Parent(s): 209ab40

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +96 -20
README.md CHANGED
@@ -1,42 +1,118 @@
1
  ---
2
  license: mit
3
- language: [code]
4
- tags: [poisson-attention, sphere, code-generation, research]
 
 
 
 
 
 
 
 
 
 
5
  ---
6
 
7
  # POET-124M
8
 
9
- 124M params, seq 512 β€” scaling rung 2
10
 
11
- **POET (Poisson Attention Transformer)** replaces softmax attention with
12
- the closed-form spherical Poisson kernel over queries/keys on the unit
13
- hypersphere (learnable per-head radius, RoPE, query-norm sharpness).
14
- Research checkpoint from [spherical-attention](https://github.com/mmjerge/spherical-attention); custom
15
- architecture β€” **not** `transformers`-compatible.
16
 
17
- ## Results (paired evals, matched params/data, Python code, 983M tokens)
 
 
18
 
19
- - Beats GPT-2-class baselines by ~3% ppl (zβ‰ˆ70, 3 seeds)
20
- - Parity-to-ahead vs Llama-class recipes (RMSNorm/SwiGLU/RoPE)
21
- - Trains stably at long context where the GPT-2 recipe diverges
22
- - Budgeted sparse attention: ~2% ppl cost at 7% of prefix keys, with
23
- per-query certificates (Spearman rho=0.88 vs true error)
24
 
25
- Full experiment log: https://github.com/mmjerge/spherical-attention/blob/main/EXPERIMENTS.md
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  ## Usage
28
 
 
 
 
 
29
  ```python
30
- # pip install git+https://github.com/mmjerge/spherical-attention
31
  from sphere_attention.hub import load_poet
 
32
  model = load_poet("Grayblock-AI/POET-124M")
 
 
 
 
33
  ```
34
 
35
- ## Caveats
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
- Small research model (one domain: Python; single training run per config
38
- unless noted). Scaling studies in progress. Not instruction-tuned; raw
39
- next-token code model.
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  ## Config
42
 
 
1
  ---
2
  license: mit
3
+ language:
4
+ - code
5
+ library_name: sphere-attention
6
+ tags:
7
+ - poisson-attention
8
+ - hypersphere
9
+ - code-generation
10
+ - long-context
11
+ - sparse-attention
12
+ - research
13
+ datasets:
14
+ - codeparrot/codeparrot-clean
15
  ---
16
 
17
  # POET-124M
18
 
19
+ 124M-parameter POET (GPT-2 small size) β€” the scaling-trend checkpoint: the advantage grows, not shrinks, with size.
20
 
21
+ ## Results
 
 
 
 
22
 
23
+ Second rung of the scaling study, parameter-matched to a GPT-2-style
24
+ baseline (123.62M vs 124.01M total; 85.02M non-embedding each), same 983M
25
+ tokens and schedule.
26
 
27
+ | scale | baseline best ppl | POET | paired margin |
28
+ |---|---|---|---|
29
+ | 51M | 2.938 | 2.828 | βˆ’2.9% (z = βˆ’68) |
30
+ | **124M (this model)** | **2.72** | **2.75 final / 2.60 EMA** | **βˆ’3.3% (z = βˆ’74)** |
 
31
 
32
+ The margin **held and slightly grew** across a 2.4x size jump β€” the opposite
33
+ of the usual pattern for efficient-attention variants, which tend to fade
34
+ with scale. A 354M rung is in progress.
35
+
36
+ **Recipe:** dim 768 / depth 12 / heads 12, seq 512, lr 6e-4, 60k steps,
37
+ selective weight decay, EMA 0.999.
38
+
39
+ ## What POET is
40
+
41
+ **POET (POisson attEntion Transformer)** replaces softmax attention with the
42
+ closed-form **spherical Poisson kernel**. Queries and keys are L2-retracted
43
+ onto the unit hypersphere and scored by
44
+
45
+ ```
46
+ P_r(<q,k>) = (1 - r^2) / (1 - 2 r <q,k> + r^2)^(d/2)
47
+ ```
48
+
49
+ with a **learnable per-head radius** `r` (resolution, replacing
50
+ temperature), rotary positions (rotations are isometries of the sphere), and
51
+ a QUEST-style query-norm sharpness term. Equivalently, each attention weight
52
+ is the *harmonic measure* of where a random walk started at the query's
53
+ interior point first exits the sphere at that key.
54
+
55
+ Because keys live on a sphere, attention admits a geodesic **cap
56
+ decomposition** that supports budgeted sparse attention with closed-form
57
+ **per-query error certificates**.
58
+
59
+ Architecture is otherwise a standard pre-LN transformer (GELU MLP, tied
60
+ embeddings, GPT-2 BPE). Custom code β€” **not** `transformers`-compatible.
61
 
62
  ## Usage
63
 
64
+ ```bash
65
+ pip install git+https://github.com/Grayblock-AI/spherical-attention
66
+ ```
67
+
68
  ```python
69
+ import torch, tiktoken
70
  from sphere_attention.hub import load_poet
71
+
72
  model = load_poet("Grayblock-AI/POET-124M")
73
+ enc = tiktoken.get_encoding("gpt2")
74
+ ids = torch.tensor([enc.encode_ordinary("def quicksort(arr):")])
75
+ out = model.generate(ids, max_new_tokens=64, top_k=20)
76
+ print(enc.decode(out[0].tolist()))
77
  ```
78
 
79
+ ## Training data
80
+
81
+ `codeparrot/codeparrot-clean` (permissively licensed Python), GPT-2 BPE.
82
+ The long-context variants use **repository-grouped packing**: files from the
83
+ same repo are packed contiguously so long sequences contain genuine
84
+ cross-file structure (imports, call sites, definitions).
85
+
86
+ ## Limitations
87
+
88
+ - **Research checkpoint, small scale.** Not instruction-tuned; a raw
89
+ next-token model. Python only.
90
+ - Trained on ~983M tokens, which is under compute-optimal for the larger
91
+ sizes β€” absolute perplexities are compressed, though all comparisons in
92
+ the results are matched arm-for-arm.
93
+ - Exact long-range identifier retrieval is near-zero at these model sizes
94
+ (for POET *and* all baselines) β€” a capacity limit, not architecture.
95
+ - Sparse-attention certificates are sound (coverage 1.0) but conservative
96
+ in the tail; see `POET-51M-certified` for the regularized variant and the
97
+ gating mechanism that bounds the tail operationally.
98
+ - Poisson attention has no fused kernel yet, so wall-clock is ~2x a
99
+ flash-attention baseline at equal FLOPs.
100
 
101
+ ## Links
102
+
103
+ - Code, full experiment log, paper draft: https://github.com/Grayblock-AI/spherical-attention
104
+ - Experiment log: https://github.com/Grayblock-AI/spherical-attention/blob/main/EXPERIMENTS.md
105
+
106
+ ## Citation
107
+
108
+ ```bibtex
109
+ @misc{poet2026,
110
+ title = {POET: Poisson Attention Transformers with Certified Sparsity on the Hypersphere},
111
+ author = {Jerge, Michael},
112
+ year = {2026},
113
+ url = {https://github.com/Grayblock-AI/spherical-attention}
114
+ }
115
+ ```
116
 
117
  ## Config
118