simonvanlierde commited on
Commit
5e8a1db
·
verified ·
1 Parent(s): 523d929

Upload ettin-68m-both-s1

Browse files
Files changed (9) hide show
  1. README.md +276 -0
  2. best.json +8 -0
  3. config.json +109 -0
  4. model.safetensors +3 -0
  5. onnx/model.onnx +3 -0
  6. onnx/model_int8.onnx +3 -0
  7. run.json +16 -0
  8. tokenizer.json +0 -0
  9. tokenizer_config.json +17 -0
README.md ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
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
9
+ tags:
10
+ - credit
11
+ - contributor-roles
12
+ - scholarly-publishing
13
+ - multi-label-classification
14
+ - modernbert
15
+ - onnx
16
+ - transformers.js
17
+ ---
18
+
19
+ # CRediT statement reader (Ettin-68M)
20
+
21
+ This model reads an author contribution statement and says which of the 14
22
+ [CRediT](https://credit.niso.org/) roles each author holds. It reads statements written with the
23
+ CRediT role names and statements written in the authors' own words ("A.B. designed the study").
24
+ 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
69
+ import numpy as np, onnxruntime as ort
70
+ from huggingface_hub import hf_hub_download
71
+ from tokenizers import Tokenizer
72
+
73
+ REPO = "simonvanlierde/credit-statement-reader"
74
+
75
+
76
+ def initials(name):
77
+ *given, surname = name.split()
78
+ parts = [[p[0] for p in re.split(r"-+", g) if p] for g in given]
79
+ dotted = "".join("-".join(f"{c}." for c in g) for g in parts) + f"{surname[0]}."
80
+ compact = "".join(c for g in parts for c in g)
81
+ variants = [dotted, compact + surname[0]] + ([f"{surname} {compact}"] if compact else [])
82
+ return list(dict.fromkeys(variants))
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
+
104
+ print(read("A.B. designed the study and wrote the first draft. C.D. analysed the data.", ["Ann Bell", "Cy Dorn"]))
105
+ ```
106
+
107
+ In transformers.js, load it with
108
+ `AutoModelForSequenceClassification.from_pretrained(REPO, { dtype: "int8" })`.
109
+
110
+ A role whose probability sits near the threshold can flip between runtimes and batch sizes, because
111
+ the int8 copy quantises activations per batch. Reading one author at a time, as the snippet
112
+ does, the int8 copy gave the same pairs as the batched evaluation on 37 of 40 test articles. The fp32 copy gave the
113
+ same pairs as the PyTorch model on 39 of 40.
114
+
115
+ ## Intended use
116
+
117
+ - Reading contribution statements in the CRediT Matrix web app, in the browser, so the text never
118
+ leaves the user's machine.
119
+ - Reading free-text statements in bulk for the census, with the rule parser for statements that
120
+ use the CRediT names.
121
+ - A baseline for other work on contribution statements.
122
+
123
+ ## Out-of-scope use
124
+
125
+ - Judging what a person did. The model reads what a statement says, not what happened.
126
+ - Decisions about authorship, hiring or credit without a person reading the statement.
127
+ - Languages other than English. Every training statement is English.
128
+ - Text that is not a contribution statement. The model was trained on statements, and it will
129
+ still name roles for other text.
130
+
131
+ ## Labels: definition B
132
+
133
+ The labels follow "definition B" ([labelling/README.md](labelling/README.md) and
134
+ [labelling/definition-b.md](labelling/definition-b.md)). An author holds a role when the statement
135
+ says so, either with the CRediT name ("Conceptualization: A.B.") or in its own words ("A.B.
136
+ designed the study" is methodology). The mapping from common wording to roles follows the 2026
137
+ CRediT role examples (Hosseini et al., [doi:10.5281/zenodo.18421449](https://doi.org/10.5281/zenodo.18421449)).
138
+ ICMJE authorship wording ("substantial contributions to conception and design") is a pledge,
139
+ not a role. The scores below use the definition's general view: every role the statement names
140
+ or words.
141
+
142
+ ## Training data
143
+
144
+ All training text comes from CC BY and CC0 articles in Europe PMC's open-access subset, snapshot
145
+ `oa-2026-10` (`OPEN_LICENCE` in `src/census/export.py`). The training files name authors and are
146
+ not published.
147
+
148
+ | Part | Articles | Answer |
149
+ | --- | --- | --- |
150
+ | Statements with publisher role tags | 105,000 | the tags in the JATS XML |
151
+ | Statements with tags, read by a large language model | 15,000 | the model's reading |
152
+ | Narrative statements, read by Gemma 4 26B under definition B | 6,027 | the reading, if it passed the label gate |
153
+ | Unlabelled free-text statements | 40,000 | pairs that at least 3 of 5 earlier seeds of this model predicted |
154
+ | Statements with ICMJE pledge wording, read by Gemma 4 26B | 540 | the reading, which gives pledges no role |
155
+ | Total | 166,567 | |
156
+
157
+ The fourth row is self-distillation: five seeds of an earlier run each read 40,000 statements that
158
+ no labeller had seen, and a pair counts when three of them agree. Frontiers (55,167) and MDPI
159
+ (51,526) give most of the articles.
160
+
161
+ The split holds out every twentieth group of identical statements, in publisher and year order,
162
+ so no statement text sits on both sides. Its sha256 is
163
+ `fe3b1264b06d3fe98a9373cda8f9f46408f98b2ac4cf462f458f16f37683e43a`. One statement group in 50 is
164
+ kept out of training as a dev set (2,000 articles), which picks the threshold.
165
+
166
+ No article in the evaluation sets below is in the training data.
167
+
168
+ ## Training setup
169
+
170
+ | Setting | Value |
171
+ | --- | --- |
172
+ | Base model | `jhu-clsp/ettin-encoder-68m` at `ac19ae4bc51093b31c475665ac872a936d056cc2` |
173
+ | Articles | 166,567 |
174
+ | Epochs | 1 |
175
+ | Learning rate | 3e-5, linear decay, warm-up over the first 6% of steps |
176
+ | Batch size | 32 |
177
+ | Weight decay | 0.01 |
178
+ | Loss | binary cross-entropy over the 14 roles |
179
+ | Max length | 1,024 tokens |
180
+ | Seed | 1 |
181
+ | Hardware | one RTX 4090, bf16; 14.0 GB of GPU memory at most |
182
+ | Time | 1,654 s |
183
+ | Libraries | torch 2.15.0, transformers 5.20.2 |
184
+
185
+ Every setting is in `run.json` beside the weights (`encoder.Config`).
186
+
187
+ **Energy.** Training energy was not metered. Assuming about 0.5 kW for the RTX 4090 and its host,
188
+ 1,654 s is about 0.23 kWh. At the Dutch grid average that the census uses for its metered runs
189
+ (0.27 kg CO2e per kWh), that is about 0.06 kg CO2e. The model search behind this run took about
190
+ 100 training runs of similar size, so roughly 100 times that.
191
+
192
+ ## Evaluation
193
+
194
+ All scores count (author, role) pairs pooled over articles, against definition-B gold in the
195
+ general view. "Exact" is the share of articles whose pairs are all right. Intervals are 95%
196
+ bootstrap intervals over articles (2,000 resamples).
197
+
198
+ Three runs of a large language model labelled each gold set blind, and a fourth settled the rows
199
+ where all three differed ([labelling/README.md](labelling/README.md)).
200
+
201
+ ### Test set (headline)
202
+
203
+ `test200b`: 200 articles drawn on 2026-11-21, after the model was chosen, and never used for any
204
+ choice. They are simple random samples of 100 from each of two pools of CC BY / CC0 free-text
205
+ statements with 2 to 30 authors that no other label set, training set or the held-out split
206
+ used:
207
+
208
+ - **narrative**: statements that use none of the CRediT role names (163,619 in the pool);
209
+ - **CRediT**: statements that use them (917,709 in the pool).
210
+
211
+ | | narrative F1 | narrative exact | CRediT F1 | CRediT exact |
212
+ | --- | --- | --- | --- | --- |
213
+ | this model, PyTorch | 0.961 (0.944 to 0.975) | 0.59 | 0.973 (0.960 to 0.984) | 0.74 |
214
+ | this model, int8 ONNX | 0.960 (0.944 to 0.975) | 0.57 | 0.971 (0.956 to 0.984) | 0.73 |
215
+ | rule parser | 0.000 | 0.00 | 0.860 (0.800 to 0.910) | 0.56 |
216
+
217
+ The rule parser reads only CRediT names, so it finds nothing in narrative statements by design.
218
+ The three labellers agreed exactly with each other on 85% to 91% of narrative articles and 94% to
219
+ 96% of CRediT articles. The model's exact scores (59% and 74%) sit well below that: it gets most
220
+ pairs right, but often one pair per article wrong.
221
+
222
+ Per role on the test set, F1 is 0.87 or more for every role except narrative validation (0.80,
223
+ 21 gold pairs). Small roles have wide intervals: visualization has 10 narrative gold pairs,
224
+ funding acquisition 11.
225
+
226
+ ### Dev set used for model choice
227
+
228
+ `gold500b`: 500 articles (239 narrative, 261 CRediT). Every candidate run was scored on it, so
229
+ these scores are optimistic. Its narrative stratum is harder than the test set's: it holds the
230
+ statements an earlier labelling marked as having no CRediT roles.
231
+
232
+ | | narrative F1 | CRediT F1 |
233
+ | --- | --- | --- |
234
+ | this model (seed 1) | 0.930 (0.910 to 0.947) | 0.976 (0.963 to 0.986) |
235
+ | same recipe, seed 2 | 0.928 | 0.975 |
236
+ | int8 ONNX | 0.927 | 0.975 |
237
+ | rule parser | 0.069 | 0.903 |
238
+
239
+ On gold500b the weakest narrative roles are data curation (0.74, 75 gold pairs), software (0.79,
240
+ 57) and validation (0.83, 66).
241
+
242
+ ### int8 against fp32
243
+
244
+ On 2,000 held-out articles scored against publisher tags, fp32, int8 and q4 ONNX all reach F1
245
+ 0.904. int8 gives exactly the same pairs as fp32 on 95.1% of those articles. On gold500b the share
246
+ is 74.0% (61.5% narrative), because narrative statements put more probabilities near the
247
+ threshold. int8 is a quarter of the size (70 MB against 275 MB), so it is the copy the app loads.
248
+
249
+ ## Limitations
250
+
251
+ - **Extra roles.** Most remaining errors are roles added to authors who do hold other roles, such
252
+ as methodology next to formal analysis.
253
+ - **Rare roles in narrative text.** Data curation, software and validation are worded in many ways
254
+ and are rare in narrative statements; their F1 is lowest there.
255
+ - **Initials.** The author text guesses initials from the name, taking the last word as the
256
+ surname. Bylines in other orders, and statements with swapped or misspelled initials, depend on
257
+ the model reading the name itself.
258
+ - **Biomedical sources.** Europe PMC is biomedical by construction, and Frontiers and MDPI lead the
259
+ training data. Other fields and statement layouts are less well covered.
260
+ - **Labels.** The gold sets were made by language-model labellers with a vote and an adjudicator.
261
+ A person checked 40 rows of the pilot set (36 right) and ruled on 4 of 40 sampled gold500b rows,
262
+ which changed the definition. Nobody checked the test set by hand. Part of the training data
263
+ comes from publisher tags, which can name roles a statement never gives.
264
+ - **Long statements.** Statements over 1,024 tokens are cut.
265
+
266
+ ## Licence
267
+
268
+ The weights are released under the MIT licence, the same as Ettin. The training text is CC BY 4.0
269
+ or CC0 articles from the Europe PMC open-access subset; the weights do not contain that text, and
270
+ no training text is published with them.
271
+
272
+ ## How to cite
273
+
274
+ Cite CRediT Matrix as <https://doi.org/10.5281/zenodo.21213659> (metadata in
275
+ [`CITATION.cff`](https://github.com/simonvanlierde/credit-matrix/blob/main/CITATION.cff)). Cite
276
+ Ettin as [its model card](https://huggingface.co/jhu-clsp/ettin-encoder-68m) asks.
best.json ADDED
@@ -0,0 +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
+ }
config.json ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "gradient_checkpointing": false,
21
+ "hidden_activation": "gelu",
22
+ "hidden_size": 512,
23
+ "id2label": {
24
+ "0": "conceptualization",
25
+ "1": "data-curation",
26
+ "2": "formal-analysis",
27
+ "3": "funding-acquisition",
28
+ "4": "investigation",
29
+ "5": "methodology",
30
+ "6": "project-administration",
31
+ "7": "resources",
32
+ "8": "software",
33
+ "9": "supervision",
34
+ "10": "validation",
35
+ "11": "visualization",
36
+ "12": "writing-original-draft",
37
+ "13": "writing-review-editing"
38
+ },
39
+ "initializer_cutoff_factor": 2.0,
40
+ "initializer_range": 0.02,
41
+ "intermediate_size": 768,
42
+ "is_causal": false,
43
+ "label2id": {
44
+ "conceptualization": 0,
45
+ "data-curation": 1,
46
+ "formal-analysis": 2,
47
+ "funding-acquisition": 3,
48
+ "investigation": 4,
49
+ "methodology": 5,
50
+ "project-administration": 6,
51
+ "resources": 7,
52
+ "software": 8,
53
+ "supervision": 9,
54
+ "validation": 10,
55
+ "visualization": 11,
56
+ "writing-original-draft": 12,
57
+ "writing-review-editing": 13
58
+ },
59
+ "layer_norm_eps": 1e-05,
60
+ "layer_types": [
61
+ "full_attention",
62
+ "sliding_attention",
63
+ "sliding_attention",
64
+ "full_attention",
65
+ "sliding_attention",
66
+ "sliding_attention",
67
+ "full_attention",
68
+ "sliding_attention",
69
+ "sliding_attention",
70
+ "full_attention",
71
+ "sliding_attention",
72
+ "sliding_attention",
73
+ "full_attention",
74
+ "sliding_attention",
75
+ "sliding_attention",
76
+ "full_attention",
77
+ "sliding_attention",
78
+ "sliding_attention",
79
+ "full_attention"
80
+ ],
81
+ "local_attention": 128,
82
+ "max_position_embeddings": 7999,
83
+ "mlp_bias": false,
84
+ "mlp_dropout": 0.0,
85
+ "model_type": "modernbert",
86
+ "norm_bias": false,
87
+ "norm_eps": 1e-05,
88
+ "num_attention_heads": 8,
89
+ "num_hidden_layers": 19,
90
+ "pad_token_id": 50283,
91
+ "position_embedding_type": "sans_pos",
92
+ "problem_type": "multi_label_classification",
93
+ "rope_parameters": {
94
+ "full_attention": {
95
+ "rope_theta": 160000.0,
96
+ "rope_type": "default"
97
+ },
98
+ "sliding_attention": {
99
+ "rope_theta": 160000.0,
100
+ "rope_type": "default"
101
+ }
102
+ },
103
+ "sep_token_id": 50282,
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
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a48dff938802fef29959e193d2ed7c3a5bd6ca3a3ae1fef6ff5f308f128e8e86
3
+ size 273670208
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ea66c786ba8d7fa33a490f707444a62f6e2589420b963afd129bc27440b85530
3
+ size 275281398
onnx/model_int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0157d52635f2a0a5482591ef525a40ddaac02b5ecb774587f945480b4a6b67ee
3
+ size 70038085
run.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "jhu-clsp/ettin-encoder-68m",
3
+ "revision": "ac19ae4bc51093b31c475665ac872a936d056cc2",
4
+ "train_articles": 166567,
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
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
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": [
9
+ "input_ids",
10
+ "attention_mask"
11
+ ],
12
+ "model_max_length": 8192,
13
+ "pad_token": "[PAD]",
14
+ "sep_token": "[SEP]",
15
+ "tokenizer_class": "TokenizersBackend",
16
+ "unk_token": "[UNK]"
17
+ }