Github repository for paper: Think Before You Talk: Enhancing Meaningful Dialogue Generation in Full-Duplex Speech Language Models with Planning-Inspired Text Guidance
Python
14
6 commits
updated Jun 15, 2026
Github repository for paper: TurnGuide: Enhancing Meaningful Full Duplex Spoken Interactions via Dynamic Turn-Level Text-Speech Interleaving
Explore the demo!
This work introduces an end-to-end full-duplex speech language model and strengthens its capabilities to generate coherent, meaningful full duplex dialogues. As an initial release, we provide the test splits from the Fisher and Candor datasets to support fair and straightforward benchmarking for future research.
This repository includes the TurnGuide inference demo together with the GLM-4-Voice code modules needed to run it:
turnguide_inference.py: the current TurnGuide inference script.turnguide_inference_reproducible.py: a legacy/reproducible inference variant.flow_inference.py, speech_tokenizer/, cosyvoice/, and third_party/Matcha-TTS/: supporting code from GLM-4-Voice and its decoder stack.The model weights are not included in this repository. Download the GLM-4-Voice decoder separately and pass model paths explicitly when needed.
Model assets:
The two TurnGuide checkpoints differ only in the training loss ratio between text tokens and speech tokens:
qqjz/turnguide_loss_2_1: text:speech token loss ratio = 2:1qqjz/turnguide_loss_3_1: text:speech token loss ratio = 3:1Both checkpoints can be used with the same inference script by changing --model-path.
The recommended environment is exported from the tested torch250cu121 setup used for TurnGuide inference. It uses Python 3.10, PyTorch 2.5.0, torchaudio 2.5.0, and CUDA 12.1.
conda env create -f environment.yml
conda activate turnguide
The environment pins mkl=2021.4.0 because newer MKL builds can break PyTorch 2.5.0 imports with an iJIT_NotifyEvent symbol error. It also includes tiktoken for the TurnGuide tokenizer remote code and ruamel.yaml==0.18.6 for GLM-4-Voice decoder config loading through HyperPyYAML.
To check the core runtime versions:
python -c "import torch, torchaudio, transformers; print(torch.__version__); print(torch.version.cuda); print(torchaudio.__version__); print(transformers.__version__); print(torch.cuda.is_available())"
Expected core versions:
torch 2.5.0
CUDA 12.1
torchaudio 2.5.0
transformers 4.44.1
If you already have a CUDA 12.1 PyTorch environment, you can install only the pip-side dependencies with:
pip install -r requirements.txt
git clone https://huggingface.co/zai-org/glm-4-voice-decoder
python turnguide_inference.py \
--input-audio examples/audio/fe_03_05844_first_2min_left.wav \
--model-path qqjz/turnguide_loss_2_1 \
--tokenizer-path zai-org/glm-4-voice-tokenizer \
--flow-path ./glm-4-voice-decoder \
--output-dir ./turnguide_demo_output
To use the 3:1 checkpoint, replace --model-path qqjz/turnguide_loss_2_1 with --model-path qqjz/turnguide_loss_3_1. You can also pass a local checkpoint directory.
This repository includes examples/audio/fe_03_05844_first_2min_left.wav as a small example input for the inference command above. You can replace it with any mono user-audio WAV file.
Examples:
fe_03_11632_60_180.wav
fe_03_1163246f8e9b8-f80a-48cf-90a0-2e29908202c0_420.0_540.0.wav
46f8e9b8-f80a-48cf-90a0-2e29908202c0Download Fisher and Candor datasets.
This code release builds on GLM-4-Voice. The included GLM-4-Voice code is licensed under Apache-2.0. GLM-4-Voice model weights are governed by their own model license and must be downloaded separately.
@article{turnguide2026,
title={TurnGuide: Enhancing Meaningful Full Duplex Spoken Interactions via Dynamic Turn-Level Text-Speech Interleaving},
author={Cui, Wenqian and Zhu, Lei and Li, Xiao-Hui and Guo, Zhihan and Bai, Haoli and Hou, Lu and King, Irwin},
journal={arXiv preprint arXiv:2508.07375},
year={2026}
}
6 commits
Python
100.0%
Github repository for paper: Think Before You Talk: Enhancing Meaningful Dialogue Generation in Full-Duplex Speech Language Models with Planning-Inspired Text Guidance
Python
14
6 commits
updated Jun 15, 2026
Github repository for paper: TurnGuide: Enhancing Meaningful Full Duplex Spoken Interactions via Dynamic Turn-Level Text-Speech Interleaving
Explore the demo!
This work introduces an end-to-end full-duplex speech language model and strengthens its capabilities to generate coherent, meaningful full duplex dialogues. As an initial release, we provide the test splits from the Fisher and Candor datasets to support fair and straightforward benchmarking for future research.
This repository includes the TurnGuide inference demo together with the GLM-4-Voice code modules needed to run it:
turnguide_inference.py: the current TurnGuide inference script.turnguide_inference_reproducible.py: a legacy/reproducible inference variant.flow_inference.py, speech_tokenizer/, cosyvoice/, and third_party/Matcha-TTS/: supporting code from GLM-4-Voice and its decoder stack.The model weights are not included in this repository. Download the GLM-4-Voice decoder separately and pass model paths explicitly when needed.
Model assets:
The two TurnGuide checkpoints differ only in the training loss ratio between text tokens and speech tokens:
qqjz/turnguide_loss_2_1: text:speech token loss ratio = 2:1qqjz/turnguide_loss_3_1: text:speech token loss ratio = 3:1Both checkpoints can be used with the same inference script by changing --model-path.
The recommended environment is exported from the tested torch250cu121 setup used for TurnGuide inference. It uses Python 3.10, PyTorch 2.5.0, torchaudio 2.5.0, and CUDA 12.1.
conda env create -f environment.yml
conda activate turnguide
The environment pins mkl=2021.4.0 because newer MKL builds can break PyTorch 2.5.0 imports with an iJIT_NotifyEvent symbol error. It also includes tiktoken for the TurnGuide tokenizer remote code and ruamel.yaml==0.18.6 for GLM-4-Voice decoder config loading through HyperPyYAML.
To check the core runtime versions:
python -c "import torch, torchaudio, transformers; print(torch.__version__); print(torch.version.cuda); print(torchaudio.__version__); print(transformers.__version__); print(torch.cuda.is_available())"
Expected core versions:
torch 2.5.0
CUDA 12.1
torchaudio 2.5.0
transformers 4.44.1
If you already have a CUDA 12.1 PyTorch environment, you can install only the pip-side dependencies with:
pip install -r requirements.txt
git clone https://huggingface.co/zai-org/glm-4-voice-decoder
python turnguide_inference.py \
--input-audio examples/audio/fe_03_05844_first_2min_left.wav \
--model-path qqjz/turnguide_loss_2_1 \
--tokenizer-path zai-org/glm-4-voice-tokenizer \
--flow-path ./glm-4-voice-decoder \
--output-dir ./turnguide_demo_output
To use the 3:1 checkpoint, replace --model-path qqjz/turnguide_loss_2_1 with --model-path qqjz/turnguide_loss_3_1. You can also pass a local checkpoint directory.
This repository includes examples/audio/fe_03_05844_first_2min_left.wav as a small example input for the inference command above. You can replace it with any mono user-audio WAV file.
Examples:
fe_03_11632_60_180.wav
fe_03_1163246f8e9b8-f80a-48cf-90a0-2e29908202c0_420.0_540.0.wav
46f8e9b8-f80a-48cf-90a0-2e29908202c0Download Fisher and Candor datasets.
This code release builds on GLM-4-Voice. The included GLM-4-Voice code is licensed under Apache-2.0. GLM-4-Voice model weights are governed by their own model license and must be downloaded separately.
@article{turnguide2026,
title={TurnGuide: Enhancing Meaningful Full Duplex Spoken Interactions via Dynamic Turn-Level Text-Speech Interleaving},
author={Cui, Wenqian and Zhu, Lei and Li, Xiao-Hui and Guo, Zhihan and Bai, Haoli and Hou, Lu and King, Irwin},
journal={arXiv preprint arXiv:2508.07375},
year={2026}
}
6 commits
Python
100.0%