Text Generation
Transformers
Safetensors
English
speech
duplex
voice-assistant
streaming
tool-calling
qwen
text-to-speech
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
|
Download README.md from sadmN/aiden-duplex: direct link, hf CLI and curl.
- Browser
- Download file 8.29 kB
-
https://huggingface.co/sadmN/aiden-duplex/resolve/main/README.md
- Command line
-
hf download hf://sadmN/aiden-duplex/README.md
-
curl -L -o README.md https://huggingface.co/sadmN/aiden-duplex/resolve/main/README.md
8.29 kB
| 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. | |