OpenBMB/llama.cpp-omni
C++
Captured source
source ↗OpenBMB/llama.cpp-omni
Description: Omni inference in C/C++
Language: C++
License: MIT
Stars: 1
Forks: 0
Open issues: 0
Created: 2026-10-13T04:56:21Z
Pushed: 2026-10-13T05:07:20Z
Default branch: main
Fork: no
Archived: no
README:
llama.cpp-omni
llama.cpp-omni is a high-performance Omni multimodal inference engine built on llama.cpp.
- 🚀 First Full-Duplex Omni Streaming Engine — The first open-source C++ inference framework supporting full-duplex, omni-modal streaming video calls
- ⚡ Lightweight & Efficient — Inherits llama.cpp's high-performance characteristics with GGUF quantization support and low memory footprint
- 🔌 Fully Ecosystem Compatible — Compatible with llama.cpp interfaces and ecosystem for seamless integration with existing toolchains
- 🌐 Cross-Platform Deployment — Supports Windows, Linux, and macOS, enabling efficient Omni model inference on consumer-grade hardware
- 🎙️ End-to-End Voice Interaction — Supports the complete pipeline of streaming audio input, LLM inference, and TTS speech synthesis
---
MiniCPM-o
**MiniCPM-o 4.5** is a 9B-parameter on-device omni-modal large language model jointly developed by ModelBest and Tsinghua University, featuring powerful vision, speech, and full-duplex streaming capabilities.
---
Omni Architecture & Runtime Mechanism
Model Architecture
Built on the MiniCPM-o 4.5 end-to-end omni-modal architecture, where modality encoders/decoders are densely connected to the LLM through hidden states. This design enables better information flow and control while fully leveraging the rich multimodal knowledge acquired during training.
llama.cpp-omni splits the original PyTorch model into multiple independent GGUF modules, each with specific responsibilities:
- VPM: Vision encoder based on SigLip2 architecture, responsible for encoding images into visual embeddings. Includes a Resampler module that compresses visual features into a fixed number of query tokens before projecting them into the LLM's hidden space.
- APM: Audio encoder based on Whisper architecture, responsible for encoding 16kHz audio into audio embeddings. Features AvgPool and Projector layers to project into the LLM's hidden space.
- LLM: Main language model based on Qwen3-8B, which receives visual and audio embeddings as input and generates text token sequences. Supports multiple quantization formats (F16/Q8_0/Q4_K_M).
- TTS: Text-to-speech model based on LLaMA architecture, which projects LLM hidden states through Projector Semantic and autoregressively generates audio token sequences.
- Token2Wav: Flow Matching-based vocoder that converts audio tokens into 24kHz waveform audio.
Full-Duplex Streaming Mechanism
llama.cpp-omni implements a full-duplex streaming mechanism where input streams (video + audio) and output streams (speech + text) operate without blocking each other:
- Streaming Encoders: Transforms offline modality encoders into online streaming versions for real-time input processing. Audio is sliced into 1-second chunks for APM, while images are fed frame-by-frame to VPM.
- Time-Division Multiplexing (TDM): Within the LLM backbone, TDM divides parallel omni-modal streams into sequential information groups within periodic time slices, achieving millisecond-level input/output stream synchronization.
- Interleaved Speech Generation: The TTS module models text and speech tokens in an interleaved manner, supporting full-duplex speech generation where output can synchronize with new input in real-time while ensuring stability for long speech generation (>1 minute).
Proactive Interaction Mechanism
In duplex mode, the LLM continuously monitors incoming video and audio streams, deciding whether to speak proactively at 1Hz frequency. This high-frequency decision-making capability, combined with full-duplex features, enables proactive interactions such as spontaneous reminders and comments.
Runtime Pipeline
The core runtime pipeline of llama.cpp-omni consists of three stages:
1. Initialization (omni_init): Loads all GGUF models, initializes LLM/TTS/Token2Wav contexts, and configures simplex/duplex mode along with reference audio (for voice cloning).
2. Streaming Prefill (stream_prefill):
- When
index=0: Initializes System Prompt, including text system prompt and audio system prompt (reference audio embedding) - When
index>0: Processes user input — audio is encoded via APM, images via VPM, and embeddings are fed into LLM prefill - Supports high-resolution mode (max_slice_nums=2) and high-FPS mode (main image + stacked images)
3. Streaming Decode (stream_decode):
- LLM autoregressively generates text tokens, entering speech generation upon `
and switching to listening state upon - TTS projects LLM hidden states to generate audio tokens
- Token2Wav synthesizes WAV audio in real-time using a sliding window approach (28 tokens input, 25 tokens stride)
- All three modules execute in parallel via asynchronous queues, enabling streaming output
---
Performance Benchmarks
Inference Latency (RTX 4090, F16)
| Stage | Latency | Notes | |-------|---------|-------| | Time to First Token (TTFT) | Note**: Apple Silicon uses unified memory architecture. Recommended: 16GB Mac for Q4_K_M/Q8_0, 32GB+ Mac for F16.
---
Quick Start
Prerequisites
Model Files: Download MiniCPM-o 4.5 GGUF models with the following directory structure:
MiniCPM-o-4_5-gguf/ ├── MiniCPM-o-4_5-Q4_K_M.gguf # LLM (or F16/Q8_0) ├── audio/ │ └── MiniCPM-o-4_5-audio-F16.gguf ├── tts/ │ ├── MiniCPM-o-4_5-tts-F16.gguf │ └── MiniCPM-o-4_5-projector-F16.gguf ├── token2wav-gguf/ │ ├── encoder.gguf # ~144MB │ ├── flow_matching.gguf # ~437MB │ ├── flow_extra.gguf # ~13MB │ ├── hifigan2.gguf # ~79MB │ └── prompt_cache.gguf # ~67MB └── vision/ └── MiniCPM-o-4_5-vision-F16.gguf
Build
# Configure cmake -B build -DCMAKE_BUILD_TYPE=Release # Build cmake --build build --target llama-omni-server --target llama-omni-cli -j
> CMake will auto-detect and enable Metal (macOS) or CUDA (Linux with NVIDIA GPU).
Usage
# Basic usage (auto-detect all model paths from LLM path) ./build/bin/llama-omni-cli \ -m /path/to/MiniCPM-o-4_5-gguf/MiniCPM-o-4_5-Q4_K_M.gguf # With custom reference audio (voice cloning) ./build/bin/llama-omni-cli \ -m...
Excerpt shown — open the source for the full document.