colemanisner commited on
Commit
8a5e2d4
·
0 Parent(s):

Conversation Cues v0.1

Browse files
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -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 [yyyy] [name of copyright owner]
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.
LICENSE-CODE ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SporeLabs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
7
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
8
+ persons to whom the Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11
+ Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
NOTICE.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Notices
2
+
3
+ The model weights are released under the Apache License 2.0 (`LICENSE`). The code in this folder is MIT (`LICENSE-CODE`).
4
+
5
+ ## Base model
6
+
7
+ Ettin encoder, `jhu-clsp/ettin-encoder-32m`, released by its authors (Johns Hopkins University, CLSP) under the MIT licence. The weights here are a fine-tuned derivative. The MIT notice must stay with copies:
8
+
9
+ Copyright (c) 2025 Johns Hopkins University Center for Language and Speech Processing
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
12
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
13
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
14
+ persons to whom the Software is furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
17
+ Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ Source: https://github.com/JHU-CLSP/ettin-encoder-vs-decoder/blob/main/LICENSE
25
+
26
+ ## Teacher
27
+
28
+ Training labels were produced by AutoJev-27B (`denis-pplx/autojev-27b`, revision `6f5b557e`, weights Apache-2.0, code MIT; base Qwen3.8-27B, Apache-2.0).
29
+
30
+ ## Training data credits
31
+
32
+ - AMI Meeting Corpus, CC BY 4.0. Carletta et al., "The AMI Meeting Corpus", https://groups.inf.ed.ac.uk/ami/corpus/
33
+ - YouTube-Commons (PleIAs), CC BY 4.0, transcripts of CC BY videos. Channel, video link, title, date and licence for every video used are in `YOUTUBE_ATTRIBUTIONS.jsonl`. Changes: excerpts of automatic transcripts, cut into sentence-sized pieces.
34
+ - ClaimBuster dataset (Arslan, Hassan, Li, Tremayne), CC BY 4.0, https://doi.org/10.5281/zenodo.3609356
35
+ - MASSIVE (FitzGerald et al., Amazon), CC BY 4.0
36
+ - ABCD: Action-Based Conversations Dataset (Chen et al., ASAPP), MIT
37
+ - SporeLabs templates: written by us for this project.
PARITY.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Parity
2
+
3
+ Date 2026-10-06 14:54. CPU, fp32. The standalone `cue.py` was run on 500 dev rows (seed 7) against the training checkpoint; scores must match exactly.
4
+
5
+ | head | max abs diff | gate (= 0) |
6
+ |---|---|---|
7
+ | commitment | 0.00e+00 | pass |
8
+ | open_question | 0.00e+00 | pass |
9
+ | delegate | 0.00e+00 | pass |
10
+
11
+ ## ONNX: cue-text
12
+
13
+ Date 2026-10-06 14:54. `onnx_export.py` output (opset 17, dynamic batch and length) run with onnxruntime 1.30.0 on CPU, against the torch model, on AMI dev rows. Per head: up to 250 positives (AutoJev label >= 0.5) plus negatives, 500 rows, seed 7. AUROC is against the AutoJev labels; the gate is that int8 stays within 0.005 AUROC of torch.
14
+
15
+ | head | n | pos | AUROC torch | AUROC fp32 onnx | AUROC int8 | int8 - torch | max abs diff fp32 | max abs diff int8 | gate |
16
+ |---|---|---|---|---|---|---|---|---|---|
17
+ | commitment | 500 | 152 | 0.9901 | 0.9901 | 0.9894 | -0.0008 | 1.0e-06 | 0.101 | pass |
18
+ | open_question | 500 | 250 | 0.9835 | 0.9835 | 0.9828 | -0.0007 | 1.1e-06 | 0.200 | pass |
19
+ | delegate | 500 | 29 | 0.9823 | 0.9823 | 0.9823 | +0.0000 | 8.0e-07 | 0.183 | pass |
20
+
21
+ int8 moves single scores by up to about 0.15 (last-but-one column) and the ranking by under 0.005 AUROC. Thresholds were chosen on the torch model and apply to the int8 graph as well.
22
+
23
+ Sizes: fp32 128.4 MB, int8 39.6 MB.
README.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: jhu-clsp/ettin-encoder-32m
4
+ language:
5
+ - en
6
+ tags:
7
+ - text-classification
8
+ - on-device
9
+ - meetings
10
+ ---
11
+
12
+ # cue-text
13
+
14
+ The open model behind SporeLabs Conversation Cues (Cue). A 32M-parameter text model that reads one line of a meeting or call and scores three things: whether the speaker just **promised** to do something, asked the others a **real question**, or **handed work** to someone (a person, the team, or an assistant). It reads the line plus up to three earlier turns and runs on a laptop CPU or in a browser tab.
15
+
16
+ | | |
17
+ |---|---|
18
+ | Base model | `jhu-clsp/ettin-encoder-32m` (MIT) |
19
+ | Size | 32M parameters; 128 MB fp32, 40 MB int8 ONNX |
20
+ | Outputs | `commitment`, `open_question`, `delegate` |
21
+ | Language | English |
22
+ | Licence | model weights Apache-2.0 (`LICENSE`); code MIT (`LICENSE-CODE`) |
23
+ | Benchmark | [Cue benchmark v0.1](https://huggingface.co/datasets/SporeLabs/cue-benchmark) |
24
+
25
+ ## What each score means
26
+
27
+ - **commitment**: the speaker is promising to do something themselves later, or promising for their team. "I'll email you once it's done", "leave that with me", "we'll get back to you next week". Not a commitment: suggestions, "maybe" and "might", asking others to do it, repeating what someone promised earlier, predictions, questions.
28
+ - **open_question**: the speaker asks the others a real question and waits for an answer. "What did they quote?", "Anyone know if Thursday works?". Not a question in this sense: rhetorical questions, "right?" checks, "really?", "sorry, what?", talking to oneself, "all in favour?", and requests to do a task.
29
+ - **delegate** (a hand-off): the speaker hands a piece of work to someone else to do later: "Priya, could you check the price?", "someone needs to write the reply", "make me a slide deck on churn", "remind me to call the bank". Not a hand-off: doing it themselves, quick in-the-moment asks ("pass the marker", "share your screen"), vague wishes, past assignments, asking for information.
30
+
31
+ A score is a number from 0 to 1. `thresholds.json` holds, per head, a default cutoff fitted on human-labelled development data (200 lines labelled blind against these definitions, plus AMI development meetings); scores at or above it count as a hit. Move a cutoff to trade missed cues for false ones. Treat the scores as a ranking, not as probabilities.
32
+
33
+ ## Input
34
+
35
+ One line to score, plus up to three earlier turns, most recent last. For each earlier turn, the model needs to know whether the same person spoke it (`same`) or someone else (`other`); if you do not know the speakers, leave the speaker out and it uses `?`. The model reads one string:
36
+
37
+ ```
38
+ I'll send the deck by Friday. [SEP] other: Can someone send the deck to Halvorsen? [SEP] other: The quote is still open.
39
+ ```
40
+
41
+ `cue.format_input` builds it. Text can be raw transcript text with punctuation or lowercase ASR output. Inputs are cut at 160 tokens.
42
+
43
+ ## Run it
44
+
45
+ ```python
46
+ from huggingface_hub import snapshot_download
47
+ model_dir = snapshot_download("SporeLabs/cue-text")
48
+ ```
49
+
50
+ ```
51
+ pip install torch transformers safetensors
52
+ python predict.py --context "A: can someone own the budget deck?" --speaker B "sure, I'll do it."
53
+ ```
54
+
55
+ ```python
56
+ from cue import CueModel
57
+ m = CueModel.from_pretrained(model_dir)
58
+ scores = m.score("sure, I'll do it.", context=[{"speaker": "A", "text": "can someone own the budget deck?"}], speaker="B")
59
+ hits = m.decide(scores) # uses thresholds.json
60
+ ```
61
+
62
+ `cue.py` needs only torch, transformers and safetensors. For the browser or other runtimes, use `onnx/model_fp32.onnx` or `onnx/model_int8.onnx`: inputs `input_ids` and `attention_mask`, output `probs` with one column per head in the order above. The int8 file stays within 0.005 AUROC of the torch model (see [`PARITY.md`](PARITY.md)).
63
+
64
+ ## Intended use
65
+
66
+ Flagging lines in transcripts of work meetings and calls for a person to look at: possible action items, questions that got no answer, requests to an assistant. It is meant as a first pass that a person or a larger model reviews, and it is small enough to run on the device that holds the audio.
67
+
68
+ Out of scope: deciding anything about a person; use as evidence of what someone agreed to; languages other than English; text that is not conversation (documents, email bodies); any setting where a missed or false hit has serious consequences without review.
69
+
70
+ ## Evaluation
71
+
72
+ Scored on the Cue benchmark's test splits with this package as released (fp32), scores at or above `thresholds.json` counting as hits. AUROC does not depend on the threshold; F1 is at the shipped threshold, with its 95% interval resampled by meeting. AMI's action-item labels cover both promises and work handed to someone, so `commitment_ami` counts a row as found when either `commitment` or `delegate` fires (score: the larger of the two).
73
+
74
+ | head | benchmark task | AUROC | F1 (95% CI) | rows / positives |
75
+ |---|---|---|---|---|
76
+ | commitment or delegate | `commitment_ami` | 0.916 | 0.100 (0.063 to 0.138) | 33,612 / 118 |
77
+ | open_question | `question_ami` | 0.904 | 0.525 (0.497 to 0.552) | 33,612 / 1,283 |
78
+ | open_question | `question_icsi` | 0.962 | 0.602 (0.556 to 0.651) | 15,153 / 622 |
79
+
80
+ On AMI questions, precision is 0.40 and recall 0.77. Raise a threshold if you need fewer false hits.
81
+
82
+ AMI's gold counts only action items and questions linked to its meeting summaries, a narrower definition than the one this model was taught. The benchmark has no delegation task.
83
+
84
+ ## Training data
85
+
86
+ The model trained on 32,850 sentences, each labelled by AutoJev-27B (Apache-2.0, revision `6f5b557e`):
87
+
88
+ | source | rows | licence |
89
+ |---|---|---|
90
+ | AMI Meeting Corpus | 19,186 | CC BY 4.0 |
91
+ | SporeLabs templates (our own Python templates for calls and requests) | 4,257 | ours, Apache-2.0 |
92
+ | YouTube-Commons transcript sentences, 3,356 videos | 4,697 | CC BY 4.0, credit list below |
93
+ | ABCD customer-service dialogues (ASAPP) | 2,702 | MIT |
94
+ | ClaimBuster US presidential debate sentences | 1,096 | CC BY 4.0 |
95
+ | MASSIVE (Amazon), 912 English utterances | 912 | CC BY 4.0 |
96
+
97
+ Development rows, which pick the checkpoint and thresholds, are AMI dev meetings, held-out templates and 200 hand-labelled rows; they are never trained on.
98
+
99
+ YouTube-Commons credit: transcripts of videos shared under CC BY, from the PleIAs/YouTube-Commons dataset. `YOUTUBE_ATTRIBUTIONS.jsonl` lists channel, channel id, video link, title, date and licence for each of the 3,356 videos. We used excerpts of automatic transcripts, cut into sentence-sized pieces. The weights contain no transcript text.
100
+
101
+ Full attributions are in `NOTICE.md`.
102
+
103
+ ## Limits
104
+
105
+ - **The labels are a model's, not people's.** Training labels come from AutoJev-27B, so the model learns its definition of a promise or a hand-off and repeats its mistakes. Rhetorical questions ("who would say no to that?") score as questions.
106
+ - **English meetings and calls.** Most training text is AMI (product-design meetings) plus templates and short customer-service turns. Other domains, languages and long monologues are untested.
SHA256SUMS ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 LICENSE
2
+ 52f953e46ff901014a79db5f5b8d68f80004b0730163c1c5cc69416a0ca86291 LICENSE-CODE
3
+ 7b4929de0a6d8e7821fac564bff98f9279088d4bcf532556c5134a8cb06e93f8 NOTICE.md
4
+ 60c2a4ee21ce1276b1b4d2247a3e8997cac0f8806a5fa2b42b20b59c80383047 PARITY.md
5
+ 6fc5b311b2d3798c1e1a4aa8eab7fa583f8960cd8afcb7a18caf0c1cd01fb0a8 README.md
6
+ df4d824a29537e601f53eacfc25ed7981da0aa14418a0cadbbc4fac6bc6b93cd YOUTUBE_ATTRIBUTIONS.jsonl
7
+ 191007dccc9b53d7e74dc46ec8ba23e266623a6e843352aff6af83de043097d8 backbone/config.json
8
+ 4dda4400575b1e993e25b329e403e8c58f21164b4b51f2c03b76e48670c62773 backbone/model.safetensors
9
+ ea97ecdbcc73713039d8d64dbb05e3689495c96657fbd9a18f5bed381be81049 backbone/special_tokens_map.json
10
+ f8afc5290f89a6ac61c759d214835ee2a89a8a5b221cd4078aabbe28027517c3 backbone/tokenizer.json
11
+ 2966a59b9e9cf122279aec1249e22e5bc7ad8430c754e95031b13fd128d4e560 backbone/tokenizer_config.json
12
+ e38534e9c4a4a29e5fb7735f64a91949ec3e934a7c21f4e6db57048fce17b649 config.json
13
+ 8da4be19cc2ff839a9ec719a01c2d9f8ae21c8212ba019d8255c494f827b21f7 cue.py
14
+ 54b7e3e3b4d617c894e007bb883fc495a6e37e77b0b36a5157ca4c52e847a2e7 heads.safetensors
15
+ 0efd374e65e62e0a0e424440a9445985699109b46a61f1b4c1fb67438734f343 onnx/model_fp32.onnx
16
+ 6a2571a23b1774085c0b5def2a2c93816e776c96867c948295b31278aff536da onnx/model_int8.onnx
17
+ 84b875f2bb820941c593f4443788d029de890d7874709573ac275409b0c37d91 onnx_export.py
18
+ a950c37dcef97233dfab733fbd90b30441178922df1a016b15356c0f88f09115 predict.py
19
+ 956d1dc9c1850141000fc4732e1863d0318b520d31f67a415b10275caa4c8f4c thresholds.json
YOUTUBE_ATTRIBUTIONS.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
backbone/config.json ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ModernBertForSequenceClassification"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 50281,
8
+ "causal_mask": false,
9
+ "classifier_activation": "gelu",
10
+ "classifier_bias": false,
11
+ "classifier_dropout": 0.0,
12
+ "classifier_pooling": "mean",
13
+ "cls_token_id": 50281,
14
+ "decoder_bias": true,
15
+ "deterministic_flash_attn": false,
16
+ "dtype": "float32",
17
+ "embedding_dropout": 0.0,
18
+ "eos_token_id": 50282,
19
+ "global_attn_every_n_layers": 3,
20
+ "global_rope_theta": 160000.0,
21
+ "gradient_checkpointing": false,
22
+ "hidden_activation": "gelu",
23
+ "hidden_size": 384,
24
+ "id2label": {
25
+ "0": "LABEL_0"
26
+ },
27
+ "initializer_cutoff_factor": 2.0,
28
+ "initializer_range": 0.02,
29
+ "intermediate_size": 576,
30
+ "is_causal": false,
31
+ "label2id": {
32
+ "LABEL_0": 0
33
+ },
34
+ "layer_norm_eps": 1e-05,
35
+ "local_attention": 128,
36
+ "local_rope_theta": 160000.0,
37
+ "max_position_embeddings": 7999,
38
+ "mlp_bias": false,
39
+ "mlp_dropout": 0.0,
40
+ "model_type": "modernbert",
41
+ "norm_bias": false,
42
+ "norm_eps": 1e-05,
43
+ "num_attention_heads": 6,
44
+ "num_hidden_layers": 10,
45
+ "pad_token_id": 50283,
46
+ "position_embedding_type": "sans_pos",
47
+ "repad_logits_with_grad": false,
48
+ "sep_token_id": 50282,
49
+ "sparse_pred_ignore_index": -100,
50
+ "sparse_prediction": false,
51
+ "transformers_version": "4.57.6",
52
+ "vocab_size": 50368
53
+ }
backbone/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4dda4400575b1e993e25b329e403e8c58f21164b4b51f2c03b76e48670c62773
3
+ size 128132084
backbone/special_tokens_map.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "mask_token": {
10
+ "content": "[MASK]",
11
+ "lstrip": true,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "[PAD]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "sep_token": {
24
+ "content": "[SEP]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "[UNK]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
backbone/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
backbone/tokenizer_config.json ADDED
@@ -0,0 +1,945 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "|||IP_ADDRESS|||",
5
+ "lstrip": false,
6
+ "normalized": true,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": false
10
+ },
11
+ "1": {
12
+ "content": "<|padding|>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "50254": {
20
+ "content": " ",
21
+ "lstrip": false,
22
+ "normalized": true,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": false
26
+ },
27
+ "50255": {
28
+ "content": " ",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": false
34
+ },
35
+ "50256": {
36
+ "content": " ",
37
+ "lstrip": false,
38
+ "normalized": true,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": false
42
+ },
43
+ "50257": {
44
+ "content": " ",
45
+ "lstrip": false,
46
+ "normalized": true,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": false
50
+ },
51
+ "50258": {
52
+ "content": " ",
53
+ "lstrip": false,
54
+ "normalized": true,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": false
58
+ },
59
+ "50259": {
60
+ "content": " ",
61
+ "lstrip": false,
62
+ "normalized": true,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": false
66
+ },
67
+ "50260": {
68
+ "content": " ",
69
+ "lstrip": false,
70
+ "normalized": true,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": false
74
+ },
75
+ "50261": {
76
+ "content": " ",
77
+ "lstrip": false,
78
+ "normalized": true,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": false
82
+ },
83
+ "50262": {
84
+ "content": " ",
85
+ "lstrip": false,
86
+ "normalized": true,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": false
90
+ },
91
+ "50263": {
92
+ "content": " ",
93
+ "lstrip": false,
94
+ "normalized": true,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": false
98
+ },
99
+ "50264": {
100
+ "content": " ",
101
+ "lstrip": false,
102
+ "normalized": true,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": false
106
+ },
107
+ "50265": {
108
+ "content": " ",
109
+ "lstrip": false,
110
+ "normalized": true,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": false
114
+ },
115
+ "50266": {
116
+ "content": " ",
117
+ "lstrip": false,
118
+ "normalized": true,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": false
122
+ },
123
+ "50267": {
124
+ "content": " ",
125
+ "lstrip": false,
126
+ "normalized": true,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": false
130
+ },
131
+ "50268": {
132
+ "content": " ",
133
+ "lstrip": false,
134
+ "normalized": true,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": false
138
+ },
139
+ "50269": {
140
+ "content": " ",
141
+ "lstrip": false,
142
+ "normalized": true,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": false
146
+ },
147
+ "50270": {
148
+ "content": " ",
149
+ "lstrip": false,
150
+ "normalized": true,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": false
154
+ },
155
+ "50271": {
156
+ "content": " ",
157
+ "lstrip": false,
158
+ "normalized": true,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": false
162
+ },
163
+ "50272": {
164
+ "content": " ",
165
+ "lstrip": false,
166
+ "normalized": true,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": false
170
+ },
171
+ "50273": {
172
+ "content": " ",
173
+ "lstrip": false,
174
+ "normalized": true,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": false
178
+ },
179
+ "50274": {
180
+ "content": " ",
181
+ "lstrip": false,
182
+ "normalized": true,
183
+ "rstrip": false,
184
+ "single_word": false,
185
+ "special": false
186
+ },
187
+ "50275": {
188
+ "content": " ",
189
+ "lstrip": false,
190
+ "normalized": true,
191
+ "rstrip": false,
192
+ "single_word": false,
193
+ "special": false
194
+ },
195
+ "50276": {
196
+ "content": " ",
197
+ "lstrip": false,
198
+ "normalized": true,
199
+ "rstrip": false,
200
+ "single_word": false,
201
+ "special": false
202
+ },
203
+ "50277": {
204
+ "content": "|||EMAIL_ADDRESS|||",
205
+ "lstrip": false,
206
+ "normalized": true,
207
+ "rstrip": false,
208
+ "single_word": false,
209
+ "special": false
210
+ },
211
+ "50278": {
212
+ "content": "|||PHONE_NUMBER|||",
213
+ "lstrip": false,
214
+ "normalized": true,
215
+ "rstrip": false,
216
+ "single_word": false,
217
+ "special": false
218
+ },
219
+ "50279": {
220
+ "content": "<|endoftext|>",
221
+ "lstrip": false,
222
+ "normalized": false,
223
+ "rstrip": false,
224
+ "single_word": false,
225
+ "special": true
226
+ },
227
+ "50280": {
228
+ "content": "[UNK]",
229
+ "lstrip": false,
230
+ "normalized": false,
231
+ "rstrip": false,
232
+ "single_word": false,
233
+ "special": true
234
+ },
235
+ "50281": {
236
+ "content": "[CLS]",
237
+ "lstrip": false,
238
+ "normalized": false,
239
+ "rstrip": false,
240
+ "single_word": false,
241
+ "special": true
242
+ },
243
+ "50282": {
244
+ "content": "[SEP]",
245
+ "lstrip": false,
246
+ "normalized": false,
247
+ "rstrip": false,
248
+ "single_word": false,
249
+ "special": true
250
+ },
251
+ "50283": {
252
+ "content": "[PAD]",
253
+ "lstrip": false,
254
+ "normalized": false,
255
+ "rstrip": false,
256
+ "single_word": false,
257
+ "special": true
258
+ },
259
+ "50284": {
260
+ "content": "[MASK]",
261
+ "lstrip": true,
262
+ "normalized": false,
263
+ "rstrip": false,
264
+ "single_word": false,
265
+ "special": true
266
+ },
267
+ "50285": {
268
+ "content": "[unused0]",
269
+ "lstrip": false,
270
+ "normalized": true,
271
+ "rstrip": false,
272
+ "single_word": false,
273
+ "special": false
274
+ },
275
+ "50286": {
276
+ "content": "[unused1]",
277
+ "lstrip": false,
278
+ "normalized": true,
279
+ "rstrip": false,
280
+ "single_word": false,
281
+ "special": false
282
+ },
283
+ "50287": {
284
+ "content": "[unused2]",
285
+ "lstrip": false,
286
+ "normalized": true,
287
+ "rstrip": false,
288
+ "single_word": false,
289
+ "special": false
290
+ },
291
+ "50288": {
292
+ "content": "[unused3]",
293
+ "lstrip": false,
294
+ "normalized": true,
295
+ "rstrip": false,
296
+ "single_word": false,
297
+ "special": false
298
+ },
299
+ "50289": {
300
+ "content": "[unused4]",
301
+ "lstrip": false,
302
+ "normalized": true,
303
+ "rstrip": false,
304
+ "single_word": false,
305
+ "special": false
306
+ },
307
+ "50290": {
308
+ "content": "[unused5]",
309
+ "lstrip": false,
310
+ "normalized": true,
311
+ "rstrip": false,
312
+ "single_word": false,
313
+ "special": false
314
+ },
315
+ "50291": {
316
+ "content": "[unused6]",
317
+ "lstrip": false,
318
+ "normalized": true,
319
+ "rstrip": false,
320
+ "single_word": false,
321
+ "special": false
322
+ },
323
+ "50292": {
324
+ "content": "[unused7]",
325
+ "lstrip": false,
326
+ "normalized": true,
327
+ "rstrip": false,
328
+ "single_word": false,
329
+ "special": false
330
+ },
331
+ "50293": {
332
+ "content": "[unused8]",
333
+ "lstrip": false,
334
+ "normalized": true,
335
+ "rstrip": false,
336
+ "single_word": false,
337
+ "special": false
338
+ },
339
+ "50294": {
340
+ "content": "[unused9]",
341
+ "lstrip": false,
342
+ "normalized": true,
343
+ "rstrip": false,
344
+ "single_word": false,
345
+ "special": false
346
+ },
347
+ "50295": {
348
+ "content": "[unused10]",
349
+ "lstrip": false,
350
+ "normalized": true,
351
+ "rstrip": false,
352
+ "single_word": false,
353
+ "special": false
354
+ },
355
+ "50296": {
356
+ "content": "[unused11]",
357
+ "lstrip": false,
358
+ "normalized": true,
359
+ "rstrip": false,
360
+ "single_word": false,
361
+ "special": false
362
+ },
363
+ "50297": {
364
+ "content": "[unused12]",
365
+ "lstrip": false,
366
+ "normalized": true,
367
+ "rstrip": false,
368
+ "single_word": false,
369
+ "special": false
370
+ },
371
+ "50298": {
372
+ "content": "[unused13]",
373
+ "lstrip": false,
374
+ "normalized": true,
375
+ "rstrip": false,
376
+ "single_word": false,
377
+ "special": false
378
+ },
379
+ "50299": {
380
+ "content": "[unused14]",
381
+ "lstrip": false,
382
+ "normalized": true,
383
+ "rstrip": false,
384
+ "single_word": false,
385
+ "special": false
386
+ },
387
+ "50300": {
388
+ "content": "[unused15]",
389
+ "lstrip": false,
390
+ "normalized": true,
391
+ "rstrip": false,
392
+ "single_word": false,
393
+ "special": false
394
+ },
395
+ "50301": {
396
+ "content": "[unused16]",
397
+ "lstrip": false,
398
+ "normalized": true,
399
+ "rstrip": false,
400
+ "single_word": false,
401
+ "special": false
402
+ },
403
+ "50302": {
404
+ "content": "[unused17]",
405
+ "lstrip": false,
406
+ "normalized": true,
407
+ "rstrip": false,
408
+ "single_word": false,
409
+ "special": false
410
+ },
411
+ "50303": {
412
+ "content": "[unused18]",
413
+ "lstrip": false,
414
+ "normalized": true,
415
+ "rstrip": false,
416
+ "single_word": false,
417
+ "special": false
418
+ },
419
+ "50304": {
420
+ "content": "[unused19]",
421
+ "lstrip": false,
422
+ "normalized": true,
423
+ "rstrip": false,
424
+ "single_word": false,
425
+ "special": false
426
+ },
427
+ "50305": {
428
+ "content": "[unused20]",
429
+ "lstrip": false,
430
+ "normalized": true,
431
+ "rstrip": false,
432
+ "single_word": false,
433
+ "special": false
434
+ },
435
+ "50306": {
436
+ "content": "[unused21]",
437
+ "lstrip": false,
438
+ "normalized": true,
439
+ "rstrip": false,
440
+ "single_word": false,
441
+ "special": false
442
+ },
443
+ "50307": {
444
+ "content": "[unused22]",
445
+ "lstrip": false,
446
+ "normalized": true,
447
+ "rstrip": false,
448
+ "single_word": false,
449
+ "special": false
450
+ },
451
+ "50308": {
452
+ "content": "[unused23]",
453
+ "lstrip": false,
454
+ "normalized": true,
455
+ "rstrip": false,
456
+ "single_word": false,
457
+ "special": false
458
+ },
459
+ "50309": {
460
+ "content": "[unused24]",
461
+ "lstrip": false,
462
+ "normalized": true,
463
+ "rstrip": false,
464
+ "single_word": false,
465
+ "special": false
466
+ },
467
+ "50310": {
468
+ "content": "[unused25]",
469
+ "lstrip": false,
470
+ "normalized": true,
471
+ "rstrip": false,
472
+ "single_word": false,
473
+ "special": false
474
+ },
475
+ "50311": {
476
+ "content": "[unused26]",
477
+ "lstrip": false,
478
+ "normalized": true,
479
+ "rstrip": false,
480
+ "single_word": false,
481
+ "special": false
482
+ },
483
+ "50312": {
484
+ "content": "[unused27]",
485
+ "lstrip": false,
486
+ "normalized": true,
487
+ "rstrip": false,
488
+ "single_word": false,
489
+ "special": false
490
+ },
491
+ "50313": {
492
+ "content": "[unused28]",
493
+ "lstrip": false,
494
+ "normalized": true,
495
+ "rstrip": false,
496
+ "single_word": false,
497
+ "special": false
498
+ },
499
+ "50314": {
500
+ "content": "[unused29]",
501
+ "lstrip": false,
502
+ "normalized": true,
503
+ "rstrip": false,
504
+ "single_word": false,
505
+ "special": false
506
+ },
507
+ "50315": {
508
+ "content": "[unused30]",
509
+ "lstrip": false,
510
+ "normalized": true,
511
+ "rstrip": false,
512
+ "single_word": false,
513
+ "special": false
514
+ },
515
+ "50316": {
516
+ "content": "[unused31]",
517
+ "lstrip": false,
518
+ "normalized": true,
519
+ "rstrip": false,
520
+ "single_word": false,
521
+ "special": false
522
+ },
523
+ "50317": {
524
+ "content": "[unused32]",
525
+ "lstrip": false,
526
+ "normalized": true,
527
+ "rstrip": false,
528
+ "single_word": false,
529
+ "special": false
530
+ },
531
+ "50318": {
532
+ "content": "[unused33]",
533
+ "lstrip": false,
534
+ "normalized": true,
535
+ "rstrip": false,
536
+ "single_word": false,
537
+ "special": false
538
+ },
539
+ "50319": {
540
+ "content": "[unused34]",
541
+ "lstrip": false,
542
+ "normalized": true,
543
+ "rstrip": false,
544
+ "single_word": false,
545
+ "special": false
546
+ },
547
+ "50320": {
548
+ "content": "[unused35]",
549
+ "lstrip": false,
550
+ "normalized": true,
551
+ "rstrip": false,
552
+ "single_word": false,
553
+ "special": false
554
+ },
555
+ "50321": {
556
+ "content": "[unused36]",
557
+ "lstrip": false,
558
+ "normalized": true,
559
+ "rstrip": false,
560
+ "single_word": false,
561
+ "special": false
562
+ },
563
+ "50322": {
564
+ "content": "[unused37]",
565
+ "lstrip": false,
566
+ "normalized": true,
567
+ "rstrip": false,
568
+ "single_word": false,
569
+ "special": false
570
+ },
571
+ "50323": {
572
+ "content": "[unused38]",
573
+ "lstrip": false,
574
+ "normalized": true,
575
+ "rstrip": false,
576
+ "single_word": false,
577
+ "special": false
578
+ },
579
+ "50324": {
580
+ "content": "[unused39]",
581
+ "lstrip": false,
582
+ "normalized": true,
583
+ "rstrip": false,
584
+ "single_word": false,
585
+ "special": false
586
+ },
587
+ "50325": {
588
+ "content": "[unused40]",
589
+ "lstrip": false,
590
+ "normalized": true,
591
+ "rstrip": false,
592
+ "single_word": false,
593
+ "special": false
594
+ },
595
+ "50326": {
596
+ "content": "[unused41]",
597
+ "lstrip": false,
598
+ "normalized": true,
599
+ "rstrip": false,
600
+ "single_word": false,
601
+ "special": false
602
+ },
603
+ "50327": {
604
+ "content": "[unused42]",
605
+ "lstrip": false,
606
+ "normalized": true,
607
+ "rstrip": false,
608
+ "single_word": false,
609
+ "special": false
610
+ },
611
+ "50328": {
612
+ "content": "[unused43]",
613
+ "lstrip": false,
614
+ "normalized": true,
615
+ "rstrip": false,
616
+ "single_word": false,
617
+ "special": false
618
+ },
619
+ "50329": {
620
+ "content": "[unused44]",
621
+ "lstrip": false,
622
+ "normalized": true,
623
+ "rstrip": false,
624
+ "single_word": false,
625
+ "special": false
626
+ },
627
+ "50330": {
628
+ "content": "[unused45]",
629
+ "lstrip": false,
630
+ "normalized": true,
631
+ "rstrip": false,
632
+ "single_word": false,
633
+ "special": false
634
+ },
635
+ "50331": {
636
+ "content": "[unused46]",
637
+ "lstrip": false,
638
+ "normalized": true,
639
+ "rstrip": false,
640
+ "single_word": false,
641
+ "special": false
642
+ },
643
+ "50332": {
644
+ "content": "[unused47]",
645
+ "lstrip": false,
646
+ "normalized": true,
647
+ "rstrip": false,
648
+ "single_word": false,
649
+ "special": false
650
+ },
651
+ "50333": {
652
+ "content": "[unused48]",
653
+ "lstrip": false,
654
+ "normalized": true,
655
+ "rstrip": false,
656
+ "single_word": false,
657
+ "special": false
658
+ },
659
+ "50334": {
660
+ "content": "[unused49]",
661
+ "lstrip": false,
662
+ "normalized": true,
663
+ "rstrip": false,
664
+ "single_word": false,
665
+ "special": false
666
+ },
667
+ "50335": {
668
+ "content": "[unused50]",
669
+ "lstrip": false,
670
+ "normalized": true,
671
+ "rstrip": false,
672
+ "single_word": false,
673
+ "special": false
674
+ },
675
+ "50336": {
676
+ "content": "[unused51]",
677
+ "lstrip": false,
678
+ "normalized": true,
679
+ "rstrip": false,
680
+ "single_word": false,
681
+ "special": false
682
+ },
683
+ "50337": {
684
+ "content": "[unused52]",
685
+ "lstrip": false,
686
+ "normalized": true,
687
+ "rstrip": false,
688
+ "single_word": false,
689
+ "special": false
690
+ },
691
+ "50338": {
692
+ "content": "[unused53]",
693
+ "lstrip": false,
694
+ "normalized": true,
695
+ "rstrip": false,
696
+ "single_word": false,
697
+ "special": false
698
+ },
699
+ "50339": {
700
+ "content": "[unused54]",
701
+ "lstrip": false,
702
+ "normalized": true,
703
+ "rstrip": false,
704
+ "single_word": false,
705
+ "special": false
706
+ },
707
+ "50340": {
708
+ "content": "[unused55]",
709
+ "lstrip": false,
710
+ "normalized": true,
711
+ "rstrip": false,
712
+ "single_word": false,
713
+ "special": false
714
+ },
715
+ "50341": {
716
+ "content": "[unused56]",
717
+ "lstrip": false,
718
+ "normalized": true,
719
+ "rstrip": false,
720
+ "single_word": false,
721
+ "special": false
722
+ },
723
+ "50342": {
724
+ "content": "[unused57]",
725
+ "lstrip": false,
726
+ "normalized": true,
727
+ "rstrip": false,
728
+ "single_word": false,
729
+ "special": false
730
+ },
731
+ "50343": {
732
+ "content": "[unused58]",
733
+ "lstrip": false,
734
+ "normalized": true,
735
+ "rstrip": false,
736
+ "single_word": false,
737
+ "special": false
738
+ },
739
+ "50344": {
740
+ "content": "[unused59]",
741
+ "lstrip": false,
742
+ "normalized": true,
743
+ "rstrip": false,
744
+ "single_word": false,
745
+ "special": false
746
+ },
747
+ "50345": {
748
+ "content": "[unused60]",
749
+ "lstrip": false,
750
+ "normalized": true,
751
+ "rstrip": false,
752
+ "single_word": false,
753
+ "special": false
754
+ },
755
+ "50346": {
756
+ "content": "[unused61]",
757
+ "lstrip": false,
758
+ "normalized": true,
759
+ "rstrip": false,
760
+ "single_word": false,
761
+ "special": false
762
+ },
763
+ "50347": {
764
+ "content": "[unused62]",
765
+ "lstrip": false,
766
+ "normalized": true,
767
+ "rstrip": false,
768
+ "single_word": false,
769
+ "special": false
770
+ },
771
+ "50348": {
772
+ "content": "[unused63]",
773
+ "lstrip": false,
774
+ "normalized": true,
775
+ "rstrip": false,
776
+ "single_word": false,
777
+ "special": false
778
+ },
779
+ "50349": {
780
+ "content": "[unused64]",
781
+ "lstrip": false,
782
+ "normalized": true,
783
+ "rstrip": false,
784
+ "single_word": false,
785
+ "special": false
786
+ },
787
+ "50350": {
788
+ "content": "[unused65]",
789
+ "lstrip": false,
790
+ "normalized": true,
791
+ "rstrip": false,
792
+ "single_word": false,
793
+ "special": false
794
+ },
795
+ "50351": {
796
+ "content": "[unused66]",
797
+ "lstrip": false,
798
+ "normalized": true,
799
+ "rstrip": false,
800
+ "single_word": false,
801
+ "special": false
802
+ },
803
+ "50352": {
804
+ "content": "[unused67]",
805
+ "lstrip": false,
806
+ "normalized": true,
807
+ "rstrip": false,
808
+ "single_word": false,
809
+ "special": false
810
+ },
811
+ "50353": {
812
+ "content": "[unused68]",
813
+ "lstrip": false,
814
+ "normalized": true,
815
+ "rstrip": false,
816
+ "single_word": false,
817
+ "special": false
818
+ },
819
+ "50354": {
820
+ "content": "[unused69]",
821
+ "lstrip": false,
822
+ "normalized": true,
823
+ "rstrip": false,
824
+ "single_word": false,
825
+ "special": false
826
+ },
827
+ "50355": {
828
+ "content": "[unused70]",
829
+ "lstrip": false,
830
+ "normalized": true,
831
+ "rstrip": false,
832
+ "single_word": false,
833
+ "special": false
834
+ },
835
+ "50356": {
836
+ "content": "[unused71]",
837
+ "lstrip": false,
838
+ "normalized": true,
839
+ "rstrip": false,
840
+ "single_word": false,
841
+ "special": false
842
+ },
843
+ "50357": {
844
+ "content": "[unused72]",
845
+ "lstrip": false,
846
+ "normalized": true,
847
+ "rstrip": false,
848
+ "single_word": false,
849
+ "special": false
850
+ },
851
+ "50358": {
852
+ "content": "[unused73]",
853
+ "lstrip": false,
854
+ "normalized": true,
855
+ "rstrip": false,
856
+ "single_word": false,
857
+ "special": false
858
+ },
859
+ "50359": {
860
+ "content": "[unused74]",
861
+ "lstrip": false,
862
+ "normalized": true,
863
+ "rstrip": false,
864
+ "single_word": false,
865
+ "special": false
866
+ },
867
+ "50360": {
868
+ "content": "[unused75]",
869
+ "lstrip": false,
870
+ "normalized": true,
871
+ "rstrip": false,
872
+ "single_word": false,
873
+ "special": false
874
+ },
875
+ "50361": {
876
+ "content": "[unused76]",
877
+ "lstrip": false,
878
+ "normalized": true,
879
+ "rstrip": false,
880
+ "single_word": false,
881
+ "special": false
882
+ },
883
+ "50362": {
884
+ "content": "[unused77]",
885
+ "lstrip": false,
886
+ "normalized": true,
887
+ "rstrip": false,
888
+ "single_word": false,
889
+ "special": false
890
+ },
891
+ "50363": {
892
+ "content": "[unused78]",
893
+ "lstrip": false,
894
+ "normalized": true,
895
+ "rstrip": false,
896
+ "single_word": false,
897
+ "special": false
898
+ },
899
+ "50364": {
900
+ "content": "[unused79]",
901
+ "lstrip": false,
902
+ "normalized": true,
903
+ "rstrip": false,
904
+ "single_word": false,
905
+ "special": false
906
+ },
907
+ "50365": {
908
+ "content": "[unused80]",
909
+ "lstrip": false,
910
+ "normalized": true,
911
+ "rstrip": false,
912
+ "single_word": false,
913
+ "special": false
914
+ },
915
+ "50366": {
916
+ "content": "[unused81]",
917
+ "lstrip": false,
918
+ "normalized": true,
919
+ "rstrip": false,
920
+ "single_word": false,
921
+ "special": false
922
+ },
923
+ "50367": {
924
+ "content": "[unused82]",
925
+ "lstrip": false,
926
+ "normalized": true,
927
+ "rstrip": false,
928
+ "single_word": false,
929
+ "special": false
930
+ }
931
+ },
932
+ "clean_up_tokenization_spaces": true,
933
+ "cls_token": "[CLS]",
934
+ "extra_special_tokens": {},
935
+ "mask_token": "[MASK]",
936
+ "model_input_names": [
937
+ "input_ids",
938
+ "attention_mask"
939
+ ],
940
+ "model_max_length": 8192,
941
+ "pad_token": "[PAD]",
942
+ "sep_token": "[SEP]",
943
+ "tokenizer_class": "PreTrainedTokenizerFast",
944
+ "unk_token": "[UNK]"
945
+ }
config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architecture": "cue-multihead",
3
+ "kind": "cues",
4
+ "base_model": "jhu-clsp/ettin-encoder-32m",
5
+ "heads": [
6
+ "commitment",
7
+ "open_question",
8
+ "delegate"
9
+ ],
10
+ "product_heads": [
11
+ "commitment",
12
+ "open_question",
13
+ "delegate"
14
+ ],
15
+ "max_tokens": 160,
16
+ "n_ctx": 3,
17
+ "input_format": "target [SEP] rel: previous turn [SEP] ... (see cue.format_input)",
18
+ "backbone_dir": "backbone",
19
+ "heads_file": "heads.safetensors"
20
+ }
cue.py ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Standalone loader for the SporeLabs Conversation Cues (Cue) text model.
2
+
3
+ Depends only on torch, transformers and safetensors.
4
+
5
+ from cue import CueModel
6
+ m = CueModel.from_pretrained(".") # the folder that holds config.json
7
+ m.score("I'll send the deck by Friday.",
8
+ context=[{"speaker": "A", "text": "Can someone own the budget deck?"}], speaker="B")
9
+ # {'commitment': 0.97, 'open_question': 0.01, 'delegate': 0.02, ...}
10
+
11
+ Folder layout: config.json, thresholds.json, backbone/ (ModernBERT encoder with its pooling head, tokenizer files),
12
+ heads.safetensors (one Linear(hidden, 1) per head). The forward pass is: encoder -> mean pool -> dense/GELU/LayerNorm
13
+ head -> one logit per question -> sigmoid.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ import json
19
+ import os
20
+ import re
21
+ from pathlib import Path
22
+
23
+ import torch
24
+
25
+ SEP = " [SEP] "
26
+
27
+
28
+ def format_input(text: str, context: list[dict] | None = None, speaker: str | None = None, n_ctx: int = 3) -> str:
29
+ """One string: `<target> [SEP] <rel>: <previous turn> [SEP] <rel>: <turn before> ...`, most recent turn first.
30
+
31
+ <rel> is `same` (same speaker as the target), `other`, or `?` when the target speaker is unknown.
32
+ """
33
+ ctx = list(context or [])[-n_ctx:] if n_ctx > 0 else []
34
+ parts = [text or "."]
35
+ for c in reversed(ctx):
36
+ if speaker is None or c.get("speaker") is None:
37
+ rel = "?"
38
+ else:
39
+ rel = "same" if c.get("speaker") == speaker else "other"
40
+ parts.append(f"{rel}: {c.get('text', '')}")
41
+ return SEP.join(parts)
42
+
43
+
44
+ def parse_turn(line: str) -> dict:
45
+ """'A: hello there' -> {'speaker': 'A', 'text': 'hello there'}; a line without 'X:' has no speaker."""
46
+ m = re.match(r"^\s*([^:\s][^:]{0,30}?)\s*:\s*(.*)$", line)
47
+ if m:
48
+ return {"speaker": m.group(1).strip(), "text": m.group(2).strip()}
49
+ return {"speaker": None, "text": line.strip()}
50
+
51
+
52
+ class CueModel:
53
+ def __init__(self, backbone, tokenizer, heads: dict, config: dict, thresholds: dict, device: str):
54
+ self.backbone, self.tok, self.heads = backbone, tokenizer, heads
55
+ self.config, self.thresholds, self.device = config, thresholds, device
56
+ self.head_names = list(heads)
57
+
58
+ # ------------------------------------------------------------------ loading
59
+ @classmethod
60
+ def from_pretrained(cls, path_or_repo: str | os.PathLike, device: str = "cpu") -> "CueModel":
61
+ from safetensors.torch import load_file
62
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
63
+
64
+ root = Path(path_or_repo)
65
+ config = json.loads((root / "config.json").read_text())
66
+ tp = root / "thresholds.json"
67
+ thresholds = json.loads(tp.read_text()) if tp.exists() else {}
68
+ bb_dir = root / config.get("backbone_dir", "backbone")
69
+ backbone = AutoModelForSequenceClassification.from_pretrained(bb_dir) # ModernBertForSequenceClassification
70
+ backbone.to(device).eval()
71
+ tok = AutoTokenizer.from_pretrained(bb_dir)
72
+ sd = load_file(str(root / config.get("heads_file", "heads.safetensors")))
73
+ d = backbone.config.hidden_size
74
+ heads = {}
75
+ for q in config["heads"]:
76
+ lin = torch.nn.Linear(d, 1)
77
+ lin.load_state_dict({"weight": sd[f"{q}.weight"], "bias": sd[f"{q}.bias"]})
78
+ heads[q] = lin.to(device).eval()
79
+ return cls(backbone, tok, heads, config, thresholds, device)
80
+
81
+ # ------------------------------------------------------------------ forward
82
+ @torch.no_grad()
83
+ def _logits(self, input_ids, attention_mask) -> dict[str, torch.Tensor]:
84
+ b = self.backbone
85
+ h = b.model(input_ids=input_ids, attention_mask=attention_mask)[0]
86
+ if b.config.classifier_pooling == "cls":
87
+ h = h[:, 0]
88
+ else:
89
+ m = attention_mask.unsqueeze(-1).to(h.dtype)
90
+ h = (h * m).sum(1) / m.sum(1)
91
+ v = b.drop(b.head(h))
92
+ return {q: head(v)[:, 0] for q, head in self.heads.items()}
93
+
94
+ def probs_from_strings(self, texts: list[str], batch: int = 64) -> dict[str, list[float]]:
95
+ """Sigmoid scores per head for already formatted input strings."""
96
+ max_len = int(self.config.get("max_tokens", 160))
97
+ out = {q: [0.0] * len(texts) for q in self.head_names}
98
+ order = sorted(range(len(texts)), key=lambda i: len(texts[i]))
99
+ for i in range(0, len(order), batch):
100
+ ix = order[i:i + batch]
101
+ enc = self.tok([texts[j] or "." for j in ix], padding=True, truncation=True, max_length=max_len,
102
+ return_tensors="pt").to(self.device)
103
+ for q, z in self._logits(enc["input_ids"], enc["attention_mask"]).items():
104
+ for j, v in zip(ix, torch.sigmoid(z.float()).cpu().tolist()):
105
+ out[q][j] = 0.0 if not texts[j] else float(v)
106
+ return out
107
+
108
+ def score_many(self, rows: list[dict], batch: int = 64) -> list[dict[str, float]]:
109
+ """rows: [{text, context?: [{speaker, text}], speaker?}] -> one {head: probability} dict per row."""
110
+ n_ctx = int(self.config.get("n_ctx", 3))
111
+ xs = [format_input(r["text"], r.get("context"), r.get("speaker"), n_ctx) for r in rows]
112
+ p = self.probs_from_strings(xs, batch)
113
+ return [{q: p[q][i] for q in self.head_names} for i in range(len(rows))]
114
+
115
+ def score(self, text: str, context: list[dict] | None = None, speaker: str | None = None) -> dict[str, float]:
116
+ return self.score_many([{"text": text, "context": context, "speaker": speaker}])[0]
117
+
118
+ # ------------------------------------------------------------------ decisions
119
+ def threshold(self, head: str) -> float | None:
120
+ t = (self.thresholds.get("heads") or {}).get(head) or {}
121
+ return t.get("threshold")
122
+
123
+ def decide(self, scores: dict[str, float]) -> dict[str, bool | None]:
124
+ """Fired / not fired at the dev thresholds (None when a head has no threshold yet)."""
125
+ return {q: (None if self.threshold(q) is None else s >= self.threshold(q)) for q, s in scores.items()}
126
+
127
+ @property
128
+ def product_heads(self) -> list[str]:
129
+ return list(self.config.get("product_heads") or self.head_names)
heads.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54b7e3e3b4d617c894e007bb883fc495a6e37e77b0b36a5157ca4c52e847a2e7
3
+ size 5084
onnx/model_fp32.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0efd374e65e62e0a0e424440a9445985699109b46a61f1b4c1fb67438734f343
3
+ size 128351810
onnx/model_int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a2571a23b1774085c0b5def2a2c93816e776c96867c948295b31278aff536da
3
+ size 39621115
onnx_export.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Export a package folder (config.json, backbone/, heads.safetensors) to ONNX for the in-browser demo.
2
+
3
+ python onnx_export.py DIR # writes DIR/onnx/model_fp32.onnx and DIR/onnx/model_int8.onnx
4
+
5
+ The graph takes input_ids and attention_mask (int64, dynamic batch and sequence length) and returns `probs`
6
+ [batch, n_heads], the sigmoid of each head's logit, in the order of config.json "heads". The int8 file is dynamic
7
+ quantisation of the weights with per-channel scales: the embedding table (19.3 of the 32 million parameters) and the
8
+ attention and MLP up-projection matrices. The MLP down-projection stays fp32: quantising it cost up to 0.02 AUROC
9
+ on the delegate head, the other layers cost under 0.001 (see PARITY.md).
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import argparse
15
+ import json
16
+ import sys
17
+ from pathlib import Path
18
+
19
+ import torch
20
+
21
+ sys.path.insert(0, str(Path(__file__).resolve().parent))
22
+ from cue import CueModel # noqa: E402
23
+
24
+
25
+ class ProbWrapper(torch.nn.Module):
26
+ def __init__(self, m: CueModel):
27
+ super().__init__()
28
+ self.backbone = m.backbone
29
+ self.w = torch.nn.Parameter(torch.cat([m.heads[q].weight for q in m.head_names], 0).detach().clone(), requires_grad=False)
30
+ self.b = torch.nn.Parameter(torch.cat([m.heads[q].bias for q in m.head_names], 0).detach().clone(), requires_grad=False)
31
+
32
+ def forward(self, input_ids, attention_mask):
33
+ b = self.backbone
34
+ h = b.model(input_ids=input_ids, attention_mask=attention_mask)[0]
35
+ mk = attention_mask.unsqueeze(-1).to(h.dtype)
36
+ h = (h * mk).sum(1) / mk.sum(1) # mean pooling (config classifier_pooling = "mean")
37
+ v = b.head(h)
38
+ return torch.sigmoid(v @ self.w.T + self.b)
39
+
40
+
41
+ def export(folder: Path, opset: int = 17):
42
+ from transformers import AutoModelForSequenceClassification
43
+ from onnxruntime.quantization import QuantType, quantize_dynamic
44
+
45
+ folder = Path(folder)
46
+ cfg = json.loads((folder / "config.json").read_text())
47
+ m = CueModel.from_pretrained(folder)
48
+ if m.backbone.config.classifier_pooling != "mean":
49
+ sys.exit("only mean pooling is exported")
50
+ # eager attention exports cleanly; the weights are identical
51
+ m.backbone = AutoModelForSequenceClassification.from_pretrained(folder / cfg["backbone_dir"], attn_implementation="eager").eval()
52
+ w = ProbWrapper(m).eval()
53
+ out = folder / "onnx"
54
+ out.mkdir(exist_ok=True)
55
+ ids = torch.randint(5, 1000, (2, 24))
56
+ mask = torch.ones_like(ids)
57
+ mask[1, 18:] = 0
58
+ fp32 = out / "model_fp32.onnx"
59
+ torch.onnx.export(w, (ids, mask), str(fp32), input_names=["input_ids", "attention_mask"], output_names=["probs"],
60
+ dynamic_axes={"input_ids": {0: "batch", 1: "seq"}, "attention_mask": {0: "batch", 1: "seq"},
61
+ "probs": {0: "batch"}}, opset_version=opset, dynamo=False)
62
+ int8 = out / "model_int8.onnx"
63
+ import onnx
64
+ names = [n.name for n in onnx.load(str(fp32)).graph.node if n.op_type == "MatMul"]
65
+ keep = ("/attn/Wqkv/", "/attn/Wo/", "/mlp/Wi/") # int8; the MLP down-projection, head and rotary stay fp32
66
+ quantize_dynamic(str(fp32), str(int8), weight_type=QuantType.QInt8, per_channel=True,
67
+ nodes_to_exclude=[n for n in names if not any(k in n for k in keep)])
68
+ for p in (fp32, int8):
69
+ print(f"{p.name}: {p.stat().st_size / 1e6:.1f} MB")
70
+
71
+
72
+ if __name__ == "__main__":
73
+ ap = argparse.ArgumentParser()
74
+ ap.add_argument("dir")
75
+ ap.add_argument("--opset", type=int, default=17)
76
+ a = ap.parse_args()
77
+ export(Path(a.dir), a.opset)
predict.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Score a line of conversation. Needs torch, transformers, safetensors.
2
+
3
+ python predict.py "I'll send the deck by Friday."
4
+ python predict.py --context "A: can someone own the budget deck?" --speaker B "sure, I'll do it."
5
+ echo '{"text": "...", "context": [{"speaker": "A", "text": "..."}], "speaker": "B"}' | python predict.py --jsonl
6
+
7
+ --context is repeatable, oldest turn first; only the last 3 are used. --model is the model folder
8
+ (default: the folder this file is in).
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import argparse
14
+ import json
15
+ import sys
16
+ from pathlib import Path
17
+
18
+ from cue import CueModel, parse_turn
19
+
20
+
21
+ def main():
22
+ ap = argparse.ArgumentParser()
23
+ ap.add_argument("--model", default=str(Path(__file__).resolve().parent))
24
+ ap.add_argument("--context", action="append", default=[], help='"SPEAKER: text", oldest first; repeatable')
25
+ ap.add_argument("--speaker", default=None, help="speaker of the target line (needed to tell same/other speaker)")
26
+ ap.add_argument("--jsonl", action="store_true", help="read {text, context?, speaker?} rows from stdin")
27
+ ap.add_argument("--device", default="cpu")
28
+ ap.add_argument("text", nargs="*")
29
+ a = ap.parse_args()
30
+
31
+ m = CueModel.from_pretrained(a.model, device=a.device)
32
+ if a.jsonl:
33
+ rows = [json.loads(line) for line in sys.stdin if line.strip()]
34
+ else:
35
+ ctx = [parse_turn(c) for c in a.context]
36
+ rows = [{"text": t, "context": ctx, "speaker": a.speaker} for t in a.text]
37
+ if not rows:
38
+ ap.error("give a text argument or --jsonl")
39
+ heads = m.product_heads
40
+ for r, s in zip(rows, m.score_many(rows)):
41
+ fired = m.decide(s)
42
+ print(json.dumps({"text": r["text"], **{h: round(s[h], 4) for h in heads},
43
+ "fired": [h for h in heads if fired.get(h)]}))
44
+
45
+
46
+ if __name__ == "__main__":
47
+ main()
thresholds.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "rule": "mean F1 over human200 and ami_dev on a 0.01 grid; moved only when the bootstrap 95% interval of the gain over the previous threshold is above zero; fixed before re-scoring any test set",
3
+ "heads": {
4
+ "commitment": {
5
+ "threshold": 0.54307,
6
+ "previous": 0.54307,
7
+ "dev_set": "human200 (Coleman, blind, product definitions) + ami_dev (AMI human annotations)",
8
+ "gain_mean_f1": 0.017,
9
+ "gain_ci95": [
10
+ -0.0108,
11
+ 0.0507
12
+ ],
13
+ "f1_human200": 0.8254,
14
+ "f1_ami_dev": 0.5816,
15
+ "n_human200": 200,
16
+ "pos_human200": 33,
17
+ "n_ami_dev": 5921,
18
+ "pos_ami_dev": 274,
19
+ "moved": false
20
+ },
21
+ "open_question": {
22
+ "threshold": 0.69,
23
+ "previous": 0.53315,
24
+ "dev_set": "human200 (Coleman, blind, product definitions) + ami_dev (AMI human annotations)",
25
+ "gain_mean_f1": 0.0186,
26
+ "gain_ci95": [
27
+ 0.0067,
28
+ 0.0274
29
+ ],
30
+ "f1_human200": 0.9189,
31
+ "f1_ami_dev": 0.5628,
32
+ "n_human200": 200,
33
+ "pos_human200": 58,
34
+ "n_ami_dev": 18987,
35
+ "pos_ami_dev": 777,
36
+ "moved": true
37
+ },
38
+ "delegate": {
39
+ "threshold": 0.51,
40
+ "previous": 0.31651,
41
+ "dev_set": "human200 (Coleman, blind, product definitions) + ami_dev (AMI human annotations)",
42
+ "gain_mean_f1": 0.0624,
43
+ "gain_ci95": [
44
+ 0.0096,
45
+ 0.1131
46
+ ],
47
+ "f1_human200": 0.9,
48
+ "f1_ami_dev": 0.3333,
49
+ "n_human200": 200,
50
+ "pos_human200": 31,
51
+ "n_ami_dev": 18952,
52
+ "pos_ami_dev": 22,
53
+ "moved": true
54
+ }
55
+ },
56
+ "fitted": "2026-10-07",
57
+ "previous_rule": "max-F1 on dev; thresholds are fixed before any test run"
58
+ }