r/learnmachinelearning • u/SignificantZebra5883 • 13h ago
Help My coreference model is stuck at 90% on Czech, but the labels are ~98% clean. Where's the missing 8%?
hey guys, im trying to make a custom head that groups the words in a text that refer to the same entity (coreference). every mention picks ONE earlier mention, or "none" if it is a new thing.
ive been trying for a day and cant get past about 90 % right picks. could you please look at the architecture?
this is the whole thing: load the dataset, add the head, train on everything twice, test.
# Czech coreference as a CHOICE: every mention picks ONE earlier mention, or "none" (= a new thing).
# mmBERT-base (all of it trains) + a tiny head, 2 passes over the training data. pip install torch transformers datasets
=
;
=
=
=
= # CorefUD 1.4, the Czech part
"""-> tokens, the token of every mention's head word (in text order), the entity id of every mention"""
=
= ; =
=
return , ,
"""-> table (n, n + 1). one row per mention. column 0 = "none", column j + 1 = "the same thing as mention j" """
= .; = # one vector per mention
, = ,
= # the score of "mention i is the same thing as mention j"
= # only EARLIER mentions can be picked
return # "none" always has the score 0
"""True where an option is a right answer: every earlier mention of the same entity, or "none" when there is no such mention"""
=
return
"""the dev documents, which the model never trains on -> share of mentions whose top pick is right"""
; = = 0
, , =
+= ; +=
return f
, = 2, # 1 step = 1 document. 5,679 documents, seen twice
=
= # both learning rates fall in a straight line to 0
, , =
=
= - # minus log of the probability that sits on the right options
; ;
# hands unused GPU memory back (Apple only)
on my mac mini (M4 pro, 24 GB) it takes about 38 minutes and prints 88.4 % after epoch 1 and 89.7 % after epoch 2.
im vibe coding most of this, so please let me know if i overlooked something critical. what i found so far:
- a gentle LR for the head (1e-4, not 1e-3) keeps its neurons alive, but the score stays the same
- the head doesnt really matter. wider, deeper, a transformer block inside it: same score
- a bigger base barely helps, which is puzzling. XLM-RoBERTa-large with 4 epochs gets 90.75 %, and EuroBERT-610m is far worse (it never saw czech)
- a 3rd epoch gives nothing
- when both models are wrong, they pick the very same wrong option 80 % of the time
the dataset is public (CorefUD 1.4, the czech part), so this is perfectly reproducible. and the labels look about 98 % right, according to a blind check i ran with opus on the wrong picks.
could you guys help me reach 98 % on this dataset? thanks!