BertScorer multilabel fine-tuning collapses on sparse data (no pos_weight/focal, no warmup, brittle default LR)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- python
- Domain
- machine-learning
Research direction
Start in autointent/modules/scoring/_bert.py, especially BertScorer._train(), and inspect the TrainingArguments and multilabel loss setup. Compare the behavior with _presets/transformers-no-hpo.yaml and transformers-light.yaml, then reproduce the reported GoEmotions results. Done means the proposed loss and warmup controls are exposed and defaults no longer silently collapse on the reported sparse multilabel task.
Written by the indexing model from the issue text.
Description
Summary
Fine-tuning the bert scorer on sparse multilabel data collapses to the base-rate (degenerate output) unless the learning rate is tuned narrowly. Contributing factors: plain BCEWithLogitsLoss with no pos_weight/focal option (so the trivial "predict the ~4% base rate everywhere" minimizes loss), no LR warmup in the TrainingArguments, and a brittle preset default LR.
Where
autointent/modules/scoring/_bert.py → BertScorer._train():
TrainingArguments(...)has nowarmup_ratio/warmup_steps.- Loss is the HF default for
problem_type="multi_label_classification"(BCEWithLogitsLoss, nopos_weight). _presets/transformers-no-hpo.yamlshipslearning_rate: [7.0e-5];transformers-light.yamlsearches1e-5…1e-4.
Evidence (bert-base-uncased, GoEmotions 28-class, ~2.5k balanced rows, MPS)
Best macro-F1 at the optimal threshold, full epochs:
| LR | result |
|---|---|
| 1e-5 | collapse (≈0.03; BCE plateaus at the base-rate floor ~0.17, near-constant outputs) |
| 3e-5 | collapse |
| 2e-5 | learns (≈0.22) |
| 2e-5 + warmup 0.1 | ≈0.18 (warmup alone didn't help here) |
So the stable LR band is narrow and the shipped defaults (3e-5 / 7e-5) land in the collapse region on this task.
Suggested fixes (in rough priority)
- Expose a class-imbalance loss option (
pos_weightor focal loss) via aTrainersubclass with a customcompute_loss— the principled fix for sparse multilabel; should widen the stable region substantially. - Add
warmup_ratio/warmup_stepstoTrainingArgumentsand expose it as a hyperparameter. - More robust preset defaults for multilabel (e.g. lr ≈ 2e-5 + warmup) so out-of-the-box runs don't silently collapse.
LR sensitivity is partly inherent, but (1)–(2) make it far less knife-edged.
Environment
AutoIntent 0.3.1, MPS, transformers/transformers-no-hpo presets, GoEmotions multilabel (28 classes, mean ~1.18 labels/example).
- Dominant language
- Python
- Stars
- 53
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from deeppavlov/AutoIntent
-
`OptimizationConfig.seed` is `PositiveInt` — `seed=0` is rejected while `Pipeline(seed=0)` accepts itPossibly taken @Gambit-Checkmate claimed this 21 days ago. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
deeppavlov/AutoIntent#352 ·
-
Extract `BaseAPIDescriptionScorer` shared by `LLMDescriptionScorer` and `TypeSafeDescriptionScorer`Openenhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
deeppavlov/AutoIntent#357 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 52/100
deeppavlov/AutoIntent#356 ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 72/100
deeppavlov/AutoIntent#355 · 1 comment ·
-
`LLMDescriptionScorer` runs cache hits through the `max_per_second` limiter — 10 s per 100 cached utterancesPossibly taken @kayaal34 claimed this 21 days ago. Openenhancement
Difficulty 4/5 3-5 days Newbie friendliness 58/100
deeppavlov/AutoIntent#354 ·
All issues in deeppavlov/AutoIntent
Similar issues
-
python-version
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
bug javascript P2-medium python release:v3.1
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
adrirubio/claude-deck#546 ·
Maintainers usually reply within 1 day
-
area: desktop area: website priority: P2 type: feature
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
appandflow/stim#3411 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 Under an hour Newbie friendliness 88/100
baptistehamon/lsapy#185 ·
Maintainers usually reply within 1 day