Instructions to use baya1116/hypernet-sp-distill with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use baya1116/hypernet-sp-distill with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download baya1116/hypernet-sp-distill --local-dir hypernet-sp-distill
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Download RESULTS.md from baya1116/hypernet-sp-distill: direct link, hf CLI and curl.
- Browser
- Download file 4.91 kB
-
https://huggingface.co/baya1116/hypernet-sp-distill/resolve/main/RESULTS.md
- Command line
-
hf download hf://baya1116/hypernet-sp-distill/RESULTS.md
-
curl -L -o RESULTS.md https://huggingface.co/baya1116/hypernet-sp-distill/resolve/main/RESULTS.md
Results & verification
All local runs use the MLX 4-bit model (fft_mlx4, 1 GB) + the fp32 pooler, on an 8 GB MacBook
at ~36 tok/s. The PyTorch/MPS fp16 path also works but swaps on 8 GB (2β5 s/tok) β MLX 4-bit is ~180Γ
faster here. Sampling is temp=0.6 unless noted.
1. The MLX port is faithful
pooler_mlx.pyis a manual MLX re-implementation of the PyTorchAttnPoolSP(packed-QKV attention, head-averaged mass for eviction). Verified against the original on random input: SP max abs diff = 2.4e-7, eviction-mass correlation = 1.0.- The base LLM is converted to MLX 4-bit (4.5 bits/weight) and generates coherently β the FFT weights survive quantisation.
2. Single-turn reasoning battery (sp_mlx.py)
Six word problems, auto-graded on the boxed final answer, bounded SP-evict path:
| problem | answer | result |
|---|---|---|
| 30 animals / 74 legs | 23 chickens, 7 cows | β |
| Natalia clips (48 + half) | 72 | β |
| train 60 km / 1.5 h β 4 h | 160 km | β |
| 17 Γ 24 | 408 | β |
| 20% discount β $20 | $25 | β |
| taller-than logic | Sam | β |
Accuracy is high but stochastic, not perfect. Re-sampling the chickens problem 8Γ gave 7/8 with
a correct \boxed{23}\boxed{7}, plus separately one clearly wrong sample (28/2, 64 legs) and one
that rambled to the length cap without concluding. So treat single-turn accuracy as ~80β90%, sampled,
not deterministic. top_p=0.95 and chat-template wrapping did not improve termination or accuracy.
Termination (EOS) is stochastic and length-cap sensitive β with enough room (gen_len=8000) a run
EOS'd cleanly at 740 tokens; other runs over-think past 1500. EOS reliability would need more training.
3. Compression is active; eviction is a separate (untested-at-normal-length) regime
Instrumented generate_sp:
- With
rw=128, every step compresses the distant transcript (everything older than the last 128 tokens) into 32 SP vectors. On an 8000-token budget run the distant buffer reached max_kept=576 β ~18Γ compression actually fed to the model. Compression is genuinely exercised in every test. - Eviction (dropping lowest-mass tokens) only fires once the distant buffer exceeds
maxD=4096, i.e. only for very long generations. Normal runs (max_kept 576) never reach it. - Forcing it with
maxD=256fired eviction 40Γ (mechanism works) but the tight bound degraded the reasoning into a non-converging trial-and-error search. So aggressive eviction has a real quality cost.
4. Multi-turn "long-CoT rally" (mt_mlx.py) β and the rw fix
A 5-turn dependent-arithmetic chat where each answer feeds the next: 3+5=8 β β2=6 β Γ2=12 β β4=8 β Γ·2=4.
| recent window | outcome |
|---|---|
rw=128 |
turns 1β2 correct (state in the raw window); turn 3 fails β "no number given" (the running 6 fell into the lossy SP and was lost) |
rw=512 |
all 5 turns correct β e.g. turn 3: "starts with 6 after giving away 2 from 8 β¦ 6Γ2=12"; turn 5: "after eating 4, 8 left, split by 2 β 4 each" |
This is the cleanest demonstration of the core finding: specific values must live in the raw window,
not the SP. Widening rw keeps more of the recent state verbatim β multi-turn carry works. Cost is a
larger (still O(1)) KV constant and less actual compression β rw trades compression for retention, and
on the retention/quality axis larger rw is monotonically better (the SP only ever loses info vs raw).
Caveat: the model was trained at
rw=128, sorw=512at inference is slightly out-of-distribution; ideally one would train at the target window. The multi-turn result above is a single sample.
5. The compression fidelity floor (training)
Measured during training, deep-position cross-entropy (deepCE, positions β₯ rw+512) vs a full-attention
reference computed by full_kv_ce.py on the same held-out split:
- full-attention floor: deepCE β 0.56 (ppl β 1.76)
- QLoRA r=64: plateaued β 0.67β0.68
- Full fine-tune (FFT): plateaued β 0.65 (val 0.66)
The ~0.09 gap to full attention does not close with more LLM capacity (LoRAβFFT gained ~0.02). This is the inherent cost of squeezing the distant context into 32 vectors β consistent with the gist-vs- verbatim behaviour seen in generation.
Honest summary
- Works: bounded-memory long single-turn CoT (coherent, mostly-correct, often EOS); multi-turn state carry with an adequate raw window; genuine soft-prompt compression; fast laptop deployment.
- Limits: ~0.09 deepCE gap to full attention that capacity can't close; verbatim facts/proper nouns lost to the SP; stochastic accuracy and termination; tight eviction degrades reasoning.
- Knobs:
rw= compression β retention;maxD= bounded-buffer cap (eviction);n_sp=32SP budget.