How Would Spider-Man Run a Local LLM?
Originally published on Substack.
When I first watched “Spider-Man: Brand New Day” I was distracted by his AI agent, E.V. I couldn’t stop thinking about how it was built. Every time he’d talk to the AI and ask it to do something, I’d think “wait, that’s a YouTube player tool call, and that’s a Spotify call”. So yeah, movies are kind of ruined for me now.
By the second act, I started architecting how he’s running the local LLM that powers E.V. I’m sure he would need his own model since no commercial model would be trustworthy enough and would allow enough freedom to do Spider-Man stuff (we know how restrictive AI providers can be). Also, he’d need his own storage as well as compute to run the LLM. I’m not concerned about how he has the money to build this. I mean Spider-Man’s practically a celebrity in NYC but I wonder how he built it.
The most interesting part to me about the whole thing was having an AI agent that’s always listening and ready to help, without having to worry about who’s storing your data (perks of running locally!). You can just talk to it to do stuff for you like, “Can you pull up that video on YouTube?” or “That’s enough of that song, pause that”. As I’m writing this, I’m realizing I’m just envisioning an Alexa that is powered by my AI harness (future project idea?!).
Back when I watched it for the first time, I didn’t know much about AI agents and it was a couple months before I built my personal AI agent. But now that I’ve built the foundation of the harness, I started wondering about using voice for communication with the AI agent.
Since these are my voice recordings, I wanted to use a local LLM so I can safely run everything on my local machine. I originally wanted to stream the input and have it be transcribed in real time so the LLM can start working immediately to save time. But that would be complicated for prompts like, “Can you find me some restaurants in San Diego? Wait, actually, check for LA”, the LLM would start looking up restaurants in San Diego before I’ve finished speaking. I also couldn’t find any reliable speech-to-speech local models that weren’t experimental and worked with various accents or intonations.
I decided to go with a regular LLM pipeline since it would give me more control over streaming the output and because I knew the Whisper model was good at transcribing and the existing harness I had built worked with the regular LLM (although speech models also support tool calls, I didn’t feel like doing all that work right now, maybe some other time).
This was the pipeline I chose to implement. I reused the architecture I built for my journaling app: an Apple Shortcut that records the audio and sends it to my server, where the Whisper model transcribes it. But instead of storing the transcription, the server sends it to the LLM, which reasons over the prompt and produces a response. That response is then spoken out loud using the Kokoro-82M text-to-speech (TTS) model.
I initially built this on its own but then decided to connect this to the personal AI agent harness I built, and I was able to talk to the LLM with my voice to look things up or find cafes and so on.
Since it’s all running on my local machine, it was slightly slow with multiple LLM calls, about 1-3 seconds worth of lag at its peak. I think this is bearable but I really wish I had a dedicated machine to run my projects and leave them always on so I can fulfill my dream of becoming Spider-Man, I’m sure that’s the only thing stopping me.
