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 β 100.7% lm_eval retention & 103.5% generative <think> retention (73.8% GSM8K, 36.2% MBPP, 25.6% HumanEval); 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. |
| BareTorch-Qwen3.5-0.8B-Hybrid | 18 CS-LRAD (r=16) + 6 Full-Attn |
Qwen3.5-0.8B $\rightarrow$ 4B |
π₯ Training on 8x H100 β Ultra-light edge hybrid; 1.63x faster prefill (82,767 tok/s), 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-Hybrid & 2B-Hybrid Benchmarks
Surgically distilled from Qwen/Qwen3.5 and aligned via Stage 4B/4C Top-64 Skew-KD (4B $\rightarrow$ 9B and 2B $\rightarrow$ 4B) + 1,500-step <think> Dr. GRPO, our BareTorch-Qwen3.5-4B-Hybrid and BareTorch-Qwen3.5-2B-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-Hybrid & 2B-Hybrid vs. Native Qwen3.5 Teachers)
| Evaluation Suite / Highlight Metric | Qwen3.5-4B (Native) |
BareTorch-4B-Hybrid (Retention) |
Qwen3.5-2B (Native) |
BareTorch-2B-Hybrid (Retention) |
|---|---|---|---|---|
10-Task lm-eval Macro Average (0-Shot) |
71.19% | 71.72% (100.7%) |
61.40% | 64.45% (105.0%) |
| ββ ARC-Challenge / ARC-Easy | 54.01% / 75.59% | 63.40% / 85.73% (117.4% / 113.4%) |
41.38% / 66.25% | 53.84% / 81.40% (130.1% / 122.9%) |
| ββ SciQ / BoolQ / WinoGrande | 95.50% / 86.18% / 69.46% | 97.40% / 85.90% / 74.74% (102.0% / 99.7% / 107.6%) |
88.50% / 71.80% / 63.06% | 97.00% / 79.88% / 65.67% (109.6% / 111.2% / 104.1%) |
| ββ PIQA / OpenBookQA | 78.40% / 40.60% | 77.69% / 42.80% (99.1% / 105.4%) |
72.85% / 35.60% | 73.83% / 38.40% (101.3% / 107.9%) |
5-Task <think> Generative & Coding Avg |
35.79% | 37.03% (103.5%) |
21.67% | 25.50% (117.7%) |
ββ GSM8K (<think> CoT Math) |
90.20% | 73.80% (81.8%) |
65.60% | 47.40% (72.3%) |
ββ MATH-500 (<think> Competition Math) |
48.60% | 33.00% (67.9%) |
20.60% | 15.60% (75.7%) |
ββ GPQA-Diamond (PhD-Level STEM <think>) |
2.68% | 16.52% (616.7%) |
4.69% | 25.67% (547.6%) |
| ββ MBPP (Python Code Synthesis Pass@1) | 21.00% | 36.20% (172.4%) |
1.60% | 24.20% (1512.5%) |
| ββ HumanEval (Python Code Synthesis Pass@1) | 16.46% | 25.61% (155.6%) |
15.85% | 14.63% (92.3%) |
| ββ MBPP / HumanEval AST Syntax Validity | 85.40% / 73.17% | 97.00% / 76.22% (113.6% / 104.2%) |
78.20% / 78.66% | 92.00% / 79.27% (117.6% / 100.8%) |
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 | 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 | 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 | 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 | 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 | 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 @ 2,048 | BareTorch-Qwen3.5-0.8B-Hybrid | 24.7 ms | 82,767 tok/s | 49.7 tok/s | 25.9 MB | 1.34 GB | 1.58x Prefill, 1.11x Decode, 1.7x Smaller Cache |
| 0.8B @ 2,048 | Native Qwen3.5-0.8B | 39.2 ms | 52,277 tok/s | 44.8 tok/s | 43.6 MB | 1.61 GB | Baseline |
| 0.8B @ 32,768 | BareTorch-Qwen3.5-0.8B-Hybrid | 587.5 ms | 55,775 tok/s | 49.9 tok/s | 385.9 MB | 2.70 GB | 1.25x Prefill, 1.11x Decode, 1.21 GB Less VRAM (-31%) |
| 0.8B @ 32,768 | Native Qwen3.5-0.8B | 731.9 ms | 44,770 tok/s | 45.1 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 and 2B 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
- 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)}
}