Text Generation
Transformers
Safetensors
English
speech
duplex
voice-assistant
streaming
tool-calling
qwen
text-to-speech
Run this model with HF Jobs
Run sadmN/aiden-duplex on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/sadmN/aiden-duplex. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/sadmN/aiden-duplex on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/sadmN/aiden-duplex. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/sadmN/aiden-duplex. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use sadmN/aiden-duplex with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sadmN/aiden-duplex with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sadmN/aiden-duplex")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("sadmN/aiden-duplex", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sadmN/aiden-duplex with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sadmN/aiden-duplex" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sadmN/aiden-duplex", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/sadmN/aiden-duplex
- SGLang
How to use sadmN/aiden-duplex with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "sadmN/aiden-duplex" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sadmN/aiden-duplex", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "sadmN/aiden-duplex" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sadmN/aiden-duplex", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use sadmN/aiden-duplex with Docker Model Runner:
docker model run hf.co/sadmN/aiden-duplex
File size: 8,286 Bytes
4b78439 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | ---
license: other
language:
- en
library_name: transformers
pipeline_tag: text-generation
tags:
- speech
- duplex
- voice-assistant
- streaming
- tool-calling
- qwen
- text-to-speech
---
# Aiden β streaming duplex voice assistant (Qwen3.5-4B + 6-way floor control)
A research/demo voice assistant that runs on one RTX 5090. It streams a full-duplex
conversation: continuous listening, backchannel handling, real barge-in, native tool
calling (Tavily web search, weather/calculator/local-docs demos), and a Qwen3-TTS
"Aiden" voice.
The interesting part is not the LLM β it is the **duplex layer**: a 6-way control
head (`respond / wait / continue / yield / hold / stale`) trained on prosody plus
text, read at decision points, wired into a controller that keeps listening while it
speaks.
No avatar weights or avatar code are included in this repository.
## Hardware
| | |
| --- | --- |
| GPU | RTX 5090 (32 GB) tested; ~17 GB used at runtime |
| CPU/RAM | any modern x86-64, β₯32 GB RAM |
| OS | Linux, Python 3.12 |
| Disk | ~25 GB (repo 9 GB + downloaded TTS/ASR/Mimi ~5 GB + venvs) |
## Quick start
```bash
# 1. get the repo (weights included via git-lfs)
git lfs install
git clone https://huggingface.co/sadmN/aiden-duplex
cd aiden-duplex
# 2. two virtualenvs (thinker: transformers 5.x, voice: TTS/ASR/Mimi)
bash scripts/install_env.sh
# 3. external models (Qwen3-TTS, faster-whisper, Mimi) from public HF repos
bash scripts/download_checkpoints.sh
# 4. run
bash scripts/run_server.sh
# prints: Aiden on http://127.0.0.1:8998
```
Open `http://127.0.0.1:8998` and click **Enable mic**. There is no login: the demo
binds to loopback, so only this machine can reach it.
To require a code anyway (for example before exposing the port):
```bash
ACCESS_CODE_FILE=/path/to/code bash scripts/run_server.sh
```
The file is created with a random 24-character code if it does not exist.
### Expose it
```bash
HOST=0.0.0.0 PUBLIC_ORIGIN=https://<your-proxy-host> bash scripts/run_server.sh
```
`--public-origin` is enforced: the server rejects requests whose `Origin` does not
match. Public mode does not add authentication by itself: combine it with
`ACCESS_CODE_FILE` unless the proxy URL is itself private.
### Optional: web search
```bash
TAVILY_KEY_FILE=/path/to/tavily_key bash scripts/run_server.sh
# or simply drop a file named tavily_key next to run.sh
```
Without a key the search tool is simply not offered.
### Headless check
```bash
bash scripts/check_server.sh # listener, health, page, one live turn
bash scripts/smoke_test.sh # one text turn must print a reply
```
## What it does
| Behaviour | How |
| --- | --- |
| Continuous listening | mic frames always ingested; never muted during speech |
| Backchannel | prosody proposal + acknowledgment lexicon ("OK, OK", "mm-hm") β `continue`, kept out of chat history |
| Barge-in | prosody `yield` proposal + transcript confirmation β cancels the reply epoch |
| Tools | native Qwen XML calls, parsed atomically (never partially executed) |
| Web search | Tavily; results are data, sanitised, and never instructions |
| Tool waits | `HOLD` state with the mic live; result appended to the same turn (no re-ask) |
| Corrections | ledger + epoch cancellation; a correction replaces the old detail |
| Voice | Qwen3-TTS 1.7B CustomVoice ("Aiden"), streamed per clause |
## Repository layout
```
code/duplex/ server.py, live_session.py, voice_worker.py,
tavily_search.py, avatar_sink.py, page.html, tests
code/stage1/ model loading, data contract, training heads (for reference)
code/build_stage1_examples.py tool schemas
code/vendor/personaplex/moshi Mimi loader source (vendored)
checkpoints/stage2_final.pt Aiden thinker (LoRA + projector + heads)
models/qwen3.5-4b/ frozen base model
prompts.json the exact system prompt + tool schema used in training
scripts/install_env.sh create the two venvs (pinned versions)
scripts/download_checkpoints.sh Qwen3-TTS, faster-whisper, Mimi
scripts/run_server.sh start the server (loopback by default)
scripts/smoke_test.sh headless one-turn check
```
## Measured latency (RTX 5090)
| Stage | Value |
| --- | --- |
| Thinker prefill | 100β111 ms (600β720 token prompt) |
| Thinker decode | 39β41 ms/token, TTFT 40β110 ms |
| TTS per clause | 1.2β2.5 s (β1Γ real time) |
| First audio | ~1.5β2.5 s after a turn |
**TTS is the bottleneck.** Qwen-TTS synthesises at roughly real time, so first audio
tracks the first clause's length. Mitigations (short lead clause, warm start,
200 ms browser buffer) are in place; the structural fix is a streaming talker that
emits audio from the thinker's own hidden states, which is future work.
## Validation
| Gate | Result |
| --- | --- |
| control accuracy (2,739 held-out decisions) | 0.9982 |
| tools exact (free decode, 128-token cap) | 120/152 |
| first-request tool invocation | 68/69 |
| onset floor | continue 225/225, yield 156/157 |
| human quiet windows | 376/376 |
| human hesitation waits | 120/120 |
| retention (tools/intelligence) | call rate 1.0, 0 false calls, 0 loops |
## Limits
- Energy-based VAD (560 ms endpoint), no neural VAD, no server-side AEC. Use
headphones; a browser AEC plus an "own-speech echo" guard is the fallback.
- The `wait` head and activity head are trained and validated but not yet wired into
the live controller.
- Weather and local-docs tools are mocked; only Tavily is real.
- English-only TTS voice; research-grade, not a product SLA.
## Live behaviour: failure modes found and fixed
All ten of these were reproduced on the running server before being fixed, and every
one was a harness or prompt defect β never the model's tool ability. The full
write-up (mechanism, evidence, regression test) is in `LIVE_BEHAVIOUR_ANALYSIS.md`.
| Symptom you might see | Cause | State |
| --- | --- | --- |
| "I can't search for movies" / "I can't access real-time stock data" | search verb without a web noun, or "stocks" not in the fresh-fact list β no tool offered, and the no-tool prompt announced the limit | fixed: bare imperatives and value nouns route to the tool; the prompt no longer mentions missing tools |
| a live score/price stated with no search behind it | question offered no tool, model produced its trained "I'll check the web" preamble plus a plausible number | fixed: question + time deictic (`latest`, `last weekend`, `today`) forces a search |
| a number from an earlier turn attached to a new subject | follow-up ("and ethereum?") routed nowhere while the previous result stayed in context | fixed: follow-ups inherit the previous lookup, pronouns resolve against its query |
| dictionary pages returned for "what is the current price" | the literal sentence was searched | fixed: an utterance with no subject of its own reuses the previous query |
| `Unknown tool or invalid arguments` after a successful search | the post-search turn was given the no-tool prompt while also being told a search had run | fixed: dedicated post-search prompt |
| forgets the start of the conversation | history capped at six exchanges | fixed: 24 exchanges / ~6k-token budget |
| second tab shows "disconnected", no audio | one-session limit answered with 503, and the page never retried | fixed: newest tab takes over; the page reconnects with backoff |
| answer cut off while you speak | two-word speaker bleed passed the echo test | fixed: short transcripts must be entirely the assistant's own words |
| the pod's volume stall freezes the demo | server stdout went to a network (FUSE) mount | fixed: log on local disk under a supervisor |
Known open behaviour: "What am I asking you right now?" is answered with the previous
question β a self-referential trap for a 4B model, left unfixed rather than masked.
## Licensing
- This repository's code: MIT.
- `models/qwen3.5-4b`: follows the upstream Qwen licence.
- Qwen3-TTS, faster-whisper (MIT) and Mimi are downloaded separately from their
public repositories and keep their own licences.
|