AI & ML interests
None defined yet.
Recent Activity
π»π₯ Model Rampage
Building Hardware-Portable, Pure-GEMM Sub-Quadratic LLM Architectures for the Edge & Cloud
π Why BareTorch? (Breaking the Edge & Cloud Kernel Wall)
Modern sub-quadratic architectures (such as Mamba-2, RWKV, and Gated DeltaNet) promise linear scaling, but they suffer from a critical deployment flaw: custom kernel lock-in. They rely on specialized C++/CUDA/Triton extensions (causal-conv1d, flash-linear-attention) that frequently fail to compile on consumer setups and collapse into slow sequential fallbacks on systolic arrays and edge hardware.
Model Rampage solves this through BareTorch and our CS-LRAD (Chunked Selective Low-Rank Associative Delta) engine:
- 100% Pure-GEMM Formulation: Replaces hardware-locked kernels and 1D convolutions with standard matrix multiplications (GEMMs) and an exact $O(1)$ low-rank recurrent state update for autoregressive decoding.
- True Universal Portability: Because every AI chip natively accelerates matrix multiplication, BareTorch runs at peak hardware speed out-of-the-box across Apple Silicon (MLX), Google Cloud TPUs (OpenXLA), NVIDIA/AMD/Intel GPUs, WebGPU, and Mobile NPUsβusing nothing but standard
torchandtransformers. - Surgical Up-Distillation &
<think>Alignment: Our multi-stage Layerwise Up-Distillation Engine converts pretrained weights into 3:1 CS-LRAD hybrids in hours, followed by Top-64 Skew-KD from larger teachers and 4-Pillar<think>Dr. GRPO reinforcement learningβproducing models that outperform their own native teachers in both intelligence and hardware speed.
π Model Portfolio
| Model Repository | Architecture | Base / Up-Distill Teacher | Status & Key Highlights |
|---|---|---|---|
| BareTorch-Qwen3.5-4B-Hybrid | 24 CS-LRAD (r=32) + 8 Full-Attn |
Qwen3.5-4B $\rightarrow$ 9B |
β
Available Now β 102.6% lm_eval retention & 113.5% generative <think> retention (79.6% GSM8K, 37.8% MATH-500, 35.4% HumanEval, 35.2% MBPP); 1.35x faster prefill & 1.67 GB less 32K VRAM. |
| BareTorch-Qwen3.5-2B-Hybrid | 18 CS-LRAD (r=32) + 6 Full-Attn |
Qwen3.5-2B $\rightarrow$ 4B |
β
Available Now β 105.0% lm_eval retention & 117.7% generative <think> retention vs. native Qwen3.5-2B; 1.63x faster prefill & 2.3x smaller short-context cache. |
| BareTorch-Qwen3.5-0.8B-Hybrid | 18 CS-LRAD (r=16) + 6 Full-Attn |
Qwen3.5-0.8B $\rightarrow$ 4B |
β
Available Now β 106.6% lm_eval retention & 174.5% generative <think> retention vs. native Qwen3.5-0.8B; 1.64x faster prefill (89,973 tok/s peak), 1.16x faster decode, 31% lower 32K VRAM (2.70 GB). |
| BareTorch-2.5B-Base | 18 CS-LRAD (r=16) + 6 Full-Attn |
From-Scratch (9B KD) |
β
Available Now β Foundational base model pre-trained on 75B tokens; beats 300B-token baselines (Pythia-2.8B, Mamba-1.4B). |
π Spotlight: BareTorch-Qwen3.5-4B, 2B & 0.8B Hybrid Benchmarks
Surgically distilled from Qwen/Qwen3.5 and aligned via Stage 4B/4C Top-64 Skew-KD (4B $\rightarrow$ 9B, 2B $\rightarrow$ 4B, and 0.8B $\rightarrow$ 4B) + <think> Dr. GRPO, our BareTorch-Qwen3.5-4B-Hybrid, 2B-Hybrid, and 0.8B-Hybrid models replace 75% of the backbone's token mixers with pure-PyTorch CS-LRAD layers while surpassing their native Qwen3.5 teachers across both general knowledge and generative reasoning/coding:
1. Executive Benchmark Summary (4B, 2B & 0.8B Hybrids vs. Native Qwen3.5 Teachers)
| Evaluation Suite / Highlight Metric | Qwen3.5-4B |
BareTorch-4B (Ret.) |
Qwen3.5-2B |
BareTorch-2B (Ret.) |
Qwen3.5-0.8B |
BareTorch-0.8B (Ret.) |
|---|---|---|---|---|---|---|
10-Task lm-eval Macro Avg (0-Shot) |
71.19% | 73.01% (102.6%) |
61.40% | 64.45% (105.0%) |
54.83% | 58.45% (106.6%) |
| ββ ARC-Challenge / ARC-Easy | 54.01% / 75.59% | 65.36% / 86.78% (121% / 115%) |
41.38% / 66.25% | 53.84% / 81.40% (130% / 123%) |
37.71% / 61.57% | 41.72% / 74.16% (111% / 120%) |
| ββ SciQ / BoolQ / WinoGrande | 95.5% / 86.2% / 69.5% | 97.3% / 86.4% / 75.5% (102% / 100% / 109%) |
88.5% / 71.8% / 63.1% | 97.0% / 79.9% / 65.7% (110% / 111% / 104%) |
86.5% / 62.5% / 58.9% | 96.3% / 70.8% / 61.8% (111% / 113% / 105%) |
| ββ PIQA / OpenBookQA | 78.40% / 40.60% | 78.56% / 44.00% (100% / 108%) |
72.85% / 35.60% | 73.83% / 38.40% (101% / 108%) |
68.99% / 30.80% | 72.58% / 36.00% (105% / 117%) |
5-Task <think> Generative Avg |
35.80% | 40.63% (113.5%) |
21.67% | 25.50% (117.7%) |
11.47% | 20.01% (174.5%) |
ββ GSM8K (<think> CoT Math) |
90.00% | 79.60% (88.4%) |
65.60% | 47.40% (72.3%) |
39.00% | 35.80% (91.8%) |
ββ MATH-500 (<think> Boxed Math) |
47.40% | 37.80% (79.7%) |
20.60% | 15.60% (75.7%) |
2.60% | 8.80% (338.5%) |
ββ GPQA-Diamond (PhD STEM <think>) |
1.12% | 15.18% (1360.0%) |
4.69% | 25.67% (547.6%) |
6.03% | 27.68% (459.3%) |
| ββ MBPP (Python Synthesis Pass@1) | 21.60% | 35.20% (163.0%) |
1.60% | 24.20% (1512.5%) |
1.80% | 16.80% (933.3%) |
| ββ HumanEval (Python Pass@1) | 18.90% | 35.37% (187.1%) |
15.85% | 14.63% (92.3%) |
7.93% | 10.98% (138.5%) |
| ββ MBPP / HumanEval AST Syntax | 83.00% / 76.83% | 97.40% / 80.49% (117% / 105%) |
78.20% / 78.66% | 92.00% / 79.27% (118% / 101%) |
93.40% / 60.37% | 92.20% / 72.56% (99% / 120%) |
2. Hardware Speed & Memory Efficiency (4B, 2B & 0.8B Hybrids on NVIDIA RTX 4090)
Running 100% in standard PyTorch (torch.compile) with zero custom C++/CUDA/Triton packages, BareTorch beats Qwen3.5's native hand-written kernels across every scale (4B, 2B, and 0.8B) in prefill throughput, decoding speed, KV-cache size, and 32K long-context VRAM:
| Scale & Context | Model (torch.compile vs. Native) |
TTFT (ms) | Prefill Speed | Decode Speed | Total Cache | Peak VRAM | Speedup / Memory Savings |
|---|---|---|---|---|---|---|---|
| 4B @ 512 | BareTorch-Qwen3.5-4B-Hybrid (r=32) | 39.8 ms | 12,877 tok/s | 37.2 tok/s | 25.5 MB | 7.67 GB | 1.35x Prefill, 1.15x Decode, 2.6x Smaller Cache |
| 4B @ 512 | Native Qwen3.5-4B | 53.5 ms | 9,568 tok/s | 32.3 tok/s | 67.5 MB | 7.97 GB | Baseline |
| 4B @ 16,384 | BareTorch-Qwen3.5-4B-Hybrid (r=32) | 1,235.8 ms | 13,257 tok/s | 37.0 tok/s | 521.5 MB | 9.38 GB | 1.12x Prefill, 1.12x Decode, 1.01 GB Less VRAM |
| 4B @ 16,384 | Native Qwen3.5-4B | 1,389.9 ms | 11,788 tok/s | 32.9 tok/s | 563.5 MB | 10.39 GB | Baseline |
| 4B @ 32,768 | BareTorch-Qwen3.5-4B-Hybrid (r=32) | 2,839.9 ms | 11,538 tok/s | 37.0 tok/s | 1,033.5 MB | 11.22 GB | 1.08x Prefill, 1.12x Decode, 1.67 GB Less VRAM (-13%) |
| 4B @ 32,768 | Native Qwen3.5-4B | 3,071.2 ms | 10,669 tok/s | 33.0 tok/s | 1,075.5 MB | 12.89 GB | Baseline |
| 2B @ 512 | BareTorch-Qwen3.5-2B-Hybrid (r=32) | 24.4 ms | 20,967 tok/s | 47.6 tok/s | 11.2 MB | 3.65 GB | 1.63x Prefill, 1.07x Decode, 2.3x Smaller Cache |
| 2B @ 512 | Native Qwen3.5-2B | 39.9 ms | 12,827 tok/s | 44.5 tok/s | 25.6 MB | 3.57 GB | Baseline |
| 2B @ 32,768 | BareTorch-Qwen3.5-2B-Hybrid (r=32) | 1,191.9 ms | 27,493 tok/s | 46.8 tok/s | 389.2 MB | 5.87 GB | 1.06x Prefill, 1.03x Decode, 310 MB Less VRAM |
| 2B @ 32,768 | Native Qwen3.5-2B | 1,262.6 ms | 25,952 tok/s | 45.3 tok/s | 403.6 MB | 6.18 GB | Baseline |
| 0.8B @ 1,024 | BareTorch-Qwen3.5-0.8B-Hybrid (r=16) | 23.6 ms | 43,474 tok/s | 51.2 tok/s | 13.9 MB | 1.30 GB | 1.64x Prefill, 1.13x Decode, 2.3x Smaller Cache |
| 0.8B @ 1,024 | Native Qwen3.5-0.8B | 38.7 ms | 26,487 tok/s | 45.2 tok/s | 31.6 MB | 1.53 GB | Baseline |
| 0.8B @ 4,096 | BareTorch-Qwen3.5-0.8B-Hybrid (r=16) | 45.5 ms | 89,973 tok/s | 51.4 tok/s | 49.9 MB | 1.43 GB | 1.37x Prefill, 1.13x Decode, 1.4x Smaller Cache |
| 0.8B @ 4,096 | Native Qwen3.5-0.8B | 62.2 ms | 65,845 tok/s | 45.5 tok/s | 67.6 MB | 1.76 GB | Baseline |
| 0.8B @ 32,768 | BareTorch-Qwen3.5-0.8B-Hybrid (r=16) | 586.4 ms | 55,878 tok/s | 51.4 tok/s | 385.9 MB | 2.70 GB | 1.24x Prefill, 1.16x Decode, 1.21 GB Less VRAM (-31%) |
| 0.8B @ 32,768 | Native Qwen3.5-0.8B | 729.7 ms | 44,906 tok/s | 44.2 tok/s | 403.6 MB | 3.91 GB | Baseline |
(Full 512 $\rightarrow$ 32,768 context hardware tables for each model size are available directly on the 4B Model Card, 2B Model Card, and 0.8B Model Card).
π Cross-Platform Edge & Cloud Benchmarks (BareTorch-2.5B-Base From-Scratch Study)
To prove that pure-GEMM sub-quadratic architectures scale from scratch and transfer effortlessly across non-NVIDIA silicon (where Triton/CUDA kernels do not exist), we also trained BareTorch-2.5B-Base on 75B tokens and profiled it across Google Cloud TPUs, Apple Silicon (MLX 4-bit), and NVIDIA CUDA:
- Zero-Shot Sample Efficiency: Trained on 75B tokens,
BareTorch-2.5B-Baseachieves a 57.87% 7-task zero-shot averageβbeating Pythia-2.8B (54.94%) and Mamba-1.4B (56.10%) trained on 300B tokens (4x more compute), while outperformingQwen3.5-2B-Baseon PIQA (74.81%) and OpenBookQA (39.40%). - 13.37x Faster 32K Prefill & 2.33x Faster Decoding on Google Cloud TPU (
v5e-1BF16): BecauseQwen3.5-2Blacks systolic-array TPU kernels forGatedDeltaNet, it falls back to sequential execution at 32K context (17.51s TTFT / 1,871 tok/s). BareTorch's pure-GEMMCS-LRADruns natively on the TPU MXU, completing 32K prefill in 1.31s (25,018 tok/s) and decoding at 43.38β49.02 tok/s (vs. 21.07 tok/s). - 34% Faster Edge Prefill & 30% Lower 32K RAM on Apple Silicon (
M1 MacBook ProMLX 4-Bit): Processes 32K tokens in 31.9s (1,028 tok/s) vs. 42.6s (770 tok/s) forQwen3.5-2B, sustains 99.3 tok/s short-context and 75.5 tok/s 32K decoding, and cuts 32K unified RAM by 1.48 GB (3.52 GB vs. 5.00 GB).
| Hardware Platform | Context | BareTorch-2.5B (TTFT / Prefill) | Qwen3.5-2B (TTFT / Prefill) |
BareTorch Decode | Qwen3.5-2B Decode |
Key Hardware Takeaway |
|---|---|---|---|---|---|---|
| Google Cloud TPU v5e-1 (TorchTPU BF16) | 32,768 | 1.31s (25,018 tok/s) |
17.51s (1,871 tok/s) |
43.38 tok/s | 21.07 tok/s | 13.37x Faster Prefill, 2.06x Faster Decode |
| Apple MacBook Pro M1 (Native MLX 4-Bit) | 32,768 | 31.88s (1,028 tok/s) |
42.57s (770 tok/s) |
75.54 tok/s | 71.28 tok/s | 1.34x Faster Prefill, 1.48 GB Less RAM (3.52 GB) |
| NVIDIA Workstation GPU (CUDA BF16) | 32,768 | 0.99s (32,919 tok/s) |
1.04s (31,365 tok/s) |
63.79 tok/s | 45.82 tok/s | 1.39x Faster Decode across all context lengths |
(Full 512 $\rightarrow$ 32,768 tables across TPU v5e, Apple M1 MLX, and CUDA are available on the BareTorch-2.5B-Base model card).
π Resources & Citation
- Interactive ZeroGPU Demo: huggingface.co/spaces/martin-kb-rampage/BareTorch-Qwen3.5-Playground
- Layerwise Distillation & GRPO Pipeline Repository: github.com/martin-kbcc/BareTorch_Layerwise_Distill
- Core BareTorch Engine (PyTorch & MLX): github.com/martin-kbcc/baretorch
- Technical Whitepaper: Read Technical Report (PDF)
@article{kovacevic2026baretorch,
title={BareTorch: Challenging State-of-The-Art Sequence Mixing Topologies via Kernel-Free, Pure GEMM-Compliant Architectures},
author={Kovacevic Buvinic, Martin Ignacio},
journal={BareTorch Framework Laboratory Technical Report},
year={2026},
url={[https://github.com/martin-kbcc/baretorch](https://github.com/martin-kbcc/baretorch)}
}