Comeè fatto
Tre runtime, due formati di modello, un contratto API.
Architettura
Componenti e flussi.
graph LR
subgraph Clients
W[Browser / Dashboard]
A[App Android]
L[ESP32 / Client LAN]
end
subgraph Server["AiLocalVoiceServer (.NET 10)"]
API[HTTP :17500]
LLM[LLamaSharp / llama-server]
STT[sherpa-onnx / LFM3]
TTS[Supertonic / Kokoro / Qwen]
OMNI[LFM3-Omni]
end
W -->|HTTP JSON| API
A -->|HTTP JSON| API
L -->|avvia| API
API --> LLM
API --> STT
API --> TTS
API --> OMNI
LLM --> GGUF[(GGUF)]
OMNI --> GGUF
STT --> ONNX[(ONNX)]
TTS --> ONNX
Il client non cambia: gli endpoint sono gli stessi in modalità testo e omni.The client does not change: endpoints are the same in text and omni mode.
Flusso vocaleVoice flow
Un’unica richiesta per ASR, chat e TTS.A single request for ASR, chat and TTS.
sequenceDiagram participant C as Client participant S as Server participant O as LFM3-Omni C->>S: POST /v1/voice/chat (audio) S->>O: trascrizione O-->>S: testo utente S->>O: chat (storia + prompt) O-->>S: risposta S->>O: sintesi O-->>S: WAV S-->>C: JSON + audioBase64
Backend
CPU, GPU e acceleratori per piattaforma.
| Runtime | Windows | Linux | macOS | Android | Web |
|---|---|---|---|---|---|
| llama.cpp / ggml | CUDA, Vulkan | CUDA, ROCm, Vulkan | Metal | CPU, OpenCL* | WebGPU |
| ONNX Runtime | CUDA, DirectML | CUDA, ROCm | CoreML | XNNPACK, QNN* | WebGPU |
| sherpa-onnx | CPU, CUDA | CPU, CUDA | CPU | CPU | WASM |
* Non abilitato di default su Android: richiede driver e build dedicati.Not enabled by default on Android: requires dedicated drivers and builds.
Android
JNI, plugin GGML e isolamento dei backend.
Backend come pluginBackends as plugins
llama.cpp è compilato con -DGGML_BACKEND_DL=ON: libggml-cpu.so non è più una dipendenza diretta di libggml.so, ma viene caricato a runtime dalla cartella nativa dell’app. Un backend GPU può essere aggiunto o rimosso senza toccare il codice.llama.cpp is built with -DGGML_BACKEND_DL=ON: libggml-cpu.so is no longer a direct dependency of libggml.so but is loaded at runtime from the app native folder. A GPU backend can be added or removed without touching the code.
Contesto adattivoAdaptive context
Il contesto prova fa+q8_0, poi fa+f16, poi f16: la KV quantizzata richiede Flash Attention, che alcuni driver rifiutano. Il primo che si crea vince.The context tries fa+q8_0, then fa+f16, then f16: quantized KV requires Flash Attention, which some drivers reject. The first that is created wins.
Prefill a chunkChunked prefill
Un prompt più lungo di n_batch viene spezzato: le conversazioni lunghe non falliscono più.A prompt longer than n_batch is split: long conversations no longer fail.
omni devices: 1
omni context: fa+q8_0,
n_ctx=16384, n_batch=2048
omni loaded: LFM3-Omni-2B-Q4_0.gguf
cfg=fa+q8_0