simonvanlierde commited on
Commit
eb1b28e
·
verified ·
1 Parent(s): 4d2e1e2

Upload ettin-68m-onepass-b8-s2

Browse files
Files changed (8) hide show
  1. README.md +127 -86
  2. best.json +4 -4
  3. config.json +1 -1
  4. model.safetensors +1 -1
  5. onnx/model.onnx +2 -2
  6. onnx/model_int8.onnx +0 -3
  7. run.json +6 -4
  8. tokenizer_config.json +1 -1
README.md CHANGED
@@ -2,7 +2,7 @@
2
  license: mit
3
  base_model: jhu-clsp/ettin-encoder-68m
4
  base_model_relation: finetune
5
- library_name: transformers.js
6
  pipeline_tag: text-classification
7
  language:
8
  - en
@@ -13,7 +13,6 @@ tags:
13
  - multi-label-classification
14
  - modernbert
15
  - onnx
16
- - transformers.js
17
  ---
18
 
19
  # CRediT statement reader (Ettin-68M)
@@ -25,44 +24,55 @@ It is the browser model of the
25
  [CRediT census](https://github.com/simonvanlierde/credit-matrix/tree/main/census) in
26
  [CRediT Matrix](https://github.com/simonvanlierde/credit-matrix).
27
  It is [Ettin-68M](https://huggingface.co/jhu-clsp/ettin-encoder-68m) (revision
28
- `ac19ae4bc51093b31c475665ac872a936d056cc2`), fine-tuned on 166,567 statements.
 
29
  Source paths below are in the
30
  [census code](https://github.com/simonvanlierde/credit-matrix/tree/main/census/src/census).
31
 
32
  | | |
33
  | --- | --- |
34
- | Run | `ettin-68m-both-s1` |
35
  | Hub repository | [`simonvanlierde/credit-statement-reader`](https://huggingface.co/simonvanlierde/credit-statement-reader) |
36
- | `onnx/model_int8.onnx` sha256 | `0157d52635f2a0a5482591ef525a40ddaac02b5ecb774587f945480b4a6b67ee` |
37
- | `onnx/model.onnx` sha256 | `ea66c786ba8d7fa33a490f707444a62f6e2589420b963afd129bc27440b85530` |
38
- | `model.safetensors` sha256 | `a48dff938802fef29959e193d2ed7c3a5bd6ca3a3ae1fef6ff5f308f128e8e86` |
 
 
 
39
 
40
  `census/model.json` in the source repository holds the same names and hashes, and a test fails
41
  when this card and that file disagree.
42
 
43
  ## What it does
44
 
45
- The model classifies one author at a time. Each input is a pair: a short author text, then the
46
- statement.
47
 
48
  ```text
49
- [CLS] Na-Gyeong Ryu (N.-G.R., NGR, Ryu NG); author 2 of 5 [SEP] <statement> [SEP]
50
  ```
51
 
52
  The author text is the name, the ways a statement may write its initials, and the place in the
53
- byline (`encoder.author_text` in `src/census/encoder.py`). The head is a sequence classifier
54
- with 14 outputs and a sigmoid on each, one yes or no per role. The config names the outputs by
55
- role in `id2label`. A role counts when its probability is at or above 0.4, the threshold that
56
- scored best on the dev set. The threshold is in `best.json` beside the weights, because the model
57
- config does not hold it. Run the model once per author and the answers are (author, role) pairs.
58
 
59
- Inputs are cut at 1,024 tokens, as in training.
 
 
 
 
 
 
 
60
 
61
  ## How to use
62
 
63
  The repository holds the PyTorch weights (`model.safetensors`) and two ONNX copies:
64
- `onnx/model.onnx` (fp32) and `onnx/model_int8.onnx` (int8). In Python, with `onnxruntime`,
65
- `tokenizers` and `huggingface_hub`:
66
 
67
  ```python
68
  import json, re
@@ -83,21 +93,43 @@ def initials(name):
83
 
84
 
85
  tokenizer = Tokenizer.from_file(hf_hub_download(REPO, "tokenizer.json"))
86
- tokenizer.enable_truncation(1024, strategy="only_second")
87
- session = ort.InferenceSession(hf_hub_download(REPO, "onnx/model_int8.onnx"))
88
  config = json.load(open(hf_hub_download(REPO, "config.json")))
 
89
  roles = [config["id2label"][str(i)] for i in range(len(config["id2label"]))]
90
  threshold = json.load(open(hf_hub_download(REPO, "best.json")))["threshold"]
 
 
 
 
 
 
91
 
92
 
93
  def read(statement, authors):
 
 
 
 
 
 
 
 
 
94
  pairs = set()
95
- for i, name in enumerate(authors, 1):
96
- text = f"{name} ({', '.join(initials(name))}); author {i} of {len(authors)}"
97
- enc = tokenizer.encode(text, statement)
98
- inputs = {"input_ids": np.array([enc.ids]), "attention_mask": np.array([enc.attention_mask])}
99
- logits = session.run(None, inputs)[0][0]
100
- pairs |= {(i, roles[r]) for r, p in enumerate(1 / (1 + np.exp(-logits))) if p >= threshold}
 
 
 
 
 
 
 
101
  return pairs
102
 
103
 
@@ -105,13 +137,11 @@ statement = "A.L. designed the study and wrote the first draft. C.D. analysed th
105
  print(read(statement, ["Ada Lovelace", "Charles Darwin"]))
106
  ```
107
 
108
- In transformers.js, load it with
109
- `AutoModelForSequenceClassification.from_pretrained(REPO, { dtype: "int8" })`.
110
-
111
- A role whose probability sits near the threshold can flip between runtimes and batch sizes, because
112
- the int8 copy quantises activations per batch. Reading one author at a time, as the snippet
113
- does, the int8 copy gave the same pairs as the batched evaluation on 37 of 40 test articles. The fp32 copy gave the
114
- same pairs as the PyTorch model on 39 of 40.
115
 
116
  ## Intended use
117
 
@@ -171,24 +201,24 @@ No article in the evaluation sets below is in the training data.
171
  | Setting | Value |
172
  | --- | --- |
173
  | Base model | `jhu-clsp/ettin-encoder-68m` at `ac19ae4bc51093b31c475665ac872a936d056cc2` |
174
- | Articles | 166,567 |
 
175
  | Epochs | 1 |
176
  | Learning rate | 3e-5, linear decay, warm-up over the first 6% of steps |
177
- | Batch size | 32 |
178
  | Weight decay | 0.01 |
179
- | Loss | binary cross-entropy over the 14 roles |
180
  | Max length | 1,024 tokens |
181
- | Seed | 1 |
182
- | Hardware | one RTX 4090, bf16; 14.0 GB of GPU memory at most |
183
- | Time | 1,654 s |
184
- | Libraries | torch 2.15.0, transformers 5.20.2 |
185
 
186
- Every setting is in `run.json` beside the weights (`encoder.Config`).
187
 
188
- **Energy.** Training energy was not metered. Assuming about 0.5 kW for the RTX 4090 and its host,
189
- 1,654 s is about 0.23 kWh. At the Dutch grid average that the census uses for its metered runs
190
- (0.27 kg CO2e per kWh), that is about 0.06 kg CO2e. The model search behind this run took about
191
- 100 training runs of similar size, so roughly 100 times that.
192
 
193
  ## Evaluation
194
 
@@ -211,19 +241,19 @@ used:
211
 
212
  | | narrative F1 | narrative exact | CRediT F1 | CRediT exact |
213
  | --- | --- | --- | --- | --- |
214
- | this model, PyTorch | 0.961 (0.944 to 0.975) | 0.59 | 0.973 (0.960 to 0.984) | 0.74 |
215
- | this model, int8 ONNX | 0.960 (0.944 to 0.975) | 0.57 | 0.971 (0.956 to 0.984) | 0.73 |
 
 
216
  | rule parser | 0.000 | 0.00 | 0.860 (0.800 to 0.910) | 0.56 |
217
 
 
 
218
  The rule parser reads only CRediT names, so it finds nothing in narrative statements by design.
219
  The three labellers agreed exactly with each other on 85% to 91% of narrative articles and 94% to
220
- 96% of CRediT articles. The model's exact scores (59% and 74%) sit well below that: it gets most
221
  pairs right, but often one pair per article wrong.
222
 
223
- Per role on the test set, F1 is 0.87 or more for every role except narrative validation (0.80,
224
- 21 gold pairs). Small roles have wide intervals: visualization has 10 narrative gold pairs,
225
- funding acquisition 11.
226
-
227
  ### Outside biomedicine
228
 
229
  `ood200b`: 147 CC BY / CC0 articles from 2022 on, drawn on 2026-11-23 from publishers outside Europe
@@ -234,17 +264,20 @@ differed.
234
 
235
  | | narrative F1 | narrative exact | CRediT F1 | CRediT exact |
236
  | --- | --- | --- | --- | --- |
237
- | this model, PyTorch | 0.894 (0.863 to 0.925) | 0.41 | 0.951 (0.922 to 0.973) | 0.68 |
238
- | this model, int8 ONNX, one author at a time | 0.884 (0.854 to 0.914) | 0.35 | 0.949 (0.920 to 0.972) | 0.66 |
 
239
  | rule parser | 0.000 | 0.17 | 0.857 (0.799 to 0.907) | 0.49 |
240
 
241
- Narrative statements score clearly lower than in the test set (0.894 against 0.961). CRediT
242
- statements hold up once SRP is left out (0.970 on the other 56), and narrative rises only to 0.909
243
- without SRP, whose statements are often loosely worded. The labellers also agreed less: 78% to 82% of
244
- narrative articles and 87% to 95% of CRediT articles. Training on 269 more narrative statements from
245
- these publishers (Pensoft left out) did not close the gap over two seeds. OpenAlex's role data, which
246
- reads CRediT names in full text, has roles for 43 of the 76 CRediT articles and none of the narrative
247
- ones; on those 43 this model scores F1 0.968 and OpenAlex 0.899 (checked 2026-11-26).
 
 
248
 
249
  ### Dev set used for model choice
250
 
@@ -252,29 +285,36 @@ ones; on those 43 this model scores F1 0.968 and OpenAlex 0.899 (checked 2026-11
252
  these scores are optimistic. Its narrative stratum is harder than the test set's: it holds the
253
  statements an earlier labelling marked as having no CRediT roles.
254
 
255
- | | narrative F1 | CRediT F1 |
256
- | --- | --- | --- |
257
- | this model (seed 1) | 0.930 (0.910 to 0.947) | 0.976 (0.963 to 0.986) |
258
- | same recipe, seed 2 | 0.928 | 0.975 |
259
- | int8 ONNX | 0.927 | 0.975 |
260
- | rule parser | 0.069 | 0.903 |
261
-
262
- On gold500b the weakest narrative roles are data curation (0.74, 75 gold pairs), software (0.79,
263
- 57) and validation (0.83, 66).
264
-
265
- ### int8 against fp32
266
-
267
- On 2,000 held-out articles scored against publisher tags, fp32, int8 and q4 ONNX all reach F1 0.904.
268
- int8 gives exactly the same pairs as fp32 on 95.1% of those articles. On gold500b the share is 74.0%
269
- (61.5% narrative), because narrative statements put more probabilities near the threshold. Paired
270
- against the PyTorch model on gold500b, int8 changes narrative F1 by -0.003 (95% interval -0.009 to
271
- +0.003) and CRediT F1 by -0.001 (-0.003 to +0.002); q4 loses 0.004 on narrative, with an interval
272
- below zero. Exact match falls further. Reading one author at a time, as the app does, int8 matches
273
- the gold labels on whole CRediT articles of gold500b 0.793 of the time against 0.812 for PyTorch
274
- (-0.019, 95% interval -0.038 to -0.004). On narrative articles it is 0.473 against 0.510 (-0.038,
275
- -0.075 to +0.000), a borderline drop. A single threshold fitted to int8 on the 2,000-article dev set
276
- (0.34) does not win this back, and CRediT exact match stays down under every threshold variant
277
- tried. int8 is a quarter of the size (70 MB against 275 MB), so it is the copy the app loads.
 
 
 
 
 
 
 
278
 
279
  ## Limitations
280
 
@@ -286,14 +326,15 @@ tried. int8 is a quarter of the size (70 MB against 275 MB), so it is the copy t
286
  surname. Bylines in other orders, and statements with swapped or misspelled initials, depend on
287
  the model reading the name itself.
288
  - **Biomedical sources.** Europe PMC is biomedical by construction, and Frontiers and MDPI lead the
289
- training data. Outside biomedicine, narrative statements score about 0.07 F1 lower (see
290
  [Outside biomedicine](#outside-biomedicine)).
291
  - **Labels.** The gold sets were made by language-model labellers with a vote and an adjudicator. A
292
  person checked 40 rows of the pilot set (36 right) and ruled on 4 of 40 sampled gold500b rows,
293
  which changed the definition. Nobody checked the test set by hand; a person ruled on the 5 split
294
  rows of ood200b. Part of the training data comes from publisher tags, which can name roles a
295
  statement never gives.
296
- - **Long statements.** Statements over 1,024 tokens are cut.
 
297
 
298
  ## Licence
299
 
 
2
  license: mit
3
  base_model: jhu-clsp/ettin-encoder-68m
4
  base_model_relation: finetune
5
+ library_name: onnx
6
  pipeline_tag: text-classification
7
  language:
8
  - en
 
13
  - multi-label-classification
14
  - modernbert
15
  - onnx
 
16
  ---
17
 
18
  # CRediT statement reader (Ettin-68M)
 
24
  [CRediT census](https://github.com/simonvanlierde/credit-matrix/tree/main/census) in
25
  [CRediT Matrix](https://github.com/simonvanlierde/credit-matrix).
26
  It is [Ettin-68M](https://huggingface.co/jhu-clsp/ettin-encoder-68m) (revision
27
+ `ac19ae4bc51093b31c475665ac872a936d056cc2`), fine-tuned on 166,567 statements, and it reads every
28
+ author of a statement in one pass.
29
  Source paths below are in the
30
  [census code](https://github.com/simonvanlierde/credit-matrix/tree/main/census/src/census).
31
 
32
  | | |
33
  | --- | --- |
34
+ | Run | `ettin-68m-onepass-b8-s2` |
35
  | Hub repository | [`simonvanlierde/credit-statement-reader`](https://huggingface.co/simonvanlierde/credit-statement-reader) |
36
+ | `onnx/model_w8.onnx` sha256 | `f720cbbb47529e521d80be75dd1aa1b08449f57489edd7f8067c71591930ccf5` |
37
+ | `onnx/model.onnx` sha256 | `ad261fb9b72b4e1f05bf7702ea8c5b7e43ccdb7976afd292a321c6b78f7b79cd` |
38
+ | `model.safetensors` sha256 | `1e74f68491f212b746c89f1e5c1cc4e03b9a3a0cf9c0c43b68f07d8e10afc54d` |
39
+ | `tokenizer.json` sha256 | `6c8aaa9a542084f2457eab775d4eeb51f92a70c0fd9de28d5edb0ddec3c08d30` |
40
+ | `config.json` sha256 | `d9f7523bcc0248102608c85d698876886fbf45ce93c75176ae70edd241ca77d3` |
41
+ | `best.json` sha256 | `529baba95800ccb09a1168bbfab9519f268b4c1b00a8cfd71cf096bce00b678d` |
42
 
43
  `census/model.json` in the source repository holds the same names and hashes, and a test fails
44
  when this card and that file disagree.
45
 
46
  ## What it does
47
 
48
+ The model reads a statement once for all its authors. The input lists the authors, each after a
49
+ marker token, then the statement:
50
 
51
  ```text
52
+ [CLS] [unused0] Marie Curie (M.C., MC, Curie M); author 1 of 3 [unused0] Ada Lovelace (A.L., AL, Lovelace A); author 2 of 3 [unused0] ... [SEP] <statement> [SEP]
53
  ```
54
 
55
  The author text is the name, the ways a statement may write its initials, and the place in the
56
+ byline (`encoder.author_text` in `src/census/encoder.py`). The model reads the hidden state at
57
+ each marker and applies a 14-output head with a sigmoid on each, one yes or no per role, so one
58
+ call gives every author's roles. The config names the outputs by role in `id2label`. A role counts
59
+ when its probability is at or above 0.4, the threshold that scored best on the dev set; it is in
60
+ `best.json`. The max length (1,024) and the marker token are in `run.json`.
61
 
62
+ The ONNX graph takes three int64 inputs, `input_ids` and `attention_mask` [batch, length] and
63
+ `marker_positions` [batch, authors] (the index of each author's marker in `input_ids`), and gives
64
+ `logits` [batch, authors, 14].
65
+
66
+ A byline too long to fit 1,024 tokens beside the statement is split into chunks of authors, and
67
+ each chunk repeats the statement; every author keeps its "author i of n" text. A statement longer
68
+ than 1,024 tokens less a quarter for authors is cut to make room for them (`onepass.chunks` and
69
+ `onepass.statement_room` in `src/census/onepass.py`).
70
 
71
  ## How to use
72
 
73
  The repository holds the PyTorch weights (`model.safetensors`) and two ONNX copies:
74
+ `onnx/model.onnx` (fp32) and `onnx/model_w8.onnx` (8-bit weights, 75 MB). In Python, with
75
+ `onnxruntime`, `tokenizers` and `huggingface_hub`:
76
 
77
  ```python
78
  import json, re
 
93
 
94
 
95
  tokenizer = Tokenizer.from_file(hf_hub_download(REPO, "tokenizer.json"))
96
+ session = ort.InferenceSession(hf_hub_download(REPO, "onnx/model_w8.onnx"))
 
97
  config = json.load(open(hf_hub_download(REPO, "config.json")))
98
+ run = json.load(open(hf_hub_download(REPO, "run.json")))
99
  roles = [config["id2label"][str(i)] for i in range(len(config["id2label"]))]
100
  threshold = json.load(open(hf_hub_download(REPO, "best.json")))["threshold"]
101
+ CLS, SEP, MARK = (tokenizer.token_to_id(t) for t in ("[CLS]", "[SEP]", run["marker"]))
102
+ MAX = run["max_length"]
103
+
104
+
105
+ def ids(text):
106
+ return tokenizer.encode(text, add_special_tokens=False).ids
107
 
108
 
109
  def read(statement, authors):
110
+ n = len(authors)
111
+ texts = [ids(f"{a} ({', '.join(initials(a))}); author {i} of {n}")[: MAX // 4] for i, a in enumerate(authors, 1)]
112
+ need = [1 + len(t) for t in texts]
113
+ words = ids(statement)[: MAX - 3 - min(sum(need), max(max(need), MAX // 4))]
114
+ room, chunks = MAX - 3 - len(words), [[]]
115
+ for i, k in enumerate(need):
116
+ if chunks[-1] and sum(need[j] for j in chunks[-1]) + k > room:
117
+ chunks.append([])
118
+ chunks[-1].append(i)
119
  pairs = set()
120
+ for chunk in chunks:
121
+ tokens, marks = [CLS], []
122
+ for i in chunk:
123
+ marks.append(len(tokens))
124
+ tokens += [MARK, *texts[i]]
125
+ tokens += [SEP, *words, SEP]
126
+ inputs = {
127
+ "input_ids": np.array([tokens]),
128
+ "attention_mask": np.ones((1, len(tokens)), dtype=np.int64),
129
+ "marker_positions": np.array([marks]),
130
+ }
131
+ for i, row in zip(chunk, session.run(None, inputs)[0][0]):
132
+ pairs |= {(i + 1, roles[r]) for r, p in enumerate(1 / (1 + np.exp(-row))) if p >= threshold}
133
  return pairs
134
 
135
 
 
137
  print(read(statement, ["Ada Lovelace", "Charles Darwin"]))
138
  ```
139
 
140
+ In a browser, run `onnx/model_w8.onnx` with onnxruntime-web and build the inputs as above.
141
+ transformers.js cannot load it, as the graph needs `marker_positions`. To test a port, use
142
+ [`reader-parity.json`](https://github.com/simonvanlierde/credit-matrix/blob/main/src/lib/__fixtures__/reader-parity.json)
143
+ in the app's repository. It gives the exact inputs and outputs for nine statements. Reading one article per call, the w8 copy gave the same pairs as the PyTorch model
144
+ on 92% of narrative and 98% of CRediT test articles.
 
 
145
 
146
  ## Intended use
147
 
 
201
  | Setting | Value |
202
  | --- | --- |
203
  | Base model | `jhu-clsp/ettin-encoder-68m` at `ac19ae4bc51093b31c475665ac872a936d056cc2` |
204
+ | Started from | the per-author run `ettin-68m-both-s1` (its encoder and head), trained on the same data |
205
+ | Articles | 166,567 (163,266 after the CC BY / CC0 filter; 164,484 chunks, 801 articles split) |
206
  | Epochs | 1 |
207
  | Learning rate | 3e-5, linear decay, warm-up over the first 6% of steps |
208
+ | Batch size | 8 chunks |
209
  | Weight decay | 0.01 |
210
+ | Loss | binary cross-entropy over the 14 roles of every author in a chunk |
211
  | Max length | 1,024 tokens |
212
+ | Seed | 2 |
213
+ | Hardware | one RTX 4090, bf16; 4.2 GB of GPU memory at most |
214
+ | Time | 555 s, after the 1,654 s of the run it started from |
215
+ | Libraries | torch 2.15.0, transformers 5.23.0 |
216
 
217
+ Every setting is in `run.json` beside the weights (`onepass.Config`).
218
 
219
+ **Energy.** Not metered. At about 0.5 kW, the 555 s of this run are about 0.08 kWh (0.02 kg CO2e
220
+ at 0.27 kg per kWh), on top of the 0.23 kWh of the run it started from. Choosing the recipe took
221
+ three one-pass runs of similar size.
 
222
 
223
  ## Evaluation
224
 
 
241
 
242
  | | narrative F1 | narrative exact | CRediT F1 | CRediT exact |
243
  | --- | --- | --- | --- | --- |
244
+ | this model, PyTorch | 0.964 (0.949 to 0.977) | 0.61 | 0.971 (0.957 to 0.983) | 0.71 |
245
+ | this model, w8 ONNX | 0.964 (0.949 to 0.977) | 0.61 | 0.971 (0.956 to 0.983) | 0.71 |
246
+ | previous per-author model (`ettin-68m-both-s1`), PyTorch | 0.961 (0.944 to 0.975) | 0.59 | 0.973 (0.960 to 0.984) | 0.74 |
247
+ | previous per-author model, int8 ONNX | 0.960 (0.944 to 0.975) | 0.57 | 0.971 (0.956 to 0.984) | 0.73 |
248
  | rule parser | 0.000 | 0.00 | 0.860 (0.800 to 0.910) | 0.56 |
249
 
250
+ `test200b` was scored once for this model, after it was chosen on gold500b.
251
+
252
  The rule parser reads only CRediT names, so it finds nothing in narrative statements by design.
253
  The three labellers agreed exactly with each other on 85% to 91% of narrative articles and 94% to
254
+ 96% of CRediT articles. The model's exact scores (61% and 71%) sit well below that: it gets most
255
  pairs right, but often one pair per article wrong.
256
 
 
 
 
 
257
  ### Outside biomedicine
258
 
259
  `ood200b`: 147 CC BY / CC0 articles from 2022 on, drawn on 2026-11-23 from publishers outside Europe
 
264
 
265
  | | narrative F1 | narrative exact | CRediT F1 | CRediT exact |
266
  | --- | --- | --- | --- | --- |
267
+ | this model, PyTorch | 0.883 (0.851 to 0.913) | 0.42 | 0.949 (0.920 to 0.974) | 0.71 |
268
+ | previous per-author model, PyTorch | 0.894 (0.863 to 0.925) | 0.41 | 0.951 (0.922 to 0.973) | 0.68 |
269
+ | previous per-author model, int8 ONNX | 0.884 (0.854 to 0.914) | 0.35 | 0.949 (0.920 to 0.972) | 0.66 |
270
  | rule parser | 0.000 | 0.17 | 0.857 (0.799 to 0.907) | 0.49 |
271
 
272
+ Narrative statements score clearly lower than in the test set (0.883 against 0.964). Against the
273
+ per-author model, F1 differs by -0.011 (-0.025 to +0.003, paired) on narrative statements and -0.002
274
+ on CRediT ones. CRediT statements hold up once SRP is left out (0.968 on the other 56), and
275
+ narrative rises only to 0.895 without SRP, whose statements are often loosely worded. The labellers
276
+ also agreed less: 78% to 82% of narrative articles and 87% to 95% of CRediT articles. Training on
277
+ 269 more narrative statements from these publishers (Pensoft left out) did not close the per-author
278
+ model's gap over two seeds. OpenAlex's role data, which reads CRediT names in full text, has roles
279
+ for 43 of the 76 CRediT articles and none of the narrative ones; on those 43 the per-author model
280
+ scores F1 0.968 and OpenAlex 0.899 (checked 2026-11-26).
281
 
282
  ### Dev set used for model choice
283
 
 
285
  these scores are optimistic. Its narrative stratum is harder than the test set's: it holds the
286
  statements an earlier labelling marked as having no CRediT roles.
287
 
288
+ | | narrative F1 | narrative exact | CRediT F1 | CRediT exact |
289
+ | --- | --- | --- | --- | --- |
290
+ | this model (seed 2), PyTorch | 0.931 (0.911 to 0.948) | 0.506 | 0.974 (0.963 to 0.985) | 0.801 |
291
+ | same recipe, seed 1 | 0.929 | 0.485 | 0.972 | 0.797 |
292
+ | w8 ONNX | 0.931 | 0.502 | 0.974 | 0.797 |
293
+ | int8 ONNX (not shipped) | 0.922 | 0.418 | 0.972 | 0.747 |
294
+ | previous per-author model, PyTorch | 0.930 | 0.506 | 0.976 | 0.808 |
295
+ | rule parser | 0.069 | | 0.903 | |
296
+
297
+ Paired against the per-author model on gold500b (2,000 bootstrap resamples), CRediT exact changes
298
+ by -0.011 (95% interval -0.038 to +0.015) for seed 1 and -0.008 (-0.034 to +0.019) for seed 2, and
299
+ CRediT F1 by -0.004 and -0.001. Against the per-author int8 copy the app loaded, seed 2's w8 copy
300
+ changes CRediT exact by +0.004 (-0.019 to +0.031) and narrative exact by +0.029 (-0.017 to +0.071).
301
+
302
+ ### int8 against w8
303
+
304
+ int8 (`quantize_dynamic`) quantises activations with one scale per call. A one-pass call holds
305
+ every author of the statement, and int8 lost pairs: on gold500b it matched the PyTorch model on
306
+ 56.5% of narrative and 79.7% of CRediT articles, and CRediT exact fell from 0.801 to 0.747. A
307
+ threshold fitted to it did not win this back. w8 keeps activations in fp32 and stores the weights
308
+ of the linear layers in 8 bits in blocks of 32 (MatMulNBits) and the embedding table in int8. It
309
+ matched PyTorch on 88.7% of narrative and 96.6% of CRediT gold500b articles, at 75 MB against
310
+ int8's 70 MB, so w8 is the copy the app loads.
311
+
312
+ ### Speed
313
+
314
+ In Chromium with 4 threads on eight desktop cores, 20 authors: the one-pass w8 copy reads a
315
+ 164-token statement in 0.80 to 0.90 s and a long statement (2 chunks) in 2.8 to 3.5 s. The previous
316
+ per-author int8 model took 2.5 to 2.7 s and 21.6 to 24.0 s. The model loads in 2.8 s cold and
317
+ 1.1 s from the cache.
318
 
319
  ## Limitations
320
 
 
326
  surname. Bylines in other orders, and statements with swapped or misspelled initials, depend on
327
  the model reading the name itself.
328
  - **Biomedical sources.** Europe PMC is biomedical by construction, and Frontiers and MDPI lead the
329
+ training data. Outside biomedicine, narrative statements score about 0.08 F1 lower (see
330
  [Outside biomedicine](#outside-biomedicine)).
331
  - **Labels.** The gold sets were made by language-model labellers with a vote and an adjudicator. A
332
  person checked 40 rows of the pilot set (36 right) and ruled on 4 of 40 sampled gold500b rows,
333
  which changed the definition. Nobody checked the test set by hand; a person ruled on the 5 split
334
  rows of ood200b. Part of the training data comes from publisher tags, which can name roles a
335
  statement never gives.
336
+ - **Long statements.** A statement is cut at 1,024 tokens less the room its authors need (at most a
337
+ quarter), so very long statements lose more text than the per-author model's cut did.
338
 
339
  ## Licence
340
 
best.json CHANGED
@@ -1,8 +1,8 @@
1
  {
2
  "epoch": 1,
3
  "threshold": 0.4,
4
- "precision": 0.93,
5
- "recall": 0.963,
6
- "f1": 0.946,
7
- "exact": 0.701
8
  }
 
1
  {
2
  "epoch": 1,
3
  "threshold": 0.4,
4
+ "precision": 0.937,
5
+ "recall": 0.965,
6
+ "f1": 0.951,
7
+ "exact": 0.693
8
  }
config.json CHANGED
@@ -104,6 +104,6 @@
104
  "sparse_pred_ignore_index": -100,
105
  "sparse_prediction": false,
106
  "tie_word_embeddings": true,
107
- "transformers_version": "5.20.2",
108
  "vocab_size": 50368
109
  }
 
104
  "sparse_pred_ignore_index": -100,
105
  "sparse_prediction": false,
106
  "tie_word_embeddings": true,
107
+ "transformers_version": "5.23.0",
108
  "vocab_size": 50368
109
  }
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a48dff938802fef29959e193d2ed7c3a5bd6ca3a3ae1fef6ff5f308f128e8e86
3
  size 273670208
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e74f68491f212b746c89f1e5c1cc4e03b9a3a0cf9c0c43b68f07d8e10afc54d
3
  size 273670208
onnx/model.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ea66c786ba8d7fa33a490f707444a62f6e2589420b963afd129bc27440b85530
3
- size 275281398
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad261fb9b72b4e1f05bf7702ea8c5b7e43ccdb7976afd292a321c6b78f7b79cd
3
+ size 275238578
onnx/model_int8.onnx DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:0157d52635f2a0a5482591ef525a40ddaac02b5ecb774587f945480b4a6b67ee
3
- size 70038085
 
 
 
 
run.json CHANGED
@@ -5,12 +5,14 @@
5
  "dev_articles": 2000,
6
  "dev_every": 50,
7
  "max_length": 1024,
8
- "batch_size": 32,
9
  "epochs": 1,
10
- "learning_rate": 3e-05,
11
  "weight_decay": 0.01,
12
  "warmup_share": 0.06,
13
- "seed": 1,
14
  "open_licence_only": true,
15
- "device": "cuda"
 
 
16
  }
 
5
  "dev_articles": 2000,
6
  "dev_every": 50,
7
  "max_length": 1024,
8
+ "batch_size": 8,
9
  "epochs": 1,
10
+ "learning_rate": 0.00003,
11
  "weight_decay": 0.01,
12
  "warmup_share": 0.06,
13
+ "seed": 2,
14
  "open_licence_only": true,
15
+ "device": "cuda",
16
+ "init": "ettin-68m-both-s1",
17
+ "marker": "[unused0]"
18
  }
tokenizer_config.json CHANGED
@@ -2,7 +2,7 @@
2
  "backend": "tokenizers",
3
  "clean_up_tokenization_spaces": true,
4
  "cls_token": "[CLS]",
5
- "is_local": false,
6
  "local_files_only": false,
7
  "mask_token": "[MASK]",
8
  "model_input_names": [
 
2
  "backend": "tokenizers",
3
  "clean_up_tokenization_spaces": true,
4
  "cls_token": "[CLS]",
5
+ "is_local": true,
6
  "local_files_only": false,
7
  "mask_token": "[MASK]",
8
  "model_input_names": [