duplexjev 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- duplexjev-0.1.0/LICENSE +202 -0
- duplexjev-0.1.0/NOTICE +19 -0
- duplexjev-0.1.0/PKG-INFO +68 -0
- duplexjev-0.1.0/PYPI.md +27 -0
- duplexjev-0.1.0/README.md +183 -0
- duplexjev-0.1.0/duplexjev/__init__.py +11 -0
- duplexjev-0.1.0/duplexjev/cli.py +77 -0
- duplexjev-0.1.0/duplexjev/decider.py +439 -0
- duplexjev-0.1.0/duplexjev/question.py +95 -0
- duplexjev-0.1.0/duplexjev/server.py +131 -0
- duplexjev-0.1.0/duplexjev.egg-info/PKG-INFO +68 -0
- duplexjev-0.1.0/duplexjev.egg-info/SOURCES.txt +20 -0
- duplexjev-0.1.0/duplexjev.egg-info/dependency_links.txt +1 -0
- duplexjev-0.1.0/duplexjev.egg-info/entry_points.txt +2 -0
- duplexjev-0.1.0/duplexjev.egg-info/requires.txt +27 -0
- duplexjev-0.1.0/duplexjev.egg-info/top_level.txt +1 -0
- duplexjev-0.1.0/pyproject.toml +42 -0
- duplexjev-0.1.0/setup.cfg +4 -0
- duplexjev-0.1.0/tests/test_decider_speech.py +54 -0
- duplexjev-0.1.0/tests/test_decider_text.py +66 -0
- duplexjev-0.1.0/tests/test_question.py +29 -0
- duplexjev-0.1.0/tests/test_server.py +34 -0
duplexjev-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2024 Alibaba Cloud
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
duplexjev-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
DuplexJev
|
|
2
|
+
Copyright 2026 Adventists.ai and the DuplexJev authors.
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (see LICENSE), except where noted below.
|
|
5
|
+
|
|
6
|
+
Third-party components
|
|
7
|
+
- Ultravox (https://github.com/fixie-ai/ultravox), MIT License, Copyright (c) 2023 Fixie.ai.
|
|
8
|
+
Training code in training/ patches and extends Ultravox; the projector design follows Ultravox.
|
|
9
|
+
- Qwen3 / Qwen3-ASR (https://github.com/QwenLM), Apache License 2.0. duplexjev/encoder/ is derived from the
|
|
10
|
+
Qwen3-ASR encoder implementation.
|
|
11
|
+
- Model weights released with this project contain only the trained fusion and projector parameters; the frozen
|
|
12
|
+
Qwen3-ASR-0.6B encoder and Qwen3-32B LLM must be obtained from their original sources under their licenses.
|
|
13
|
+
|
|
14
|
+
Datasets
|
|
15
|
+
- qa100 (https://huggingface.co/datasets/adventists-ai/qa100): created by the authors, released under CC-BY-4.0. Audio synthesised with VoxCPM2.
|
|
16
|
+
- Training data (Ultravox v0.6 mixture: WenetSpeech, GigaSpeech, Common Voice 17, People's Speech, LibriSpeech,
|
|
17
|
+
Multilingual LibriSpeech, CoVoST 2, MUSAN) is NOT redistributed; see each dataset's license.
|
|
18
|
+
- ZJU audio-gender-benchmark (https://github.com/Vsky-morigen/audio-gender-benchmark) is used for evaluation only and
|
|
19
|
+
is NOT redistributed here. Its main-language subset includes ODSQA audio whose redistribution terms are unclear.
|
duplexjev-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: duplexjev
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Batched typed speech decisions without decoding: one forward pass answers many closed-set questions about many calls.
|
|
5
|
+
Author: Adventists.ai
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://adventists-ai.github.io/duplexjev/
|
|
8
|
+
Project-URL: Repository, https://github.com/adventists-ai/duplexjev
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
License-File: NOTICE
|
|
17
|
+
Requires-Dist: torch>=2.1
|
|
18
|
+
Requires-Dist: transformers<4.58,>=4.51
|
|
19
|
+
Requires-Dist: numpy
|
|
20
|
+
Requires-Dist: soundfile
|
|
21
|
+
Requires-Dist: scipy
|
|
22
|
+
Provides-Extra: speech
|
|
23
|
+
Requires-Dist: accelerate; extra == "speech"
|
|
24
|
+
Requires-Dist: peft; extra == "speech"
|
|
25
|
+
Requires-Dist: transformers<4.56,>=4.51; extra == "speech"
|
|
26
|
+
Provides-Extra: server
|
|
27
|
+
Requires-Dist: fastapi; extra == "server"
|
|
28
|
+
Requires-Dist: uvicorn; extra == "server"
|
|
29
|
+
Requires-Dist: pydantic>=2; extra == "server"
|
|
30
|
+
Provides-Extra: all
|
|
31
|
+
Requires-Dist: accelerate; extra == "all"
|
|
32
|
+
Requires-Dist: peft; extra == "all"
|
|
33
|
+
Requires-Dist: transformers<4.56,>=4.51; extra == "all"
|
|
34
|
+
Requires-Dist: fastapi; extra == "all"
|
|
35
|
+
Requires-Dist: uvicorn; extra == "all"
|
|
36
|
+
Requires-Dist: pydantic>=2; extra == "all"
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest; extra == "dev"
|
|
39
|
+
Requires-Dist: httpx; extra == "dev"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# duplexjev
|
|
43
|
+
|
|
44
|
+
Batched typed speech decisions without decoding. Every question — *has the user finished? which filler? which intent?*
|
|
45
|
+
— is answered as a probability over its options from a **single forward pass**, with no ASR or text decoding. Many
|
|
46
|
+
questions about many calls share one pass, with exact prefix sharing.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install duplexjev # text models
|
|
50
|
+
pip install "duplexjev[all]" # + speech checkpoints and the HTTP server
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from duplexjev import Decider, Question
|
|
55
|
+
|
|
56
|
+
d = Decider.from_pretrained("Qwen/Qwen3-8B") # any causal LM; or a speech checkpoint (see below)
|
|
57
|
+
qs = [Question("turn", "Has the user finished the turn?", ["finished", "not finished"]),
|
|
58
|
+
Question("intent", "What does the user want?", ["climate", "media", "navigation", "phone"])]
|
|
59
|
+
d.decide(["Turn on the air conditioning", "Navigate to the"], qs)
|
|
60
|
+
# [{'turn': {'answer': 'finished', 'confidence': 0.97, 'probs': {...}}, 'intent': {...}}, {...}]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Speech checkpoints (Ultravox format, including the DuplexJev adapters) take audio directly:
|
|
64
|
+
`Decider.from_pretrained("fixie-ai/ultravox-v0_6-qwen-3-32b").decide(["call1.wav", "call2.wav"], qs)`.
|
|
65
|
+
|
|
66
|
+
Serve with tick batching: `duplexjev serve --model <id> --tick-ms 160`.
|
|
67
|
+
|
|
68
|
+
Project: https://github.com/adventists-ai/duplexjev · License: Apache-2.0
|
duplexjev-0.1.0/PYPI.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# duplexjev
|
|
2
|
+
|
|
3
|
+
Batched typed speech decisions without decoding. Every question — *has the user finished? which filler? which intent?*
|
|
4
|
+
— is answered as a probability over its options from a **single forward pass**, with no ASR or text decoding. Many
|
|
5
|
+
questions about many calls share one pass, with exact prefix sharing.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install duplexjev # text models
|
|
9
|
+
pip install "duplexjev[all]" # + speech checkpoints and the HTTP server
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
from duplexjev import Decider, Question
|
|
14
|
+
|
|
15
|
+
d = Decider.from_pretrained("Qwen/Qwen3-8B") # any causal LM; or a speech checkpoint (see below)
|
|
16
|
+
qs = [Question("turn", "Has the user finished the turn?", ["finished", "not finished"]),
|
|
17
|
+
Question("intent", "What does the user want?", ["climate", "media", "navigation", "phone"])]
|
|
18
|
+
d.decide(["Turn on the air conditioning", "Navigate to the"], qs)
|
|
19
|
+
# [{'turn': {'answer': 'finished', 'confidence': 0.97, 'probs': {...}}, 'intent': {...}}, {...}]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Speech checkpoints (Ultravox format, including the DuplexJev adapters) take audio directly:
|
|
23
|
+
`Decider.from_pretrained("fixie-ai/ultravox-v0_6-qwen-3-32b").decide(["call1.wav", "call2.wav"], qs)`.
|
|
24
|
+
|
|
25
|
+
Serve with tick batching: `duplexjev serve --model <id> --tick-ms 160`.
|
|
26
|
+
|
|
27
|
+
Project: https://github.com/adventists-ai/duplexjev · License: Apache-2.0
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/banner_dark.svg">
|
|
4
|
+
<img src="docs/assets/banner_light.svg" alt="DuplexJev — batched speech decisions without decoding" width="880">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<b>English</b> | <a href="README_CN.md">中文</a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
🌐 <a href="https://adventists-ai.github.io/duplexjev/">Project page</a> |
|
|
14
|
+
📄 Paper (arXiv, coming soon) |
|
|
15
|
+
🤗 Weights (coming soon) |
|
|
16
|
+
📊 <a href="https://huggingface.co/datasets/adventists-ai/qa100">qa100</a> |
|
|
17
|
+
📝 <a href="#9-citation">Citation</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 1. Introduction
|
|
23
|
+
|
|
24
|
+
**DuplexJev** turns a frozen speech LLM into a *typed decision engine* for full-duplex spoken agents
|
|
25
|
+
(product name: **Speech-to-Decision**). Hidden states of an off-the-shelf ASR encoder are projected into a frozen
|
|
26
|
+
LLM, and every runtime-declared question — *is the turn complete? which filler to play? which flow step?* — is read
|
|
27
|
+
as a **single-token, closed-set distribution**: no ASR decoding, no text decoding. Many questions, about one call or
|
|
28
|
+
across many calls, share one forward pass.
|
|
29
|
+
|
|
30
|
+
Paper: *Batched Speech Decisions Without Decoding: A Modular Decision Sidecar for Full-Duplex Spoken Agents*
|
|
31
|
+
(ICASSP 2027 submission).
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
audio ──► frozen ASR encoder (Qwen3-ASR-0.6B, 12.5 Hz)
|
|
35
|
+
├─ B: last layer h18 ─────────────────────────────┐
|
|
36
|
+
└─ A: cross-attention fusion Q=h18, K=h14, V=h9 ─┤ (zero-init, residual)
|
|
37
|
+
▼
|
|
38
|
+
projector (stack 2 frames → 6.25 tokens/s, MLP → d_LLM)
|
|
39
|
+
▼
|
|
40
|
+
state + N typed questions ──► frozen LLM (Qwen3-32B), ONE forward pass
|
|
41
|
+
▼
|
|
42
|
+
p(A|q1) … p(D|q1), …, p(A|qN) … p(D|qN) — 0 decode steps
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- **Typed single-token readout.** Each question lists its options under permuted letters; the answer is the
|
|
46
|
+
next-token softmax restricted to those letters. The output is always valid, and `max p` is a confidence score.
|
|
47
|
+
- **Prefix sharing.** Template, dialogue context and audio are encoded once; all question suffixes are packed into one
|
|
48
|
+
row under a block-diagonal 4-D mask, with position ids restarting at the prefix length. The KV cache holds
|
|
49
|
+
`P + ΣL_i` positions instead of `N(P + L)`, and answers match one-by-one runs up to bf16 noise.
|
|
50
|
+
- **Modular.** Any ASR encoder, a small trainable projector (39.9 M parameters; +3.2 M for the fusion in variant A)
|
|
51
|
+
and any frozen LLM that accepts input embeddings.
|
|
52
|
+
|
|
53
|
+
## 2. News
|
|
54
|
+
|
|
55
|
+
- **2026-09** — Paper submitted to ICASSP 2027. Released the `duplexjev` package (batched decider, tick server), research code, latency benchmarks and project page.
|
|
56
|
+
- **2026-10-10 (planned)** — Speech-to-Decision commercial API.
|
|
57
|
+
- **2026-10-15 (planned)** — Open-source inference pipeline and model weights.
|
|
58
|
+
|
|
59
|
+
## 3. Model download
|
|
60
|
+
|
|
61
|
+
Each checkpoint is an **adapter for one specific pair of models**: it contains only the trained projector (and, for A,
|
|
62
|
+
the fusion block) that connects the frozen ASR encoder below to the frozen LLM below. It does not work with other
|
|
63
|
+
encoders or LLMs, including other sizes of the same family; supporting another pair means training a new adapter.
|
|
64
|
+
|
|
65
|
+
| model | ASR encoder (frozen) | LLM (frozen) | encoder read-out | trainable params | download |
|
|
66
|
+
|---|---|---|---|---:|---|
|
|
67
|
+
| DuplexJev-A | [Qwen3-ASR-0.6B](https://huggingface.co/Qwen/Qwen3-ASR-0.6B) | [Qwen3-32B](https://huggingface.co/Qwen/Qwen3-32B) | cross-attention fusion (h18 / h14 / h9) | 43.1 M | 🤗 `DuplexJev-A-Qwen3-ASR-0.6B-Qwen3-32B` (coming soon) |
|
|
68
|
+
| DuplexJev-B | [Qwen3-ASR-0.6B](https://huggingface.co/Qwen/Qwen3-ASR-0.6B) | [Qwen3-32B](https://huggingface.co/Qwen/Qwen3-32B) | last layer (h18) | 39.9 M | 🤗 `DuplexJev-B-Qwen3-ASR-0.6B-Qwen3-32B` (coming soon) |
|
|
69
|
+
|
|
70
|
+
Download the encoder and the LLM from their original repositories and load the adapter on top. Adapter repositories
|
|
71
|
+
are named `DuplexJev-<variant>-<ASR encoder>-<LLM>`, so adapters for other model pairs can be added later.
|
|
72
|
+
|
|
73
|
+
## 4. Quick start
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install "duplexjev[all] @ git+https://github.com/adventists-ai/duplexjev.git"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Any open LLM, transcripts in** (no speech model needed):
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from duplexjev import Decider, Question
|
|
83
|
+
|
|
84
|
+
d = Decider.from_pretrained("Qwen/Qwen3-8B")
|
|
85
|
+
qs = [Question("turn", "Has the user finished the turn?", ["finished", "not finished"]),
|
|
86
|
+
Question("intent", "What does the user want?", ["climate", "media", "navigation", "phone"])]
|
|
87
|
+
d.decide(["Turn on the air conditioning", "Navigate to the"], qs)
|
|
88
|
+
# [{'turn': {'answer': 'finished', 'confidence': 0.97, 'probs': {...}}, 'intent': {...}}, {...}]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Speech checkpoints, audio in** (Ultravox format; the DuplexJev adapters load the same way):
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
d = Decider.from_pretrained("fixie-ai/ultravox-v0_6-qwen-3-32b")
|
|
95
|
+
d.decide(["call_017.wav", "call_018.wav"], qs) # one pass for all calls and all questions
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Batched server:** every request that arrives within one tick is answered in one pass.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
duplexjev serve --model fixie-ai/ultravox-v0_6-qwen-3-32b --tick-ms 160
|
|
102
|
+
curl -s localhost:8000/v1/decide -H 'content-type: application/json' \
|
|
103
|
+
-d '{"text": "Call my", "questions": [{"id": "turn", "text": "Has the user finished?", "options": ["finished", "not finished"]}]}'
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
What the package guarantees (unit tests in `tests/`, checked on Qwen3-32B and Ultravox v0.6 on an A800):
|
|
107
|
+
|
|
108
|
+
- **0 decode steps.** Each answer is the next-token softmax over its option letters; options appear under permuted letters (`n_perm` averages several orders).
|
|
109
|
+
- **Exact prefix sharing** (`mode="packed"`, default): the context and audio of an item are encoded once and all its questions are packed into one row under a block-diagonal mask. In fp32 on Qwen3-32B, packed and one-row-per-question differ by at most 2e-5; in bf16 the mean difference is 0.001–0.002, with at most 1/100 answers changed.
|
|
110
|
+
- **Batch invariance.** An item's answers do not depend on which other items share the pass (fp32: max difference 1e-5). For speech this requires aligning every clip to whole audio tokens, which the package does (batched Ultravox inference otherwise leaks padding into the last audio token of shorter clips). In bf16, GPU kernels depend on batch shape, so running an item alone vs. in a batch changed 1/100 answers (text and speech).
|
|
111
|
+
- **Checked accuracy.** qa100 through the package: 0.88–0.90 with Ultravox v0.6 (audio), 0.92 with Qwen3-32B (transcript).
|
|
112
|
+
- **Speed (current).** Plain PyTorch, one A800, bf16: 8 questions for 64 calls in 9 s (about 140 ms per call); 48 concurrent server requests are answered in one tick. The paper's latency numbers use a vLLM engine; a vLLM backend for the package is on the roadmap.
|
|
113
|
+
|
|
114
|
+
Speech checkpoints need transformers 4.51–4.55 (installed by the `speech` extra); text models also work with newer versions.
|
|
115
|
+
|
|
116
|
+
More in [`examples/`](examples): tick-batch timing, server client, speech quick start.
|
|
117
|
+
|
|
118
|
+
## 5. Evaluation results
|
|
119
|
+
|
|
120
|
+
**Latency and capacity** (1× H200, bf16, Qwen3-32B; ten decisions per event, 30 real utterances of 2–12 s, the same
|
|
121
|
+
vLLM engine for both methods):
|
|
122
|
+
|
|
123
|
+
| context | method | decode steps | 1 event | events/s within 0.25 s | 0.5 s | 2 s |
|
|
124
|
+
|---|---|---:|---:|---:|---:|---:|
|
|
125
|
+
| none | ASR → LLM generates JSON | 12.5 + 86 | 1,567 ms (+411 ms ASR) | 0 | 0 | 16.9 |
|
|
126
|
+
| none | single-token readout | 0 | 92 ms | 17.3 | 20.4 | 33.5 |
|
|
127
|
+
| 1.5k tokens | ASR → LLM generates JSON | 12.5 + 87 | 1,598 ms (+ASR) | 0 | 0 | 8.4 |
|
|
128
|
+
| 1.5k tokens | single-token readout | 0 | 144 ms | 9.7 | 12.0 | 18.4 |
|
|
129
|
+
|
|
130
|
+
**Prefix sharing** (one packed row vs sequential calls): 7× cheaper for 100 questions over a 1.5k-token context and
|
|
131
|
+
20× for 50 questions over a 5k-token context, with identical answers on 40/40 items.
|
|
132
|
+
|
|
133
|
+
**Accuracy** on the benchmarks below will be added with the final checkpoints; see [`evaluation/`](evaluation).
|
|
134
|
+
|
|
135
|
+
| benchmark | task | link |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| qa100 | spoken multiple-choice, synthetic speech (zh + en) | 🤗 [adventists-ai/qa100](https://huggingface.co/datasets/adventists-ai/qa100) |
|
|
138
|
+
| ZJU audio-gender-benchmark · `gender` | speaker gender (zh + en, real + TTS) | [GitHub](https://github.com/Vsky-morigen/audio-gender-benchmark) |
|
|
139
|
+
| ZJU audio-gender-benchmark · `main_language` | spoken multiple-choice, real speech | [GitHub](https://github.com/Vsky-morigen/audio-gender-benchmark) |
|
|
140
|
+
|
|
141
|
+
## 6. Training
|
|
142
|
+
|
|
143
|
+
Frozen Qwen3-ASR-0.6B encoder and frozen Qwen3-32B; only the projector (and fusion block) is trained, with a patched
|
|
144
|
+
[Ultravox](https://github.com/fixie-ai/ultravox) on the Ultravox v0.6 mixture (WenetSpeech, GigaSpeech, Common Voice,
|
|
145
|
+
CoVoST 2, People's Speech, LibriSpeech, MLS, MUSAN). The mixture is split into 100 disjoint packs that each keep the
|
|
146
|
+
official ratio. Recipe, data links and scripts: [`training/`](training).
|
|
147
|
+
|
|
148
|
+
## 7. Repository layout
|
|
149
|
+
|
|
150
|
+
| path | contents |
|
|
151
|
+
|---|---|
|
|
152
|
+
| [`duplexjev/`](duplexjev) | the installable package: `Decider`, `Question`, CLI and tick-batched server |
|
|
153
|
+
| [`duplexjev/research/`](duplexjev/research) | paper code: readout, question contract, encoder with fusion |
|
|
154
|
+
| [`tests/`](tests) | equivalence and batch-invariance tests |
|
|
155
|
+
| [`examples/`](examples) | quick starts, tick-batch timing, server client |
|
|
156
|
+
| [`evaluation/`](evaluation) | benchmark runners and where to get each benchmark |
|
|
157
|
+
| [`training/`](training) | Ultravox configs and patches, data recipe, 100-pack split, continuation generation |
|
|
158
|
+
| [`benchmarks/`](benchmarks) | latency, SLO capacity and prefix-sharing experiments |
|
|
159
|
+
| [`docs/`](docs) | project page |
|
|
160
|
+
|
|
161
|
+
The paper code still contains paths from our cluster; see [docs/PATHS.md](docs/PATHS.md).
|
|
162
|
+
|
|
163
|
+
## 8. License
|
|
164
|
+
|
|
165
|
+
Code and model weights: Apache-2.0 ([LICENSE](LICENSE)). qa100: CC-BY-4.0. Third-party models and datasets keep their
|
|
166
|
+
own licenses; see [NOTICE](NOTICE).
|
|
167
|
+
|
|
168
|
+
## 9. Citation
|
|
169
|
+
|
|
170
|
+
```bibtex
|
|
171
|
+
@misc{jin2026duplexjev,
|
|
172
|
+
title = {Batched Speech Decisions Without Decoding: A Modular Decision Sidecar for Full-Duplex Spoken Agents},
|
|
173
|
+
author = {Jin, Jie and Ma, Ziyin and Yin, Min and Chen, Jinyu and Pang, Zhikun and Zhang, Xiaowen},
|
|
174
|
+
year = {2026},
|
|
175
|
+
note = {ICASSP 2027 submission}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## 10. Acknowledgements
|
|
180
|
+
|
|
181
|
+
Built on [Ultravox](https://github.com/fixie-ai/ultravox), [Qwen3](https://github.com/QwenLM/Qwen3) and Qwen3-ASR.
|
|
182
|
+
We thank the ZJU team for the [audio-gender-benchmark](https://github.com/Vsky-morigen/audio-gender-benchmark).
|
|
183
|
+
Questions and issues: [GitHub Issues](https://github.com/adventists-ai/duplexjev/issues).
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""DuplexJev: batched typed speech decisions without decoding.
|
|
2
|
+
|
|
3
|
+
from duplexjev import Decider, Question
|
|
4
|
+
d = Decider.from_pretrained("Qwen/Qwen3-0.6B") # any causal LM (text), or a speech checkpoint
|
|
5
|
+
d.decide(["I want to turn on the"], [Question("turn", "Has the user finished?", ["finished", "not finished"])])
|
|
6
|
+
"""
|
|
7
|
+
from .decider import Decider, load_audio
|
|
8
|
+
from .question import Question
|
|
9
|
+
|
|
10
|
+
__all__ = ["Decider", "Question", "load_audio"]
|
|
11
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Command line: ``duplexjev decide`` for one-off runs, ``duplexjev serve`` for the tick-batched HTTP server."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
import json
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
from .question import Question
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _questions(args) -> list[Question]:
|
|
12
|
+
qs = []
|
|
13
|
+
if args.questions:
|
|
14
|
+
with open(args.questions, encoding="utf-8") as f:
|
|
15
|
+
qs += [Question.from_dict(q) for q in json.load(f)]
|
|
16
|
+
for spec in args.q or []:
|
|
17
|
+
# "id|question text|opt1,opt2,..."
|
|
18
|
+
qid, text, opts = spec.split("|", 2)
|
|
19
|
+
qs.append(Question(qid, text, [o.strip() for o in opts.split(",")], lang=args.lang or "en"))
|
|
20
|
+
if not qs:
|
|
21
|
+
sys.exit("give --questions FILE.json or at least one --q 'id|text|opt1,opt2'")
|
|
22
|
+
return qs
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def main(argv=None):
|
|
26
|
+
ap = argparse.ArgumentParser(prog="duplexjev")
|
|
27
|
+
sub = ap.add_subparsers(dest="cmd", required=True)
|
|
28
|
+
|
|
29
|
+
common = argparse.ArgumentParser(add_help=False)
|
|
30
|
+
common.add_argument("--model", required=True, help="HF id or path: any causal LM, or an Ultravox/DuplexJev speech checkpoint")
|
|
31
|
+
common.add_argument("--text-model", help="override the LLM a speech checkpoint points to (e.g. a local path)")
|
|
32
|
+
common.add_argument("--audio-model", help="override the encoder a speech checkpoint points to")
|
|
33
|
+
common.add_argument("--device")
|
|
34
|
+
|
|
35
|
+
d = sub.add_parser("decide", parents=[common], help="answer questions about audio files or transcripts")
|
|
36
|
+
d.add_argument("--audio", nargs="*", default=[], help="audio files (one item each)")
|
|
37
|
+
d.add_argument("--text", nargs="*", default=[], help="transcripts (one item each)")
|
|
38
|
+
d.add_argument("--context")
|
|
39
|
+
d.add_argument("--questions", help="JSON list of {id, text, options, lang}")
|
|
40
|
+
d.add_argument("--q", action="append", help="inline question: 'id|text|opt1,opt2,...' (repeatable)")
|
|
41
|
+
d.add_argument("--lang", choices=["en", "zh"])
|
|
42
|
+
d.add_argument("--mode", default="packed", choices=["packed", "batch"])
|
|
43
|
+
d.add_argument("--n-perm", type=int, default=1)
|
|
44
|
+
|
|
45
|
+
s = sub.add_parser("serve", parents=[common], help="HTTP server; batches all requests of each tick")
|
|
46
|
+
s.add_argument("--host", default="0.0.0.0")
|
|
47
|
+
s.add_argument("--port", type=int, default=8000)
|
|
48
|
+
s.add_argument("--tick-ms", type=float, default=160.0)
|
|
49
|
+
s.add_argument("--max-items", type=int, help="max items per forward pass")
|
|
50
|
+
|
|
51
|
+
args = ap.parse_args(argv)
|
|
52
|
+
from .decider import Decider
|
|
53
|
+
|
|
54
|
+
dec = Decider.from_pretrained(args.model, device=args.device, text_model=args.text_model, audio_model=args.audio_model)
|
|
55
|
+
if args.cmd == "decide":
|
|
56
|
+
items = [{"audio": a} for a in args.audio] + [{"text": t} for t in args.text]
|
|
57
|
+
if not items:
|
|
58
|
+
sys.exit("give --audio and/or --text")
|
|
59
|
+
for it in items:
|
|
60
|
+
if args.context:
|
|
61
|
+
it["context"] = args.context
|
|
62
|
+
if args.lang:
|
|
63
|
+
it["lang"] = args.lang
|
|
64
|
+
res = dec.decide(items, _questions(args), mode=args.mode, n_perm=args.n_perm)
|
|
65
|
+
names = args.audio + args.text
|
|
66
|
+
print(json.dumps({"results": [{"input": n, "answers": r} for n, r in zip(names, res)], "pass": dec.last_stats},
|
|
67
|
+
ensure_ascii=False, indent=1))
|
|
68
|
+
else:
|
|
69
|
+
import uvicorn
|
|
70
|
+
|
|
71
|
+
from .server import create_app
|
|
72
|
+
|
|
73
|
+
uvicorn.run(create_app(dec, tick_ms=args.tick_ms, max_items=args.max_items), host=args.host, port=args.port)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
if __name__ == "__main__":
|
|
77
|
+
main()
|