YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

arXiv long-document classifier (ModernBERT-base)

Fine-tunes answerdotai/ModernBERT-base (149.7M params, native 8192-token context) to predict one of 11 arXiv subject classes from a paper's full text, using ccdv/arxiv-classification (config default: 28.4K train / 2.5K validation / 2.5K test, columns text + label).

Status — code complete, run not yet executed

The training run has not been executed: the session that produced this repo had no compute-job surface, and its token could not write model repos under the target namespace. Nothing below is a reported result — expected numbers are estimates only.

  • Target destination for the trained weights: GuillaumeSalouHF/ml-eval-arxiv-long-docs-09502a-r0 (set as HUB_MODEL_ID in train.py; any token with write access there works).
  • Trackio dashboard (fills in live when a run starts): GuillaumeSalouHF/modernbert-arxiv-classification-trackio.

How to run

On any 24 GB GPU (A10G-class or better), with HF_TOKEN set to a token that can write the target repo:

uv run smoke_test.py   # ~10 min: 3 real steps at bs 8 x 8192 tokens; reports peak memory and s/step
uv run train.py        # ~2.5-4 h estimated; use a >= 5 h timeout if run under a job system

train.py is self-contained (PEP 723 inline deps, pinned to transformers==4.57.1): it loads the dataset, measures label leakage, trains, evaluates validation + test, logs to trackio, pushes the model/tokenizer to the target repo, and prints/saves metrics.json.

Design (agreed scope)

Choice Value Why
Base model ModernBERT-base Native 8192-token context; docs here are all >4K tokens (median ≈ 8–10K)
Max length 8192 tokens Covers the bulk of real documents; longer ones truncated
Train set Stratified 10K of 28.4K Compute-budget compromise chosen by the user
Schedule 1 epoch, LR 8e-5, 5% warmup, linear decay Authors' classification sweep (arXiv 2412.13663 §3.1.1)
Batch 8 × grad-accum 2 = 16 effective, bf16, gradient checkpointing Fits 8192-token batches on 24 GB
Attention SDPA + group_by_length=True flash-attn not compiled; length grouping avoids padding every batch to 8192
Metrics accuracy, macro-F1 11-class, roughly balanced stratification
Eval protocol validation per epoch, held-out test once at the end no test peeking during training

Known caveat: label leakage in the default config

The dataset text includes the arXiv header line, e.g. arXiv:1611.03253v1 [cs.DS] — the subject tag can appear verbatim in the text. train.py measures this on 300 sampled documents at startup and prints the tag↔label agreement rate; it is also written into metrics.json. If the rate is high, reported accuracy is partly inflated and the model should not be read as genuinely learning subject matter from the body text. The no_ref config (references stripped) is the natural leak-resistant variant to try next.

References

  • ModernBERT: arXiv 2412.13663 — fine-tuning sweep in §3.1.1; efficiency results in §4
  • Dataset: ccdv/arxiv-classification, from He et al., "Long Document Classification From Local Word Glimpses via Recurrent Attention Learning", IEEE Access 2019 (DOI 10.1109/ACCESS.2019.2909062)
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Papers for ml-intern-internal/arxiv-long-doc-classifier-modernbert