Run this model with HF Jobs
Run tejadabheja/DioLLLE8-Preprint on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/tejadabheja/DioLLLE8-Preprint. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/tejadabheja/DioLLLE8-Preprint on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use tejadabheja/DioLLLE8-Preprint with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use tejadabheja/DioLLLE8-Preprint with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download tejadabheja/DioLLLE8-Preprint --local-dir DioLLLE8-Preprint
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
|
Download README.md from tejadabheja/DioLLLE8-Preprint: direct link, hf CLI and curl.
- Browser
- Download file 11.8 kB
-
https://huggingface.co/tejadabheja/DioLLLE8-Preprint/resolve/main/README.md
- Command line
-
hf download hf://tejadabheja/DioLLLE8-Preprint/README.md
-
curl -L -o README.md https://huggingface.co/tejadabheja/DioLLLE8-Preprint/resolve/main/README.md
11.8 kB
| license: apache-2.0 | |
| tags: | |
| - quantization | |
| - e8-lattice | |
| - diophantine-butterfly | |
| - mlx | |
| - apple-silicon | |
| - metal | |
| - long-context | |
| - preprint | |
| # Breaking the Walsh–Hadamard Rational Kernel Trap: Diophantine-Butterfly Nested-E₈ Lattice Quantization for 1M-Context Frontier MoE Inference on Consumer Apple Silicon | |
| **Author of Record & Stewardship:** Tejas Phatak (`https://huggingface.co/tejadabheja`) | |
| **Preprint Date:** November 2026 | |
| **Full Typeset PDF (LaTeX):** [`DIOLLLE8_PREPRINT.pdf`](DIOLLLE8_PREPRINT.pdf) | **LaTeX Source:** [`DIOLLLE8_PREPRINT.tex`](DIOLLLE8_PREPRINT.tex) | |
| **Model Weights & Metal Runtime:** [`tejadabheja/Qwen3.6-35B-A3B-DioLLLE8-3bit-1M-MLX`](https://huggingface.co/tejadabheja/Qwen3.6-35B-A3B-DioLLLE8-3bit-1M-MLX) | |
| > **AI-Primary Authorship & Autonomous Research Disclosure:** | |
| > In compliance with academic preprint and peer-review policies requiring an accountable human author of legal record alongside transparent disclosure of autonomous AI contributions, the author states that human input consisted solely of the initial research prompt (*"find better compression algorithm using new developments in mathematics using AI"*), follow-up target specification (*1M-context frontier MoE on a 32 GB MacBook Pro*), and compute/publication stewardship. All mathematical derivations, lattice codecs, adversarial red-team ablations, custom Apple Metal C++ shaders, 35.95B MoE streaming quantization, and 1,000,000-token empirical benchmarks were autonomously conceived, implemented, and verified by **Gemini Carbon / Nano**, **Claude Fable**, **GPT Astra 6.0**, and **Google DeepMind Antigravity**. | |
| --- | |
| ## Abstract | |
| Post-training quantization (PTQ) of Large Language Models (LLMs) commonly pairs Hessian-guided error feedback (`GPTQ`, equivalent to Babai's Nearest Plane Closest Vector Problem algorithm on the input covariance Cholesky factor) with fast orthogonal Walsh–Hadamard rotations (`QuaRot`, `SpinQuant`, `QuIP#`). We identify and resolve a structural algebraic limitation of this paradigm and scale the resulting codec to a `35.95B`-parameter Mixture-of-Experts (MoE) model running at `1,000,000`-token live context on a consumer `32 GB` Apple Silicon laptop with zero swap. | |
| First, we prove the **Walsh–Hadamard Rational Kernel Trap (Theorem 1)**: because normalized Sylvester–Hadamard matrices `H_d ∈ {±d⁻¹/²}ᵈˣᵈ` admit short integer kernel differences `z = e₁ − eₖ₊₁ ∈ ℤᵈ` that annihilate coordinate-aligned activation outliers, *any* unimodular lattice basis reduction `Z ∈ GL_d(ℤ)` (including exact LLL or HKZ) leaves the Babai rounding trace trapped at `Θ(M² / d)` rather than approaching Minkowski's determinant lower bound `Θ(M²/ᵈ)`. Replacing `H_d` with a parameter-free `O(d log d)` **Mixed-Radix Diophantine Butterfly** constructed from quadratic-irrational Givens tangents grounded in Hurwitz's Diophantine approximation theorem and Besicovitch's radical independence theorem (**Proposition 1**) eliminates integer null-vectors, reducing the LLL Babai trace at `d = 8, M = 100` from `1,259.59` to `25.62` (within `1.26%` of Minkowski's bound `25.30`). Second, we introduce a branchless **Shifted Conway–Sloane Nested E₈ / 2<sup>b</sup>E₈ Gosset Voronoi Codec** (`b ∈ {1, …, 6}`) with deterministic irrational-rational facet tie-breaking (**Theorem 2**), eliminating the `33.3%` even-`q` Voronoi boundary collisions of unshifted Conway–Sloane coset decoding while outperforming multi-stage residual E₈ stacking by `+0.61 dB` (`2`-bit) to `+4.56 dB` (`4`-bit). | |
| To deploy this mathematics without dequantization memory blowup on consumer unified memory, we engineer **`diollle8_mlx`**, a custom Apple Metal C++ and MLX runtime exploiting orthogonal commutation (`⟨W_rot U₆₄ᵀ, x⟩ = ⟨W_rot, x U₆₄⟩`, cutting runtime butterfly FLOPs by `4,096×`), exact dyadic-integer threadgroup-SRAM E₈ coset decoding (`0.0` FP16 error, `117.2 GB/s`), fused top-`k` routed `DioLLLE8SwitchGLU` (`0.263 ms/layer` across `256` experts), and a zero-reallocation slabbed `1,000,000`-token `3`-bit Nested-E₈ KV cache with bank-conflict-free Split-K Flash-Decode (`2.82×` faster than MLX `4`-bit quantized SDPA). Compressing `Qwen/Qwen3.6-35B-A3B` (`64.56 GiB` text `BF16`) in `44.86 s` on an Apple M5 GPU yields a zero-pickle `13.435 GiB` checkpoint (`12.952 GiB` resting GPU RAM, `3.33 bpw`) that saves `5.22 GiB` (`28.7%`) of Unified Memory over `mlx-community/Qwen3.6-35B-A3B-4bit` (`18.169 GiB`) while maintaining `WikiText-2` test perplexity within `+0.167` (`5.9951` vs. `5.8280`), Python 3.12 stdlib code perplexity within `+0.073` (`1.7000` vs. `1.6275`, `89.26%` Top-1 token agreement), `1.57×–2.16×` faster full-sequence forward evaluation, and swap-free `1,000,000`-token inference in `17.49 GiB` total GPU RAM (`0.9981` needle retrieval cosine at position `543,210`). | |
| --- | |
| ## 1. Mathematical Foundations Summary | |
| ### Theorem 1 (Walsh–Hadamard HKZ/LLL Rational Kernel Trap) | |
| Let `B = diag(M, 1, …, 1) ∈ ℝᵈˣᵈ` (`d = 2ᵏ ≥ 2`, `M ≫ √d`) model a dominant outlier channel of scale `M`, and let `H_d ∈ {±d⁻¹/²}ᵈˣᵈ` be the normalized Sylvester–Hadamard matrix. Then for *every* unimodular integer matrix `Z ∈ GL_d(ℤ)`, the thin QR factorization `B H_d Z = Q R` satisfies: | |
| $$\sum_{j=1}^d R_{jj}^2 \ge \frac{M^2}{d} + \sum_{k=1}^{d-1} \frac{k+1}{k} \gg d\,M^{2/d}$$ | |
| *Proof Summary:* The rank-`(d − 1)` integer sublattice `K = {z ∈ ℤᵈ : ∑ᵢ zᵢ = 0}` satisfies `(H_d z)₁ = 0` and is spanned by root vectors `zₖ = e₁ − eₖ₊₁` of norm `‖B H_d zₖ‖₂² = 2` independent of `M`. Any unimodular `Z ∈ GL_d(ℤ)` must place at least one column `u_r` outside `K` with `|∑ᵢ (u_r)ᵢ| ≥ 1`, whose projection orthogonal to `K` retains first coordinate `≥ M / √d`, forcing `R_{rr}² ≥ M² / d`. At `M = 100, d = 8`, exact LLL gives `1,259.5929` (`49.8×` above Minkowski's bound `25.2982`). ∎ | |
| ### Proposition 1 (Mixed-Radix Diophantine Butterfly via Hurwitz's Bound) | |
| Constructing `U_d ∈ O(d)` from `log₂ d` Givens stages with quadratic-irrational tangents `tan θₖ = 1 + 0.14(2 fₖ − 1) ∈ [0.86, 1.14]`, where `fₖ = {√p_(k mod 20) · φ + (k + 1)(φ − 1)}` and `φ = (1 + √5) / 2`, eliminates short integer kernel vectors via Hurwitz's Diophantine bound `|φ − p/q| > (√5 q² + ε)⁻¹` and Besicovitch's theorem, collapsing the LLL Babai trace at `d = 8, M = 100` from `1,259.59` (`Hadamard+LLL`) to **`25.62`** (`1.26%` above Minkowski's bound `25.30`). | |
| ### Theorem 2 (Collision-Free Shifted Conway–Sloane Nested E₈ / 2<sup>b</sup>E₈ Codec) | |
| For `q = 2ᵇ` even, unshifted Conway–Sloane coset decoding collides on Voronoi facets `|⟨x₀, r⟩| = q / 2` (`33.3%` collision rate at `b = 2`). Introducing the zero-bit irrational-rational shift `s = (1/2, 1/2, 1/2, 0, 0, 0, 0, 0) + (0.1 / 32)(1, 3, 5, 7, 9, 11, 13, 15)` satisfies `⟨s, r⟩ ∉ (1/2)ℤ` across all `240` minimal roots of E₈, yielding a `100%` collision-free bijection across all `2⁸ᵇ` cosets via: | |
| $$\operatorname{Decode}_q(c) = x_0 - q\,Q_{E_8}\!\left(\frac{x_0 + s}{q}\right), \quad x_0 = c\,G_{E_8}^\top$$ | |
| and outperforming multi-stage residual E₈ stacking by `+0.61 dB` (`2b`), `+1.83 dB` (`3b`), and `+4.56 dB` (`4b`). | |
| --- | |
| ## 2. Key Empirical Tables (`Qwen/Qwen3.6-35B-A3B` on 32 GB Apple M5) | |
| ### Table A: Exact Against-`BF16` Layer-3 Fidelity (`Shard 3`) | |
| | Scheme | `BPW` | MoE Wt | MoE Act *(Cos)* | `q_proj` Wt | `q_proj` Act *(Cos)* | | |
| |---|---:|---:|---:|---:|---:| | |
| | Hadamard + Scalar 3b (`g64`) | `3.25` | `13.34 dB` | `13.44 dB` *(`0.9782`)* | `13.37 dB` | `13.28 dB` *(`0.9774`)* | | |
| | Unrotated `MLX-3bit` (`g64`) | `3.50` | `14.36 dB` | `14.45 dB` *(`0.9822`)* | `13.94 dB` | `13.87 dB` *(`0.9798`)* | | |
| | **DioLLLE8 Pure 3b Nested-E₈** | **`3.25`** | **`16.28 dB`** | **`16.38 dB` *(`0.9884`)*** | **`16.29 dB`** | **`16.19 dB` *(`0.9879`)*** | | |
| | Official `MLX-4bit` (`g64`) | `4.50` | `20.78 dB` | `20.89 dB` *(`0.9959`)* | `20.40 dB` | `20.31 dB` *(`0.9954`)* | | |
| | **DioLLLE8-MLX (3b E₈ + 4b Attn)** | **`3.33`** | **`16.28 dB`** | **`16.38 dB` *(`0.9884`)*** | **`22.18 dB`** | **`22.10 dB` *(`0.9969`)*** | | |
| ### Table B: Full `35.95B` End-to-End Comparison vs. `mlx-community/Qwen3.6-35B-A3B-4bit` | |
| | Metric | `MLX-4bit` (Official) | **`DioLLLE8-3bit-1M`** | Delta / Advantage | | |
| |---|---:|---:|---| | |
| | Effective Bits / Weight | `4.50 bpw` | **`3.33 bpw`** | `-1.17 bpw` | | |
| | `.safetensors` Disk Size | `19.001 GiB` | **`13.435 GiB`** | `-5.57 GiB` (`-29.3%`) | | |
| | Resting Unified GPU RAM | `18.169 GiB` | **`12.953 GiB`** | **`-5.22 GiB` (`-28.7%`)** | | |
| | Cold Load Time | `5.46 s` | **`2.74 s`** | `1.99×` faster | | |
| | `WikiText-2` Test PPL (`16K` tok) | `5.8280` (`38.25s`) | **`5.9951`** (`24.39s`) | **`+0.167` PPL (`1.57×` faster)** | | |
| | Python 3.12 Code PPL (`8K` tok) | `1.6275` (`24.37s`) | **`1.7000`** (`11.26s`) | **`+0.073` PPL (`2.16×` faster)** | | |
| | Top-1 Match vs. `MLX-4bit` (Py / Wiki) | `100%` | **`89.26%` / `81.96%`** | KL: `0.301` / `0.180` nats | | |
| | Chat Decode Speed (`temp=0`) | `54.4 tok/s` | **`41.7 – 45.0 tok/s`** | Smooth interactive | | |
| | Max Swap-Free Context (32 GB) | `64K – 96K` | **`1,000,000+` (`17.49 GiB`)** | **`> 10×` longer swap-free** | | |
| *(Full derivations, proofs, and systems architecture are provided in [`DIOLLLE8_PREPRINT.pdf`](DIOLLLE8_PREPRINT.pdf) and [`DIOLLLE8_PREPRINT.tex`](DIOLLLE8_PREPRINT.tex).)* | |
| --- | |
| ## Verified References | |
| 1. A. Hurwitz, "Ueber die angenäherte Darstellung der Irrationalzahlen durch rationale Brüche," *Mathematische Annalen*, 39(2):279–284, 1891. | |
| 2. A. S. Besicovitch, "On the linear independence of fractional powers of integers," *Journal of the London Mathematical Society*, s1-15(1):3–6, 1940. | |
| 3. J. H. Conway and N. J. A. Sloane, "Fast quantizing and decoding algorithms for lattice quantizers and codes," *IEEE Transactions on Information Theory*, 28(2):227–232, 1982. | |
| 4. A. K. Lenstra, H. W. Lenstra Jr., and L. Lovász, "Factoring polynomials with rational coefficients," *Mathematische Annalen*, 261(4):515–534, 1982. | |
| 5. L. Babai, "On Lovász' lattice reduction and the nearest lattice point problem," *Combinatorica*, 6(1):1–13, 1986. | |
| 6. M. S. Viazovska, "The sphere packing problem in dimension 8," *Annals of Mathematics*, 185(3):991–1015, 2017. | |
| 7. E. Frantar, S. Ashkboos, T. Hoefler, and D. Alistarh, "GPTQ: Accurate post-training quantization for generative pre-trained transformers," in *ICLR*, 2023. | |
| 8. A. Hannun, J. Digani, A. Katharopoulos, and R. Collobert, "MLX: Efficient and flexible machine learning on Apple silicon," 2023 (`https://github.com/ml-explore`). | |
| 9. B. Peng, J. Quesnelle, H. Fan, and E. Shippole, "YaRN: Efficient context window extension of large language models," in *ICLR*, 2024. | |
| 10. S. Ashkboos, A. Mohtashami, M. L. Croci, B. Li, P. Cameron, M. Jaggi, D. Alistarh, T. Hoefler, and J. Hensman, "QuaRot: Outlier-free 4-bit inference in rotated LLMs," in *NeurIPS*, 2024. | |
| 11. A. Tseng, J. Chee, Q. Sun, V. Kuleshov, and C. De Sa, "QuIP#: Even better LLM quantization with Hadamard incoherence and lattice codebooks," in *ICML*, 2024. | |
| 12. Z. Liu, C. Zhao, I. Fedorov, B. Soran, D. Choudhary, R. Krishnamoorthi, V. Chandra, Y. Tian, and T. Blankevoort, "SpinQuant: LLM quantization with learned rotations," in *ICLR*, 2025. | |
| 13. S. Yang, J. Kautz, and A. Hatamizadeh, "Gated Delta Networks: Improving Mamba2 with delta rule," in *ICLR*, 2025. | |
| 14. J. Chen, Y. Shabanzadeh, E. Crnčević, T. Hoefler, and D. Alistarh, "The geometry of LLM quantization: GPTQ as Babai's nearest plane algorithm," *arXiv:2507.18553*, 2025. | |
| 15. Qwen Team, "Qwen3.6-35B-A3B: Agentic coding power, now open to all," April 2026 (`https://qwen.ai/blog?id=qwen3.6-35b-a3b`). | |