frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: Open-source engine running Gemma 4 26B in 2 GB RAM on any M-series Mac

https://github.com/drumih/turbo-fieldfare
82•gitpusher42•55m ago
Hi HN,

I built a specialized inference engine for running 4-bit Gemma 4 26B-A4B-IT on any M-series Mac using about 2 GB of RAM. It is called TurboFieldfare and is written in Swift and Metal.

I have always adored on-device AI. It feels like magic that you can run a powerful NN on your Mac or iPhone. So I wanted to push the limits a bit and run a model whose weights don’t fit in memory.

The model’s 4-bit quantized weights occupy roughly 14 GB, which makes running it with conventional inference tools almost impossible on an 8 GB or even 16 GB Mac once the OS, applications, and KV cache are included.

The trick is to keep the shared part of the model and the KV cache in RAM, then stream only the routed experts needed for each token from SSD. An SSD is way slower than RAM, so the runtime uses a small expert cache and bounded parallel `pread`. While those reads are in flight, the GPU runs the shared part of the layer.

I ran more than 100 experiments. Most didn’t work. A few got me here. The experiments are described in the GitHub repo.

It currently generates 5–6 tok/s on an 8 GB M2 MacBook Air and 31–35 tok/s on an M5 MacBook Pro.

I also added an experimental OpenAI-compatible local server. It supports streaming and tool calls, and reuses one prompt prefix from the KV cache.

Try it! The Mac app is easy to install. On the first run, it will download 15 GB of weights from Hugging Face. The model is surprisingly capable.

I would love any kind of feedback!

Comments

yakupov_bulat•32m ago
Wow, amazing!

What if there is enough RAM to fully load the model? I assume in that case I shouldn’t use your engine.

0gs•30m ago
you could use mine ... github.com/0gsd/enough (it has other stuff too)
gitpusher42•22m ago
It depends on the use case.

I measured this exact model with a 4k context on the mlx engine. It runs at 75 tok/s on my M5 Mac Pro and using 14 GB of RAM. For my engine the same model uses 2 GB of RAM and produces 31–35 tok/s.

The project is still experimental so performance may vary as it continues to improve. If you want to save around 12 GB of RAM for other tasks and you are ok with 35 tok/s (afaik it is roughly comparable to ChatGPT’s speed for basic responses) my engine may be a good fit.

If you need maximum speed and flexibility just use MLX

addaon•31m ago
> It currently generates 5–6 tok/s on an 8 GB M2 MacBook Air and 31–35 tok/s on an M5 MacBook Pro.

Where does this big a performance spread come from? I wouldn't naïvely expect SSD performance difference to be that big, and I would expect SSD performance to dominate...

afzalive•27m ago
The M5 MBP has 24GB of RAM, more context in RAM perhaps?
wongarsu•25m ago
My suspicion is that this is simply due to the M5 having more memory, and the OS already having most of the file cached. The M2 has more memory pressure and would cache fewer of the SSD reads

If that's true, inference speed would be even lower if you have only 2GB total, including OS caches

GeekyBear•16m ago
The M5 SSD's performance uplift was fairly substantial, even when compared to the prior generation.

> In the Blackmagic Disk Speed Test, the SSD in the M5 MacBook Pro achieved read speeds of up to 6,323 MB/s, compared to just 2,031 MB/s on the M4 MacBook Pro. It's not like the M4 is "slow" in a vacuum, but the M5 SSD is over three times faster, which is a great generation uplift.

https://www.tomshardware.com/laptops/macbooks/m5-macbook-pro...

mxmlnkn•28m ago
This sounds really cool. My intuition was that the selected experts might change heavily for each token, resulting in slow SSD loads for each token. This seems to be wrong. Did you create some statistics on how often the experts need to be changed? What is the longest token run without any expert change? What does such a token run look like? In which cases do experts change frequently?
znpy•28m ago
I wonder if i can run this on my MacBook Neo!
gitpusher42•19m ago
I haven't tried it but it should work! You can try it and share your results, it would be really appreciated

I tried it on my wife's M1 MacBook Air 512GB and it gets 4–5 tok/s

Also, it must be easy to adjust for iPhones and iPads in theory

WithinReason•25m ago
Nice job implementing expert caching!
gitpusher42•15m ago
Thank you! Under good conditions it achieves approx a 67% cache hit rate with 16 expert slots
h2aichat•24m ago
Hope you can do it for Windows users also (and small graphics cards). Thanks
gitpusher42•13m ago
Uh, I’m afraid it is Apple only. It is written using Apple’s GPU language, Metal, and heavily relies on the Apples’s shared memory architecture

Windows PCs would require a completely different approach

touwer•17m ago
Cool! Is there any info on this doing harm to the SSD? (Or other parts?)
wtallis•15m ago
Reads don't wear out flash memory to any meaningful extent.
sscarduzio•13m ago
How does this compare to DwarfStar4?
hsienchuc•5m ago
I've run local video generation models on an 8GB graphics card and know firsthand that nothing runs smoothly when memory is insufficient. So seeing 14GB of weights crammed into 2GB of RAM is impressive.

If running continuously for over an hour (like an overnight batch task), will a fanless MacBook Air overheat and throttle? Can the SSD handle the continuous weight reads and sustained output speeds?

Great work, congratulations on the release!

tredre3•4m ago
I'm curious how your project compares to plain mmap!

Because llama.cpp will already run 26B in 2GB of RAM if you really want to (mmap enabled, repacking disabled).

It seems like the main difference is that your project synchronizes the SSD reads with inference activity, which you've presumably tuned to cause the least latency possible? Whereas the OS wouldn't care about any of that.

Show HN: Open-source engine running Gemma 4 26B in 2 GB RAM on any M-series Mac

https://github.com/drumih/turbo-fieldfare
94•gitpusher42•55m ago•21 comments

Show HN: Qwen Scribe – local transcription and dictation for Apple Silicon

https://github.com/VladUZH/qwen-scribe
10•sidclaw•1h ago•1 comments

Show HN: Write, simulate and synthesize VHDL/Verilog in the browser

https://risingedge.pro
11•wozniakpawel•6d ago•4 comments

Show HN: I was tired of opening 2 tabs for every HN link, so I made a userscript

https://github.com/twalichiewicz/HNewhere
395•twalichiewicz•17h ago•108 comments

Show HN: Echologue – the private AI voice journal I built for myself

https://echologue.com/
23•arisAlexis•3h ago•11 comments

Show HN: ClaudeFS – Give claude.ai access to a local folder, no local process

https://github.com/vincentping/claudeFS
2•vincentping•25m ago•0 comments

Show HN: Homage to Pharmageddon, plus: make your own pharma led demo

https://pharma.greg.technology/
2•gregsadetsky•28m ago•0 comments

Show HN: AI that opens PRs on your repo to fix your SEO

https://zaatar.ai/
2•olivdums•33m ago•0 comments

Show HN: OnlyVibes – No Fuss Realtime Interviews

https://onlyvibes.cc
2•stagas•35m ago•2 comments

Show HN: Parse a PDF from your terminal with PaddleOCR-VL-1.6

https://github.com/eigenpal/openparser
5•TimurKramar•40m ago•0 comments

Show HN: Goldenboy – in-browser dithering and pixel art for photos and video

https://goldenboy.app/
3•goldenboychrome•1h ago•1 comments

Show HN: The Federalist Papers, typeset as the 1787 newspapers they ran in

https://federalistreader.org/
6•vhwalke•1h ago•0 comments

Show HN: Tessera – tmux/Zellij ergonomics for macOS windows

https://github.com/pa/tessera
3•pramodhayyappan•1h ago•0 comments

Show HN: Save HN comments for later, annotate and tag them

https://github.com/overflowy/hn-comment-saver
3•overflowy•51m ago•0 comments

Show HN: I built an MCP server for working with SEO and Search Console data

https://seomcp.co
2•criexe•54m ago•0 comments

Show HN: WFY24 A performance weather widget with 2km hyper-local forecasting

https://www.wfy24.com/en/widgets
3•weatherfun•1h ago•0 comments

Show HN: A Persistent AI RPG Engine Built with React SPA and Supabase

https://vampirolife.com/en
5•mansueli•3h ago•0 comments

Show HN: Vostorq – I built the anti-Slack after working at a Slack-first company

https://www.vostorq.com/
2•Mike-Kelner•1h ago•1 comments

Show HN: find Your misplaced iPad

https://github.com/matthiasgoergens/find-ipad
4•eru•1h ago•1 comments

Show HN: A free curl API for IP data (we scan the IPv4 space in <24h)

https://worldip.io/news/keyless-ip-api-no-key-required
3•tuxxin•1h ago•0 comments

Show HN: Sightmap – Runtime context for agents using your web app

https://github.com/sightmap/sightmap
4•jurassix•1h ago•0 comments

Show HN: [OSS, local] Spatial Board for all your agents

https://github.com/mikky-a/agentboard
2•mikky-a•1h ago•3 comments

Show HN: FlipCloc for Mac out now. A gorgeous flip clock and screensaver

https://flipcloc.com
2•moonalien•1h ago•0 comments

Show HN: NightRun, bare metal LLM inference, no OS, boots from USB

https://github.com/hardrave/NIGHTRUN
3•hardrave•1h ago•0 comments

Show HN: P2Present – slides and talk video in sync, preserved on any storage

https://p2present.com/
2•shayanbahal•1h ago•0 comments

Show HN: Unducked – a rubber duck that roasts your code

https://unducked.com/
2•tmoreton•1h ago•0 comments

Show HN: A browser hide-and-seek game where you paint your own camouflage

https://somodus.com/g/cd3fa1526bc44a58b525848d92858558
2•eric2025•1h ago•0 comments

Show HN: Orbital – the project agent that maintains your wo

https://github.com/zqiren/Orbital
2•10keane•1h ago•0 comments

Show HN: A beautiful reader for Hacker News

https://hn.shubhangsharma.com/
2•sss111•1h ago•2 comments

Show HN: PriEco (open source, 400M index, EU search engine) integrated Goggles

https://prieco.net/
3•JojoYou•2h ago•0 comments