· AI dev tools

homie, local macOS voice agent, achieves 0.43s commands from 4B model

A T-Rex drawn by a 4B model, which turned out to be merely a green box with a face, was a harsh lesson in the limitations of AI, but it underscores the meticulous engineering behind homie, a local…


A T-Rex drawn by a 4B model, which turned out to be merely a green box with a face, was a harsh lesson in the limitations of AI, but it underscores the meticulous engineering behind homie, a local voice agent designed for macOS. This assistant, which resides within the MacBook notch, allows users to issue commands like setting timers, playing music, reviewing their calendar, pointing out screen elements, and receiving spoken replies, all while operating entirely on the Mac.

The core functionality relies on several integrated components: the Qwen 3.5 4B model running via llama.cpp on Metal serves as the cognitive engine, Kokoro-82M operates on the Neural Engine for voice processing, and Apple's native on-device recognizer handles speech input, meaning it functions even when the device is in airplane mode.

The primary challenge encountered during development was not making the assistant functional, but rather ensuring it felt swift. On an M5 equipped with 16 GB of memory, the 4B model generates approximately 15 to 30 tokens per second, a rate that halves when memory pressure increases. Since a tool invocation requires the command to be written out token by token, a simple request to set a timer can consume 2 to 5 seconds, a wait time users are unlikely to tolerate.

Therefore, the speed of homie is largely achieved through two guiding principles: avoiding model invocation when unnecessary, and preventing the system from re-reading information. Many common requests to an assistant—such as adjusting dark mode, launching an application, setting a timer, or checking one's schedule—do not necessitate a full language model. Instead, about 600 lines of pattern matching code intercept these everyday phrases and call the appropriate tool almost instantly, in about a millisecond.

However, this pattern matching approach carries the inherent risk of misinterpretation; consequently, the test suite includes phrases specifically designed to ensure no false positives occur—for instance, the instruction "close this window" must not result in quitting an entire application, and a query like "why is dark mode bad for your eyes" must be treated as a question, not a directive. Before refinement, the system successfully recognized 87% of a held-out set, but it has since reached a perfect score of 214 out of 214 phrases with zero instances of incorrect triggering.

Anything the pattern matcher fails to identify is then passed to the language model for processing, and read-outs operate under a similar mechanism. Previously, asking "What's on my calendar tomorrow?" involved a tool call followed by a second model pass to generate a summary, a process taking 5 to 7 seconds. Now, the code directly accesses EventKit, constructs the required sentence, and the voice begins speaking in less than a second.

The entire system prompt, including the definitions for available tools, amounts to roughly 3,700 tokens. Re-processing this entire block for every query imposes a heavy penalty, costing 7 to 19 seconds on the current hardware, which effectively nullifies the entire concept. To counteract this, llama.cpp allows for saving the model's state after processing an initial prompt. homie utilizes this by saving the state to disk precisely at the point where the user begins speaking, meaning each subsequent question only requires adding a small number of tokens—around 45 instead of the initial 3,700. This optimization slashed the time from launch to readiness from 5 to 10 seconds down to just 0.12 seconds, a refinement that consumed a full day of effort.

A specific caching issue proved particularly difficult to diagnose: the cache would repeatedly fail for no apparent reason, and the culprit was identified as the tool JSON being serialized from a dictionary whose key ordering shifted with every new launch. By enforcing a consistent sorting of the keys, the prompt became byte-identical across sessions, and the cache misses disappeared.

This same constraint inadvertently blocked a straightforward optimization: feeding the model only the tools relevant to the current request, which should theoretically result in a smaller, faster prompt. In reality, however, presenting a new list of tools invalidates the cache, incurring a penalty of 4 to 17 seconds, making a single, stable set of tools the superior choice.

Determining when a user has finished speaking introduces its own layer of latency. homie pauses for 0.35 seconds after a command that is clearly complete, 0.6 seconds under normal circumstances, and 1.2 seconds if the utterance ends with "and…". Furthermore, the model begins processing what has been said after only 0.25 seconds of silence. If the user continues speaking, this initial processing is discarded and restarted, which is measured as having a negligible cost (0.18–0.20 seconds versus a baseline of 0.18–0.26 seconds). When the user pauses, the system effectively hides about 0.35 seconds of this waiting period.

The voice output does not wait for the model to finish generating the entire response. The initial phrase is clipped at a natural speech boundary, such as "Did you know │ that there's a black hole…", and begins speaking while the model continues its generation. This technique reduced the p90 time for the first sound to be audible from 1.49 seconds down to 0.88 seconds. Additionally, when a tool call begins streaming, homie immediately responds with "On it," which contributes to the perception that brain turns happen about 2 seconds quicker.

For example, when asked to "circle the Send button," the system executes the action in approximately half a second. The model itself never generates coordinates; a 4B model struggles with that level of precision. It merely dictates what needs marking, and Apple's Accessibility tree, combined with on-device text recognition, locates the target. This was a lesson learned through trial and error; attempts to instruct the model to draw freehand resulted in a T-Rex depicted as a green box with a face, taking 13 to 20 seconds to generate.

Because a 4B model can confidently produce incorrect outputs, several safety checks are implemented. An executed action must correspond to a specific word in the user's actual speech; thus, a command like "tell me a joke" cannot trigger music playback. Furthermore, any text generated by the tool-call mechanism that accidentally leaks into the final spoken reply is suppressed, and invented IDs are automatically redirected. While these features may seem basic, each one successfully eliminated a category of potentially embarrassing errors.

The only external network interactions involve the initial, one-time download of the model from Hugging Face (which is pinned and verified via SHA-256), iTunes Search when requesting a song, and whatever external website the user instructs it to open. Users can inspect the underlying model with the command: lsof -nP -i -a -c llama-server, which is configured to listen exclusively on 127.0.0.1. homie requires an Apple silicon Mac running macOS 26 or newer. The complete experimental logs, the benchmark harness, and the source code are available on GitHub, alongside a signed build. If you possess a different chip, running bash Tests/local_eval/bench.sh would be welcome to provide comparative performance metrics.

Why it matters

This showcases advanced optimization techniques for running local LLMs, which is crucial for developers building on-device AI experiences. The focus on minimizing latency through architectural choices like state saving and pattern matching offers valuable insights for production tooling.

Earlier coverage

Related coverage

Also worth reading

  1. Anthropic proof shows VP not equal to VNP regarding permanent computation
  2. Lua supports data representation via tables, chunks, and imperative styles
  3. Anthropic Claude solves Riemann Hypothesis, proof is 250,000 pages of slop
  4. next.js 16.5.0-canary.62 released with switchyard updates, Turbopack fixes
  5. CrowdStrike acquires Zscaler for $44 billion, uniting endpoint and zero-trust security for AI control