Abstract
GhostShell introduces a novel framework for embodied AI that enables real-time, concurrent robot control by streaming function calls directly from Large Language Models (LLMs). By utilizing an incremental XML-based token system and a multi-channel scheduler, GhostShell overcomes the latency and sequential limitations of traditional batch-processed JSON pipelines. Evaluation on the COCO quadruped robot demonstrates response times up to 66x faster than native LLM APIs while supporting complex, synchronized behaviors such as simultaneous speech and movement.
Introduction
Most current LLM-powered robots operate on a "plan-then-execute" pipeline. In this model, the robot receives a command, the LLM generates a complete plan (typically as a JSON block), and the robot only begins execution after the entire generation process is finished. This sequential approach creates a significant "robotic" lag that hinders natural human-robot interaction. Furthermore, coordinating multiple hardware components—such as a head, limbs, and speakers—is difficult under traditional models that struggle with concurrency. GhostShell addresses these challenges by treating robot control as a streaming programming task, allowing for "reasoning-while-acting."
The GhostShell Framework
The GhostShell architecture transforms the LLM into a streaming brain for the robot through four primary components:
- XML Function Tokens: Unlike JSON, which requires a closing brace for validation, XML's tag-based structure (e.g.,
<move speed="50" />) is naturally suited for incremental parsing. This allows the robot to trigger a function the moment a start tag appears in the LLM's output stream. - Streaming Parser & Dynamic Mapper: A SAX-based parser extracts tokens on-the-fly, while a mapper connects these abstract tokens to concrete robot functions via dependency injection.
- Multi-Channel Scheduler: This component acts as an orchestra conductor, managing a Main Channel for global blocking actions (like speech) and multiple Sub-channels for independent hardware modules. This enables intra-channel synchronicity alongside inter-channel asynchronicity.
- Code-as-Prompt: Function signatures and documentation are fed directly into the system prompt, allowing the LLM to "write" the robot's behavior in real-time.
Experimental Evaluation
The researchers evaluated GhostShell using COCO, a custom quadruped robot equipped with a camera, display, microphone, speaker, and four legs. The system was tested against a benchmark of 34 real-world interaction tasks, categorized into objective movements (e.g., "Triangle Walk"), subjective social interactions (e.g., "Expressing Sadness"), and long-horizon tasks requiring visual feedback (e.g., "Rock-Paper-Scissors").
Key Results and Insights
GhostShell demonstrates significant improvements in both speed and behavioral complexity:
- Latency Reduction: The framework achieved a 66x faster response time for parallel execution tasks compared to native Claude-3.5-Sonnet function calling (90ms vs. 3,570ms).
- Behavioral Accuracy: Using the Behavioral Correctness Metric (BCM), Claude-3.5-Sonnet achieved a state-of-the-art score of 0.85, while GPT-4o led in long-horizon multimodal tasks with a score of 0.8.
- Fluid Interaction: By interleaving natural language and function tokens, the robot can explain its actions while performing them, mimicking human-like fluidity. The system also supports "Event-Driven Termination," allowing external interrupts to stop a streaming action mid-flow.
Discussion and Future Work
While GhostShell significantly advances real-time embodied AI, several challenges remain. As robot skill libraries grow, the system prompt may exceed LLM context limits, necessitating Retrieval-Augmented Generation (RAG). Additionally, current LLMs operate in half-duplex mode; moving toward full-duplex models would allow robots to incorporate environmental feedback during token generation. Finally, future work must address security concerns, as streaming code execution requires robust safety guardrails to prevent hazardous physical behaviors resulting from prompt injection.
Summary updated