Skip to content

Commit 42e0eca

Browse files
davanstrienclaude
andauthored
classification: bump GLiNER2 scripts to gliner2 2.1.0 (#133)
Re-ran the BL books train command on t4-small (seed 42): 2.1.0 defaults 0.902, 2.1.0 --label-augmentation off 0.937, 2.0.0 off 0.931 (zero-shot 0.793 in all, within the 0.897-0.925 seed range). classify-gliner2.py works with an existing fine-tuned model. Notes record the 2.1.0 fix for augmentation training the gold label as a negative (GLiNER2#187). Claude-Session: https://claude.ai/code/session_01L439SPPyDae32VvbAABkz8 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent bb928c7 commit 42e0eca

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

‎classification/GLINER2-NOTES.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ Each README command was run from the branch before merge (`t4-small`, 2026-09-23
1515
| classify zero-shot, `fancyzhx/ag_news` test, 4 labels | 7,600 rows labelled | 96 s | ~$0.02 |
1616
| train, `fancyzhx/ag_news`, `--max-train-samples 2000 --epochs 2` | 0.733 → 0.873 (2,000 test rows) | 137 s training, 298 s whole Job | ~$0.03 |
1717

18+
Re-run after the bump to `gliner2` 2.1.0 (`t4-small`, seed 42, 2026-10-22), same BL books command:
19+
20+
| Run | Fine-tuned (174 rows) | Training |
21+
|---|---|---|
22+
| 2.1.0, defaults | 0.902 | 145 s |
23+
| 2.1.0, `--label-augmentation off` | 0.937 | 135 s |
24+
| 2.0.0, `--label-augmentation off` | 0.931 | 135 s |
25+
| classify with an existing fine-tuned model, 2.1.0 | 500 rows in 13 s | – |
26+
27+
Zero-shot is 0.793 in all three. One seed each, and five 2.0.0 seeds on this split ranged
28+
0.897–0.925, so these differences are within the noise.
29+
1830
The ag_news README row (0.718 → 0.852) and this run (0.733 → 0.873) differ because the 2,000
1931
scored test rows are a different random sample. Expect roughly 0.72 → 0.85–0.87.
2032

@@ -83,6 +95,9 @@ column names and first row (the worked example in the README).
8395
- Development top-1 in the owner's tags: base 0.695 / 0.686 (two seeds), small 0.653, zero-shot
8496
0.102. Always answering "text-generation" scores 0.320, so zero-shot is below a constant guess.
8597
- `--label-augmentation upstream` (gliner2's default) scored 0.664: turning it off added 2–3 points.
98+
This was measured on `gliner2` 2.0.0. In that version, label augmentation sometimes trained the
99+
real label as a negative (fixed in 2.1.0, [GLiNER2#187](https://github.com/fastino-ai/GLiNER2/pull/187)),
100+
so the gap may be smaller on 2.1.0. Not re-measured; `off` is still the right choice for a fixed label set.
86101
- The two seeds differ by about 1 point, almost all of it on one owner's 33 near-identical
87102
datasets that the model labels tabular-regression or tabular-classification depending on the seed.
88103
- Owner tags are noisy: in a hand-checked sample, about 1 in 10 datasets was missing a tag that fits.

‎classification/classify-gliner2.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# /// script
22
# requires-python = ">=3.11,<3.14"
33
# dependencies = [
4-
# "gliner2[local]==2.0.0",
4+
# "gliner2[local]==2.1.0",
55
# "protobuf",
66
# "sentencepiece",
77
# "datasets>=4.0.0,<6",

‎classification/train-gliner2.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# /// script
22
# requires-python = ">=3.11,<3.14"
33
# dependencies = [
4-
# "gliner2[train]==2.0.0",
4+
# "gliner2[train]==2.1.0",
55
# "protobuf",
66
# "sentencepiece",
77
# "datasets>=4.0.0,<6",
@@ -528,8 +528,8 @@ def resolve_precision(requested: str) -> str:
528528
def resolve_sampling_config(mode: str) -> SamplingConfig:
529529
"""Pick the gliner2 training-time label augmentation.
530530
531-
"upstream" is gliner2 2.0.0's default SamplingConfig. For each classification task in each
532-
training row, it replaces the real label names with "label 1", "label 2", ... half of the
531+
"upstream" is gliner2's default SamplingConfig (unchanged from 2.0.0 to 2.1.0). For each
532+
classification task in each training row, it replaces the real label names with "label 1", "label 2", ... half of the
533533
time (synthetic_label_prob=0.5), and drops a random share of up to half of the labels
534534
(remove_classification_label_prob=0.5; the true label is then put back only half of the
535535
time). That teaches a general zero-shot model to cope with unseen label sets.

0 commit comments

Comments
 (0)