Ma

Mamba3-minimal – PyTorch implementation of Mamba-3

Hacker News

Mamba3-minimal – PyTorch implementation of Mamba-3

Hi HN, When the Mamba-3 paper dropped (currently under ICLR review), I wanted to understand how the new math actually worked. But the official implementations of these architectures usually rely on heavily optimized custom Triton/CUDA kernels. They are incredibly fast for training, but almost impossible to read if you just want to understand the matrix math. I spent the last few days reverse-engineering the paper to build mamba3-minimal: a pure-PyTorch, single-file implementation that runs natively on Mac (MPS), CPU, and CUDA. It implements the three core innovations of the paper without any C++: 1. Trapezoidal Discretization & The "Shift" Hack: The new discretization rule introduces a strict sequential dependency across chunk boundaries (the beta term), which breaks standard PyTorch chunking. I managed to solve this by shifting the sequences at the global level before passing them into the chunked State Space Duality (SSD) algorithm. 2. Complex-Valued SSMs (Data-Dependent RoPE): Mamba-2 famously failed at state-tracking (scoring ~50% random guessing on parity tasks). This repo includes a test script proving the RoPE fix mathematically works, hitting 100% accuracy and extrapolating to length 64. 3. MIMO (Multi-Input Multi-Output): Standard decoding is memory-bound. I implemented the rank-expansion formulation from Appendix D, which shifts the state update from a memory-bound outer product to a compute-bound matrix multiplication, all through clean einsum operations. The repo includes self-tests proving the O(T) chunked training pass produces the exact same logits as the O(1) sequential autoregressive step (max_diff < 1e-6). If you've been wanting to read the math behind Mamba-3, I built this to be a readable Rosetta Stone. Would love any feedback on the implementation or the PyTorch optimizations!

Share card

Actual performance

1points
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Missing: supports, reddit linkedin, podcasting
91%91% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Product HuntOn track for Day 1 leaderboard · Strong signals: mac, new, single · Missing: agents, macos, agent
76%76% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Missing: mobile apps, ios, personal
32%32% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Strong signals: training · Missing: arr, mrr, revenue
27%27% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
Hacker NewsMay not resonate with HN audience · Strong signals: io · Missing: https docs, excited, just released
25%25% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
20%20% predicted probability of success on AppSumo, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Strong signals: introduce · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Je
Jelly – Experimental minimal RPC21%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Jelly – Experimental minimal RPC

Hacker News2
Mi
Minimal Fibers47%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Minimal Fibers

Hacker News53
A
A minimal TodoMVC in Brutal47%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A minimal TodoMVC in Brutal

Hacker News1
An
Another Minimal Stylesheet47%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Another Minimal Stylesheet

Hacker News1
Mi
MiniForth – A Minimal Forth54%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

MiniForth – A Minimal Forth

Hacker News6
A
A Minimal Traceroute Implementation44%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A Minimal Traceroute Implementation

Hacker News4
Bs
Bsdloader – Minimal (~123KB), reproducible x86_64 FreeBSD UEFI loader32%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Bsdloader – Minimal (~123KB), reproducible x86_64 FreeBSD UEFI loader

Hacker News3
Mo
Momentous – a minimal datepicker for bootstrap49%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Momentous – a minimal datepicker for bootstrap

Hacker News1
Mi
Minimal Meteor Scaffolding59%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Minimal Meteor Scaffolding

Hacker News1
Mi
Minimal ES6 code samples63%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Minimal ES6 code samples

Hacker News1