HomeElectronics NewsNeedle 2 Runs Tool-Calling AI On Raspberry Pi 5

Needle 2 Runs Tool-Calling AI On Raspberry Pi 5

Needle 2 is a 45-million-parameter, 14MB model that turns plain-English commands into local Python function calls on a Raspberry Pi 5.

Laptop terminal showing Needle returning a get_temperature function call for the prompt "how hot is it?"
Needle 2 selecting the get_temperature tool for “how hot is it?”. (Image: Cactus Compute)

A Raspberry Pi 5 can now turn natural-language instructions into actions such as switching an LED, reading its processor temperature, capturing an image or saving a note to disk using Needle 2, a compact function-calling language model from Cactus Compute. The model runs on the Raspberry Pi 5 processor alone, without a Hailo accelerator or graphics processor, and can operate without an internet connection.

Needle 2 is designed for function calling rather than general conversation. A developer defines the Python functions that the model is allowed to use, and Needle 2 interprets a request, selects the appropriate function and supplies its arguments. The selected function then executes locally on the Raspberry Pi. This keeps the model, tool definitions and resulting operations on the device.

The model contains 45 million parameters and is distributed as a 14MB binary. Its architecture uses an attention network with a Hadamard multi-layer perceptron (MLP), grouped-query attention (GQA) and an engram key-value memory. Cactus Compute uses its CQ2 two-bit quantisation to compress the model weights, allowing the relatively small binary to run on the Raspberry Pi 5.

Developers expose tools using the @needle.tool decorator. The function name, docstring and type annotations describe the available operation and its arguments. Needle uses this information when selecting a function for a request. According to Cactus Compute, up to five tools are retrieved for a turn, while the conversation uses a 256-token sliding context window.

A basic setup requires a Raspberry Pi 5, with the published measurements taken on the 8GB version, along with its power supply, storage and active cooling. An LED and resistor can provide a simple first hardware tool, while a Raspberry Pi Camera Module can be added for image capture. A developer can install Raspberry Pi OS, create a Python virtual environment, install the Needle package and expose the required hardware or software operations as tools.

For an LED test, for example, a GPIO-connected LED can be controlled through a Python function. Other functions can read the processor temperature using the Raspberry Pi’s local system interface or write a note to the file system. The same mechanism can be extended to relays, cameras, laboratory instruments and other interfaces supported by Python.

The source code is published in the Cactus Compute Needle repository under the Apache 2.0 licence, while the Needle 2 model is also available under Apache 2.0. This gives developers access to the software and model required to experiment with local function calling on supported hardware.

The Raspberry Pi team measured individual tool-calling operations on a Raspberry Pi 5. Switching an LED took 78 ms, while blinking it took 83 ms. Capturing a photograph took 76 ms, reading the processor temperature took 149 ms and saving a note took 107 ms. An unrelated request that the system rejected took 92 ms.

The reported throughput was 461–488 tokens per second during prefill and 248–314 tokens per second during decoding. A native Needle session used about 28MB of memory, while the complete Python process peaked between 43MB and 46.4MB. These figures come from the Raspberry Pi team’s test setup; the model card from Cactus Compute quotes a higher figure of 500 tokens per second for Raspberry Pi 5, so the measurements should not be treated as directly interchangeable.

Running the model locally also changes the connectivity requirements. Unlike a cloud-based function-calling API, Needle 2 does not need a network connection for inference or incur a per-token cloud inference charge. Tool requests and their responses can remain on the Raspberry Pi. This makes the approach relevant where network availability is limited or where local processing is preferred.

There are limitations. The 256-token sliding window means earlier conversation context can be lost during longer interactions. The five-tool retrieval limit also means developers with large tool libraries may need to organise functions into smaller groups. The model is intended to select from declared tools rather than act as an unrestricted assistant. The software also collects telemetry by default, with an opt-out available through environment variables.

For Indian makers and engineering students, the combination of cost, local processing and connectivity independence is particularly relevant. A Raspberry Pi 5 running Needle 2 can provide a natural-language interface for an agricultural controller, college laboratory instrument or industrial panel without requiring continuous outbound internet connectivity. The reported peak process footprint of less than 47MB also leaves substantial memory on an 8GB Raspberry Pi 5 for the rest of the application.

The same approach can be extended beyond an LED by exposing a relay, Modbus-connected laboratory equipment or other hardware as a local Python tool. Developers can then measure how tool-selection accuracy changes as the number of available functions increases.

Needle 2 therefore provides a compact route to adding natural-language control to Raspberry Pi projects. For a final-year engineering project, the model can translate a user’s instruction into predefined local actions without requiring an API key or dedicated AI accelerator.

For more information, click here.

Loading form…
Ananthu Ashok
Ananthu Ashok
Ananthu Ashok is a tech journalist and has a deep interest in embedded systems, open source, IoT, robotics and emerging tech.

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics