premove-itn 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.
- premove_itn-0.1.0/LICENSE +21 -0
- premove_itn-0.1.0/LICENSES/text-processing-rs-Apache-2.0.txt +201 -0
- premove_itn-0.1.0/LICENSES/text-processing-rs-NOTICE.txt +9 -0
- premove_itn-0.1.0/PKG-INFO +390 -0
- premove_itn-0.1.0/README.md +363 -0
- premove_itn-0.1.0/THIRD_PARTY_NOTICES.md +34 -0
- premove_itn-0.1.0/pyproject.toml +62 -0
- premove_itn-0.1.0/rust/Cargo.lock +199 -0
- premove_itn-0.1.0/rust/Cargo.toml +24 -0
- premove_itn-0.1.0/rust/build.rs +31 -0
- premove_itn-0.1.0/rust/src/lib.rs +7210 -0
- premove_itn-0.1.0/rust/tests/unit/realizers.rs +1454 -0
- premove_itn-0.1.0/src/premove_itn/__init__.py +62 -0
- premove_itn-0.1.0/src/premove_itn/candidate_scorer.py +263 -0
- premove_itn-0.1.0/src/premove_itn/candidates.py +247 -0
- premove_itn-0.1.0/src/premove_itn/cli.py +69 -0
- premove_itn-0.1.0/src/premove_itn/contextual.py +228 -0
- premove_itn-0.1.0/src/premove_itn/decoder.py +85 -0
- premove_itn-0.1.0/src/premove_itn/inference_artifact.py +137 -0
- premove_itn-0.1.0/src/premove_itn/labels.py +22 -0
- premove_itn-0.1.0/src/premove_itn/model_inputs.py +104 -0
- premove_itn-0.1.0/src/premove_itn/structured_loss.py +229 -0
- premove_itn-0.1.0/src/premove_itn/training.py +489 -0
- premove_itn-0.1.0/src/premove_itn/training_batch.py +196 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 premove-ai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 FluidInference
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
text-processing-rs
|
|
2
|
+
Copyright 2026 FluidInference
|
|
3
|
+
|
|
4
|
+
This product is a Rust port of NVIDIA NeMo Text Processing
|
|
5
|
+
(https://github.com/NVIDIA/NeMo-text-processing), which is licensed
|
|
6
|
+
under the Apache License, Version 2.0.
|
|
7
|
+
|
|
8
|
+
Copyright (c) NVIDIA CORPORATION & AFFILIATES.
|
|
9
|
+
Licensed under the Apache License, Version 2.0.
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: premove-itn
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Requires-Dist: huggingface-hub>=0.36,<2
|
|
11
|
+
Requires-Dist: safetensors>=0.4,<1
|
|
12
|
+
Requires-Dist: torch==2.13.0
|
|
13
|
+
Requires-Dist: transformers[sentencepiece]==5.16.1
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
License-File: LICENSES/text-processing-rs-Apache-2.0.txt
|
|
16
|
+
License-File: LICENSES/text-processing-rs-NOTICE.txt
|
|
17
|
+
License-File: THIRD_PARTY_NOTICES.md
|
|
18
|
+
Summary: Contextual inverse text normalization for English voice-agent transcripts
|
|
19
|
+
Keywords: asr,inverse text normalization,nlp,speech processing,voice agents
|
|
20
|
+
Author: premove-ai
|
|
21
|
+
License-Expression: MIT
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
24
|
+
Project-URL: Issues, https://github.com/premove-ai/premove-itn/issues
|
|
25
|
+
Project-URL: Repository, https://github.com/premove-ai/premove-itn
|
|
26
|
+
|
|
27
|
+
# Premove ITN
|
|
28
|
+
|
|
29
|
+
Contextual inverse text normalization for English voice-agent transcripts.
|
|
30
|
+
|
|
31
|
+
Premove turns spoken-form ASR text into structured written text:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
call me at four thirty → call me at 04:30
|
|
35
|
+
the total is twenty dollars → the total is $20
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Deterministic Rust realizers propose valid written forms. A
|
|
39
|
+
DeBERTa-v3-large contextual scorer uses the complete transcript to choose among
|
|
40
|
+
them, and an exact decoder produces compatible, non-overlapping edits.
|
|
41
|
+
|
|
42
|
+
On the retained First Evaluation, Premove achieved **99.50% semantic accuracy
|
|
43
|
+
on 400 dedicated voice-agent rows** and **89.70% overall semantic accuracy on
|
|
44
|
+
1,500 frozen stress-suite rows**. Mean warm request latency was **56.49 ms** on
|
|
45
|
+
an Apple M4 using MPS and batch size one. See the [full First Evaluation report](eval/voice_agent_itn/results/first-evaluation/REPORT.md).
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
The package is prepared for:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install premove-itn
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Install the exact v0.1.0 release from PyPI:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install premove-itn==0.1.0
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The model weights are downloaded separately from the frozen
|
|
62
|
+
[`premove-ai/premove-itn`](https://huggingface.co/premove-ai/premove-itn)
|
|
63
|
+
Hugging Face release on first use.
|
|
64
|
+
|
|
65
|
+
## Python quickstart
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from premove_itn import PremoveITN
|
|
69
|
+
|
|
70
|
+
itn = PremoveITN.from_pretrained()
|
|
71
|
+
|
|
72
|
+
print(itn.normalize("call me at four thirty"))
|
|
73
|
+
# call me at 04:30
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Create one `PremoveITN` instance and keep it resident:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
texts = [
|
|
80
|
+
"call me at four thirty",
|
|
81
|
+
"the total is twenty dollars",
|
|
82
|
+
"the last account digits are zero eight two zero six three",
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
for text in texts:
|
|
86
|
+
print(itn.normalize(text))
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Model initialization is expensive. Warm normalization calls on an existing
|
|
90
|
+
instance are much faster than loading a new instance for each request.
|
|
91
|
+
|
|
92
|
+
## Command-line interface
|
|
93
|
+
|
|
94
|
+
Normalize one transcript:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
premove-itn "call me at four thirty"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
call me at 04:30
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Process newline-delimited transcripts:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
printf 'call me at four thirty\nthe total is twenty dollars\n' | premove-itn
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
call me at 04:30
|
|
112
|
+
the total is $20
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Stdin mode loads the model once, then processes every input line in order. It
|
|
116
|
+
is the correct CLI mode for files and long-lived transcript pipelines.
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
stdin process → one model load → line 1 → line 2 → line 3 → ...
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The CLI supports `--device auto`, `--device cpu`, `--device mps`,
|
|
123
|
+
`--device cuda`, `--version`, and `--help`. Normal stdout contains only
|
|
124
|
+
normalized transcripts. Diagnostics and errors use stderr.
|
|
125
|
+
|
|
126
|
+
## Why contextual ITN?
|
|
127
|
+
|
|
128
|
+
Obvious spoken values can often be normalized with fixed rules:
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
twenty dollars → $20
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The harder cases have several plausible written forms. For example, a number
|
|
135
|
+
sequence can represent a time, an identifier, a count, or part of a phone
|
|
136
|
+
number. Premove generates valid alternatives with deterministic rules, then
|
|
137
|
+
uses the surrounding sentence to score the intended interpretation.
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
ASR transcript
|
|
141
|
+
↓
|
|
142
|
+
structured Rust candidates
|
|
143
|
+
↓
|
|
144
|
+
full-sentence contextual scores
|
|
145
|
+
↓
|
|
146
|
+
exact interval decoding
|
|
147
|
+
↓
|
|
148
|
+
written transcript
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## How it works
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
Spoken ASR text
|
|
155
|
+
│
|
|
156
|
+
▼
|
|
157
|
+
Rust candidate generation
|
|
158
|
+
│ TIME / MONEY / PHONE / ID / ...
|
|
159
|
+
▼
|
|
160
|
+
DeBERTa-v3-large contextual scorer
|
|
161
|
+
│
|
|
162
|
+
▼
|
|
163
|
+
Exact maximum-score decoder
|
|
164
|
+
│
|
|
165
|
+
▼
|
|
166
|
+
Written transcript
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Rust candidate generation** deterministically proposes valid written
|
|
170
|
+
representations. It does not choose the intended interpretation.
|
|
171
|
+
|
|
172
|
+
**Contextual scoring** uses the complete sentence to score competing
|
|
173
|
+
candidates.
|
|
174
|
+
|
|
175
|
+
**Exact decoding** selects a compatible set of scored replacements without
|
|
176
|
+
overlapping edits.
|
|
177
|
+
|
|
178
|
+
The public runtime has one implementation path. Both the Python API and CLI
|
|
179
|
+
call `PremoveITN`; neither duplicates candidate generation or decoding.
|
|
180
|
+
|
|
181
|
+
## Performance
|
|
182
|
+
|
|
183
|
+
### Dedicated voice-agent rows
|
|
184
|
+
|
|
185
|
+
These results use only the 400 `group=voice_agent` rows: 50 rows in each of
|
|
186
|
+
eight voice-agent domains.
|
|
187
|
+
|
|
188
|
+
| Backend | Correct entities | Semantic accuracy | Mean latency |
|
|
189
|
+
| --- | ---: | ---: | ---: |
|
|
190
|
+
| **Premove ITN** | **398/400** | **99.50%** | 57.41 ms |
|
|
191
|
+
| Thutmose | 268/400 | 67.00% | 16.04 ms |
|
|
192
|
+
| text-processing-rs | 273/400 | 68.25% | 0.15 ms |
|
|
193
|
+
|
|
194
|
+
### Overall frozen benchmark
|
|
195
|
+
|
|
196
|
+
| Backend | Semantic accuracy | Strict exact | Mean latency |
|
|
197
|
+
| --- | ---: | ---: | ---: |
|
|
198
|
+
| **Premove ITN** | **89.70%** | **40.53%** | 56.49 ms |
|
|
199
|
+
| Thutmose | 59.39% | 22.13% | 15.98 ms |
|
|
200
|
+
| text-processing-rs | 55.79% | 16.53% | 0.14 ms |
|
|
201
|
+
|
|
202
|
+
Premove led semantic accuracy in this evaluation. It did not lead latency.
|
|
203
|
+
|
|
204
|
+
### Methodology
|
|
205
|
+
|
|
206
|
+
- The dataset is a frozen, balanced synthetic stress suite with 1,500 rows and
|
|
207
|
+
1,640 declared entities.
|
|
208
|
+
- The voice-agent result uses only the 400 dedicated voice-agent rows. Generic
|
|
209
|
+
multi-entity rows do not enter domain claims.
|
|
210
|
+
- Semantic entity accuracy is the main structured-value metric. It ignores
|
|
211
|
+
allowed display differences while preserving value, currency, unit, digit
|
|
212
|
+
order, phone form, and identifier case policy.
|
|
213
|
+
- Strict exact match scores the full canonical output and is reported
|
|
214
|
+
separately.
|
|
215
|
+
- Latency used sequential batch-one requests on an Apple M4 MacBook Air, MPS
|
|
216
|
+
completion, an optimized Rust extension, and eight Rayon workers.
|
|
217
|
+
- Models were initialized and warmed before request latency was measured.
|
|
218
|
+
- The benchmark is not an IID sample of live production traffic.
|
|
219
|
+
- The backend evaluation was blind: every backend received only transcript text
|
|
220
|
+
and did not receive gold spans, categories, domains, difficulty, or expected
|
|
221
|
+
output. Independent human gold adjudication is a separate task and remains
|
|
222
|
+
pending.
|
|
223
|
+
|
|
224
|
+
Read the [full report](eval/voice_agent_itn/results/first-evaluation/REPORT.md),
|
|
225
|
+
[detailed tables](eval/voice_agent_itn/results/first-evaluation/DETAILS.md), and
|
|
226
|
+
[reproduction guide](benchmarks/README.md).
|
|
227
|
+
|
|
228
|
+
## Model lifecycle and latency
|
|
229
|
+
|
|
230
|
+
Three different costs must not be combined:
|
|
231
|
+
|
|
232
|
+
| Phase | Meaning |
|
|
233
|
+
| --- | --- |
|
|
234
|
+
| First download | Fetches about 1.6 GB from Hugging Face; duration depends on the network. |
|
|
235
|
+
| Cached initialization | Resolves cached files, builds the model, loads weights, and transfers the model to the device; this took several seconds on the tested system. |
|
|
236
|
+
| Warm normalization | Processes one transcript after loading and warm-up; the retained release-build mean was 56.49 ms on Apple M4/MPS. |
|
|
237
|
+
|
|
238
|
+
The benchmark excludes model download and initialization. A one-shot CLI
|
|
239
|
+
timing includes process startup and model initialization, so it is not
|
|
240
|
+
comparable to warm request latency. Services and transcript streams should load
|
|
241
|
+
one normalizer and reuse it.
|
|
242
|
+
|
|
243
|
+
## Device selection
|
|
244
|
+
|
|
245
|
+
`device="auto"` selects CUDA when available, then Apple MPS, then CPU. Python
|
|
246
|
+
users can pass `device="cpu"`, `device="mps"`, or `device="cuda"` to
|
|
247
|
+
`PremoveITN.from_pretrained()`. The CLI exposes the same choices through
|
|
248
|
+
`--device`.
|
|
249
|
+
|
|
250
|
+
Release wheels are validated on macOS 14+ arm64 and `manylinux_2_28` x86_64
|
|
251
|
+
for Python 3.11–3.13. Real frozen-model inference is validated on Apple
|
|
252
|
+
Silicon MPS and Linux CPU, with exact output equivalence across 1,500 inputs. See the
|
|
253
|
+
[platform support matrix](docs/platform-support.md) and [Stage 7 evidence](docs/platform-evidence/README.md).
|
|
254
|
+
API availability does not imply support for an unlisted platform or device.
|
|
255
|
+
|
|
256
|
+
## Limitations
|
|
257
|
+
|
|
258
|
+
- English only.
|
|
259
|
+
- A 435.6M-parameter DeBERTa-v3-large contextual scorer.
|
|
260
|
+
- About a 1.6 GB first model download.
|
|
261
|
+
- Multi-second model initialization.
|
|
262
|
+
- A custom candidate-scoring architecture; it is not a generic
|
|
263
|
+
`AutoModel.from_pretrained()` model.
|
|
264
|
+
- A synthetic stress benchmark, not observed live-traffic accuracy.
|
|
265
|
+
- Weaker measured categories include URL, MONEY, CARDINAL, TIME,
|
|
266
|
+
REFERENCE_ID, and VERSION. See the report for exact per-category results.
|
|
267
|
+
- Independent human gold adjudication and broader contamination checks remain
|
|
268
|
+
incomplete.
|
|
269
|
+
- CUDA, Windows, macOS Intel, Linux ARM64, and other accelerators are not
|
|
270
|
+
validated v0.1.0 support claims.
|
|
271
|
+
|
|
272
|
+
## Model and weights
|
|
273
|
+
|
|
274
|
+
The public inference artifact is
|
|
275
|
+
[`premove-ai/premove-itn`](https://huggingface.co/premove-ai/premove-itn),
|
|
276
|
+
release `v0.1.0`, at the immutable commit
|
|
277
|
+
`80bda5e2e1fe9542aa628597090242df57c1a157`. `PremoveITN.from_pretrained()`
|
|
278
|
+
uses that commit by default and verifies the resolved revision, release
|
|
279
|
+
metadata, base model, and model-file digest before inference.
|
|
280
|
+
|
|
281
|
+
The artifact is inference-only. It excludes optimizer state, scheduler state,
|
|
282
|
+
training counters, training data, and evaluation rows. See the
|
|
283
|
+
[artifact release record](docs/inference-artifact.md) and
|
|
284
|
+
[training provenance](docs/model-provenance.md).
|
|
285
|
+
|
|
286
|
+
## Training data and model selection
|
|
287
|
+
|
|
288
|
+
The production DeBERTa-v3-large scorer was trained on **418,000 examples**
|
|
289
|
+
across **15 training kinds**. Training ran in three sequential stages:
|
|
290
|
+
|
|
291
|
+
| Stage | Examples | Role |
|
|
292
|
+
| --- | ---: | --- |
|
|
293
|
+
| Google text normalization | 378,000 | General English ITN coverage |
|
|
294
|
+
| Conversational adaptation | 20,000 | Spoken-dialogue style and context |
|
|
295
|
+
| Structured-value adaptation | 20,000 | Identifiers, phones, electronic values, and hard context |
|
|
296
|
+
| **Total** | **418,000** | |
|
|
297
|
+
|
|
298
|
+
The frozen 1,500-row VoiceAgent benchmark was not used for training or model
|
|
299
|
+
selection. The bulk training corpora were removed after this composition was
|
|
300
|
+
recorded; the table below is the retained distribution of every example seen
|
|
301
|
+
by the selected checkpoint. Counts are examples, not individual spans.
|
|
302
|
+
|
|
303
|
+
| Kind | Google | Conversational | Structured | Total |
|
|
304
|
+
| --- | ---: | ---: | ---: | ---: |
|
|
305
|
+
| CARDINAL | 32,472 | 853 | 876 | 34,201 |
|
|
306
|
+
| DATE | 78,643 | 315 | 398 | 79,356 |
|
|
307
|
+
| DECIMAL | 12,033 | 465 | 701 | 13,199 |
|
|
308
|
+
| DIGIT_SEQUENCE | 3,258 | 398 | 674 | 4,330 |
|
|
309
|
+
| ELECTRONIC | 0 | 12 | 3,030 | 3,042 |
|
|
310
|
+
| KEEP | 100,000 | 11,429 | 4,150 | 115,579 |
|
|
311
|
+
| MEASUREMENT | 16,647 | 300 | 349 | 17,296 |
|
|
312
|
+
| MONEY | 23,688 | 258 | 271 | 24,217 |
|
|
313
|
+
| MULTI | 82,490 | 3,259 | 2,078 | 87,827 |
|
|
314
|
+
| ORDINAL | 21,484 | 258 | 271 | 22,013 |
|
|
315
|
+
| PHONE | 2,761 | 260 | 1,994 | 5,015 |
|
|
316
|
+
| PUNCTUATION | 624 | 258 | 272 | 1,154 |
|
|
317
|
+
| TIME | 3,894 | 1,879 | 876 | 6,649 |
|
|
318
|
+
| WHITELIST | 6 | 17 | 17 | 40 |
|
|
319
|
+
| WORD | 0 | 39 | 4,043 | 4,082 |
|
|
320
|
+
| **Total** | **378,000** | **20,000** | **20,000** | **418,000** |
|
|
321
|
+
|
|
322
|
+
The final 20,000-example structured stage contained candidate-bearing KEEP
|
|
323
|
+
examples (4,000), conversational replay (2,850), Google replay (3,000),
|
|
324
|
+
targeted electronic values (3,000), hard KEEP cases (150), identifiers (4,000),
|
|
325
|
+
numeric IDs (750), and phone values (2,250). The source material combined the
|
|
326
|
+
Google Text Normalization training partition with conversational examples from
|
|
327
|
+
SLURP, Schema-Guided Dialogue, SpokenWOZ, and Taskmaster-1.
|
|
328
|
+
|
|
329
|
+
The Google stage used AdamW with learning rate `2e-5`, weight decay `0.01`,
|
|
330
|
+
batch size `8`, and length bucketing. Both adaptation stages used AdamW with
|
|
331
|
+
learning rate `5e-6`, weight decay `0.01`, batch size `8`, one epoch, and fresh
|
|
332
|
+
optimizer state; the structured stage used microbatch size `2`. The final
|
|
333
|
+
structured-value checkpoint was selected for the best product-relevant balance
|
|
334
|
+
of structured-value and conversational results. Full selection evidence and
|
|
335
|
+
development results are in the [production model record](docs/model-provenance.md).
|
|
336
|
+
|
|
337
|
+
## Reproducibility
|
|
338
|
+
|
|
339
|
+
The repository retains the frozen VoiceAgent ITN dataset, detailed per-record
|
|
340
|
+
First Evaluation outputs, comparison adapters, metric summaries, and release
|
|
341
|
+
artifact checks. The frozen benchmark was not used for training or checkpoint
|
|
342
|
+
selection. Bulk training corpora were deleted after their composition and kind
|
|
343
|
+
distribution were documented.
|
|
344
|
+
|
|
345
|
+
The benchmark runner is optional and is not part of normal inference. See
|
|
346
|
+
[`benchmarks/README.md`](benchmarks/README.md).
|
|
347
|
+
|
|
348
|
+
## Repository
|
|
349
|
+
|
|
350
|
+
| Path | Purpose |
|
|
351
|
+
| --- | --- |
|
|
352
|
+
| `src/premove_itn/` | Python runtime and public API |
|
|
353
|
+
| `rust/` | Deterministic realization rules |
|
|
354
|
+
| `benchmarks/` | Optional comparison and artifact-verification tools |
|
|
355
|
+
| `eval/` | Frozen benchmark and retained results |
|
|
356
|
+
| `examples/` | Minimal Python and stdin examples |
|
|
357
|
+
| `scripts/` | Release checks and development utilities |
|
|
358
|
+
| `tests/` | Python regression tests |
|
|
359
|
+
| `docs/` | Architecture, provenance, and evaluation documentation |
|
|
360
|
+
|
|
361
|
+
Deterministic realization coverage and lower-level APIs are documented in
|
|
362
|
+
[`docs/realizer-coverage.md`](docs/realizer-coverage.md). Contributor workflow
|
|
363
|
+
is documented in [`CONTRIBUTING.md`](CONTRIBUTING.md).
|
|
364
|
+
|
|
365
|
+
## Development
|
|
366
|
+
|
|
367
|
+
Requirements: Python 3.11 or newer, Rust, and
|
|
368
|
+
[`uv`](https://docs.astral.sh/uv/).
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
uv sync --all-groups
|
|
372
|
+
uv run ruff format --check .
|
|
373
|
+
uv run ruff check .
|
|
374
|
+
uv run pytest
|
|
375
|
+
cargo test --manifest-path rust/Cargo.toml
|
|
376
|
+
uv build
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
## License and attribution
|
|
380
|
+
|
|
381
|
+
Premove ITN source code and model weights are MIT licensed. The contextual
|
|
382
|
+
scorer uses [`microsoft/deberta-v3-large`](https://huggingface.co/microsoft/deberta-v3-large)
|
|
383
|
+
at a pinned revision. The architecture derives from the
|
|
384
|
+
[DeBERTaV3 paper](https://arxiv.org/abs/2111.09543).
|
|
385
|
+
|
|
386
|
+
The Rust realization layer uses
|
|
387
|
+
[`text-processing-rs`](https://github.com/FluidInference/text-processing-rs),
|
|
388
|
+
which is Apache-2.0 licensed. Required third-party licenses and notices are in
|
|
389
|
+
[`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md) and [`LICENSES/`](LICENSES/).
|
|
390
|
+
|