Show HN: Needle: We Distilled Gemini Tool Calling into a 26M Model
TL;DR Highlight
Needle, an 8-29MB tool-calling model, beats models 10x larger on mobile tool calls
Who Should Read
App developers who want on-device function calling for voice, smart home or mobile features without a server
Core Mechanics
- It keeps tool calling and drops general chat
- The whole model is a single 8-29 MB file.
- The README says it beats models 10x its size on mobile tool calls and matches 2-3x bigger ones on extraction.
- Unknown requests return an empty list, not a guess
- It picks the right functions your app exposes and fills arguments from what the user said.
- Two requests give two ordered calls, and a request no tool covers gives an empty list.
- Grammar-constrained output plus a confidence score
- A byte-level grammar compiled from your schemas constrains every token.
- Every response carries a calibrated confidence score from a learned head.
- Beyond tool calls: extraction, embeddings, speech
- Given a schema, it pulls typed fields from messy text and also handles classification.
- The same model returns sentence vectors for local search and routing.
- Whistle (16.9 MB speech-to-text) shares the engine, so audio goes straight to tool calls.
- Every depth from 2 to 20 layers is deployable
- A 2-layer subnetwork fine-tuned on one product's tools can run on much smaller devices.
- Fine-tuning on DroidCall lifts every subnetwork 18 to 36 points, and from 4 layers up it passes DeepSeek V4 Flash.
- Getting started takes one decorator
- pip install cactus-needle, then add @needle.tool to your function.
- A community npm package runs it in Node.js and browsers via WebAssembly, under Apache-2.0.
Community Reactions
- Someone ran it fully in the browser
- A commenter built a client-side playground with onnxruntime-web, no server.
- Another said setting an alarm and adding groceries worked better than Siri.
- Ambiguous and compound requests showed limits
- One user said "in 1 hour set a timer for 1 hour" gave a single 1-hour timer, and retries gave two separate timers.
- Another tried 'git add commit and push' and got a create_note call, which was unusable.
- Commenters asked about discrimination across many tools
- One asked whether it can pick "add appointment" for "save this" among tens or hundreds of tools.
- Others asked about multi-step state and requested benchmarks against Gemma4 edge models.
- Strong interest for Home Assistant and smart speakers
- One commenter said a 26M model on a Raspberry Pi would beat their qwen 9b server setup.
- Others reported errors running on CPU in an unprivileged LXC container and a tokenizer repo access error.
How to Apply
- Try local tool calling on 2-3 existing functions
- Today, pip install cactus-needle, add @needle.tool to your functions and run agent.run on real utterances.
- Include an off-topic request and a two-action request to check the empty list and call order.
- Route on confidence: act, confirm or refuse
- Branch on the response confidence: run when high, ask the user when medium, refuse when low.
- Design one tool per action, named the way users say it.
- Put Needle in front of a larger LLM
- Let Needle handle simple commands and forward only empty-list requests to a bigger model.
- Use it for voice and smart-home features where call cost and latency matter.
- Fine-tune on your tools and ship a small depth
- Use needle platform generate to create data from tool definitions and finetune to score every depth.
- Pick the smallest accurate depth and deploy it with needle build --layers N.
Try It
# Run in a terminal (requires pip install cactus-needle; example from the README)
# pip install cactus-needle
import needle
@needle.tool
def get_weather(city: str):
"Get the current weather for a city."
return {"city": city, "temp_c": 27, "sky": "clear"}
agent = needle.Needle(tools=[get_weather])
print(agent.run("what's it like in Lagos right now?")["results"])
# Also check that an unrelated request returns an empty list
print(agent.run("write me a poem"))Terminology
Related Papers
A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth
Install Unsloth Desktop, load a quantized Qwen model, and share a private ChatGPT-like AI on your home LAN.
Muru – AI-assisted Rust server for Python apps by mod_WSGI's creator
mod_wsgi's creator is building Muru, an AI-assisted Rust ASGI/WSGI server, documenting it in public
87% of the Anthropic power will come from gas and 11% from coal in 2028
Analysis of Anthropic's contracted data centers: 87% gas, 11% coal power in 2028
Anthropic’s Nasdaq debut
Anthropic listed on Nasdaq and closed its first day below its opening price.
OpenAI still has a WebRTC Problem
WebRTC drops late audio, hurting voice AI; MoQ retransmits and buffers instead
Gemini 4 Neon
Gemini 4 Neon cuts cost per task 32% versus Carbon, at $3 input and $15 output per million tokens
AI is killing All About Berlin
After Google AI Overviews, a Berlin guide site lost 70-75% of its traffic.
Not Everything Needs an LLM
PostHog used small decision models to skip 98.7% of expensive LLM calls