Instructions to use bbin2022/arxiv_categories_recover_c161 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use bbin2022/arxiv_categories_recover_c161 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("bbin2022/arxiv_categories_recover_c161") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - fastText
How to use bbin2022/arxiv_categories_recover_c161 with fastText:
from huggingface_hub import hf_hub_download import fasttext model = fasttext.load_model(hf_hub_download("bbin2022/arxiv_categories_recover_c161", "model.bin")) - Notebooks
- Google Colab
- Kaggle
arxiv_categories_recover_c161: arXiv STEM-161 three-level category classifiers
Eight classifiers, one per arXiv subject group, that assign a scientific abstract to one of 161 categories of a
three-level STEM taxonomy built on arXiv: 8 groups > 19 archives > 161 categories. Labels read
GROUP_archive_category, for example PHYS_hep-ph_hep-ph.QCD, COMP_cs_cs.LG, MATH_math_math.AG.
The taxonomy respects arXiv: every arXiv category is its own category in its own group (nothing merged, nothing moved).
Fourteen categories are added where arXiv has no subject classes: hep-ph (4), hep-th (3), gr-qc (3) and quant-ph (4).
The full definition is in categories.json / categories.tsv; the design and its alignment with university
disciplines and with CIP, OECD FORD, ANZSRC and ISCED-F are in taxonomic_align.md.
Model
The paper's group (level 1) selects the model; the model predicts the group's labels from the abstract.
- Embedding: google/embeddinggemma-300m, document mode, abstract only, normalized (not included here: download it under the Gemma terms of use).
- Head per group: LayerNorm(768) > Linear(768, 2048) > GELU > Dropout(0.15) > Linear(2048, n), softmax.
- fastText per group on the abstract text, combined log-linearly: log P = log P_head + w log P_fasttext.
- Training: per category at most 3,000 arXiv abstracts labelled with the author's primary category (for the 14 added categories, papers whose title matched exactly one category), Kaggle arXiv metadata snapshot of 2026-10-10.
Accuracy
Top-1 on held-out papers (at most 300 per category, so small categories weigh as much as large ones):
| Group | Code | Categories | Training papers | EmbeddingGemma head | fastText | Ensemble |
|---|---|---|---|---|---|---|
| Physics | PHYS | 60 | 161,093 | 72.0% | 64.6% | 73.3% |
| Computer Science | COMP | 39 | 89,156 | 71.2% | 64.8% | 71.7% |
| Mathematics | MATH | 31 | 85,753 | 69.8% | 67.7% | 73.4% |
| Quantitative Biology | QBIO | 10 | 14,558 | 72.8% | 66.6% | 74.1% |
| Quantitative Finance | QFIN | 9 | 6,198 | 59.1% | 55.1% | 60.1% |
| Statistics | STAT | 5 | 11,353 | 74.5% | 71.0% | 76.1% |
| Electrical Engineering and Systems Science | EESS | 4 | 12,000 | 91.5% | 91.5% | 92.1% |
| Economics | ECON | 3 | 5,843 | 83.9% | 83.3% | 85.3% |
For the 14 added categories, agreement with an LLM judge (gpt-6-astra) on 100 random papers per archive is about 72%; these fields overlap in practice, so part of the disagreement is ambiguity.
Usage
from inference import STEM161
m = STEM161() # downloads google/embeddinggemma-300m, or pass embedding_model="/local/path"
m.predict("Physics", "We study gravitational waves from binary black hole mergers observed by LIGO and Virgo.")
# [{'label': 'PHYS_gr-qc_gr-qc.GW', 'category': 'gr-qc.GW', 'name': 'Gravitational Waves', 'score': 0.96}, ...]
pip install -r requirements.txt. Groups: Computer Science, Economics, Electrical Engineering and Systems Science, Mathematics, Physics, Quantitative Biology, Quantitative Finance, Statistics.
With fastText 0.9 builds under NumPy 2, predict one text at a time (batch prediction returns wrong probabilities);
inference.py does so.
Labels per group
- Computer Science (
COMP):COMP_cs_cs.AI,COMP_cs_cs.LG,COMP_cs_cs.MA,COMP_cs_cs.NE,COMP_cs_cs.CE,COMP_cs_cs.SY... - Economics (
ECON):ECON_econ_econ.GN,ECON_econ_econ.EM,ECON_econ_econ.TH - Electrical Engineering and Systems Science (
EESS):EESS_eess_eess.AS,EESS_eess_eess.SY,EESS_eess_eess.IV,EESS_eess_eess.SP - Mathematics (
MATH):MATH_math_math.CT,MATH_math_math.AC,MATH_math_math.GR,MATH_math_math.KT,MATH_math_math.NT,MATH_math_math.QA... - Physics (
PHYS):PHYS_physics_physics.atom-ph,PHYS_physics_physics.chem-ph,PHYS_physics_physics.atm-clus,PHYS_physics_physics.optics,PHYS_physics_physics.acc-ph,PHYS_physics_physics.app-ph... - Quantitative Biology (
QBIO):QBIO_q-bio_q-bio.BM,QBIO_q-bio_q-bio.CB,QBIO_q-bio_q-bio.PE,QBIO_q-bio_q-bio.GN,QBIO_q-bio_q-bio.NC,QBIO_q-bio_q-bio.TO... - Quantitative Finance (
QFIN):QFIN_q-fin_q-fin.CP,QFIN_q-fin_q-fin.GN,QFIN_q-fin_q-fin.MF,QFIN_q-fin_q-fin.PM,QFIN_q-fin_q-fin.PR,QFIN_q-fin_q-fin.EC... - Statistics (
STAT):STAT_stat_stat.ME,STAT_stat_stat.AP,STAT_stat_stat.CO,STAT_stat_stat.ML,STAT_stat_stat.OT
Files
| File | Content |
|---|---|
config.json |
groups, labels, file paths, ensemble weights |
categories.json, categories.tsv |
the 161 categories: label, group, archive, category, name, discipline, source |
taxonomic_align.md |
taxonomy design and alignment |
heads/*.safetensors |
the 8 MLP heads (fp16) |
fasttext/*.bin |
the 8 fastText models |
benchmark.json |
test results per group |
inference.py, example.py, requirements.txt |
usage |
Limitations
- Trained on arXiv abstracts only; other text types (full papers, web pages) may need adaptation.
- Scores are not calibrated: the fastText part is overconfident.
- arXiv's own categories overlap; a paper's primary category is often a judgement call.
- Downloads last month
- 17
Model tree for bbin2022/arxiv_categories_recover_c161
Base model
google/embeddinggemma-300m