A multilingual version of HuggingFaceTB/finemath-classifier.
It scores a document in any language on the FineMath 0–5 scale (educational, step-by-step mathematical content),
so that multilingual web corpora can be filtered the way FineMath filters English ones.
It is a small MLP on top of frozen jhu-clsp/mmBERT-base
embeddings, trained with the translation-based transfer method of Sabolčec et al.,
Adapting English Quality Classifiers for Multilingual LLM Pretraining Data Selection (arXiv 2610.11585).
If mmBERT embeddings of a corpus already exist, scoring it costs only the MLP forward pass.
Read the evaluation section before relying on it: on unfiltered multilingual web text this model is not better than applying the original FineMath classifier directly to non-English text. The two make different mistakes, and averaging their scores is more precise than either alone.
from huggingface_hub import hf_hub_download
import importlib.util, sys
repo = "Olivia-umich/mfinemath-classifier"
spec = importlib.util.spec_from_file_location("mfinemath", hf_hub_download(repo, "mfinemath.py"))
mfinemath = importlib.util.module_from_spec(spec); spec.loader.exec_module(mfinemath)
scorer = mfinemath.MFineMathScorer(repo, device="cuda")
scores = scorer.score(["Pour résoudre 2x + 3 = 11, on soustrait 3 : 2x = 8, donc x = 4."])
keep = [s >= 2.5 for s in scores] # FineMath 3+ (4+ is s >= 3.5)
Input recipe (must be reproduced exactly): jhu-clsp/mmBERT-base at revision
c5955035435e2bf121cde7f3c8863ef52ff35d82, bf16, up to 8192 tokens, mean pooling of the last hidden
state over non-padding tokens → 768-d vector → MLP 768 → 3072 → 3072 → 1 (ReLU).
model.safetensors and model.pt hold the same MLP weights (keys classifier.{0,2,4}.{weight,bias}).
| Step | What was done |
|---|---|
| Parallel data | 544,030 (original document, English translation) pairs in 311 languages from FineTranslations-Edu, the education-filtered subset of FineTranslations. The translations were made by Hugging Face with Gemma 3 27B (google/gemma-3-27b-it) when building FineTranslations; no translation was run for this model. |
| Labels | HuggingFaceTB/finemath-classifier scored the English translation (first 512 tokens); that score is the label of the original-language document. |
| Inputs | mmBERT-base mean-pooled embedding of the original-language document. |
| English anchor data | 975,887 English documents scored directly by the FineMath classifier: FineMath 3+ and InfiWebMath 3+ (math positives), plus samples of MegaMath, FineWeb-edu and DCLM-edu. |
| Split | By document: 90% train, 5% validation, 5% test. Training set: 489,286 multilingual + 878,133 English = 1,367,419 documents. |
| Model | MLP 768 → 3072 → 3072 → 1 with ReLU, on frozen embeddings. |
| Optimisation | L1 regression loss, AdamW, peak learning rate 3e-4 with 10% linear warm-up then cosine decay, batch size 1024, 6 epochs, seed 0. |
About 2.2% of the multilingual pairs are FineMath 3+ by the teacher, so most positive examples are English.
The transfer paper translated its own FineWeb2 sample with Qwen3-32B; here that step was replaced by the existing Gemma 3 translations.
27,589 held-out documents, 617 of them 3+. Target: FineMath classifier score of the English translation.
The baseline is the original FineMath classifier applied directly to the original-language text
(possible because its encoder, multilingual-e5-small, is multilingual).
| Scorer | MAE | Spearman | F1 at 3+ | Precision | Recall | Average precision |
|---|---|---|---|---|---|---|
| This model | 0.154 | 0.848 | 0.804 | 0.883 | 0.737 | 0.889 |
| Original classifier on original text | 0.168 | 0.841 | 0.828 | 0.799 | 0.859 | 0.916 |
| Same MLP trained on English data only | 0.257 | 0.606 | 0.568 | 0.870 | 0.421 | 0.727 |
Multilingual training pairs matter (English-only training is far worse), but the original classifier used zero-shot is already as good on this measure. On six languages removed from training (Japanese, Turkish, Persian, Hindi, Finnish, Greek) F1 dropped from 0.78 (baseline) to 0.63.
Llama-3.1-70B-Instruct with the official FineMath annotation prompt judged a stratified sample of 6,739 documents. Numbers below are for unfiltered multilingual web text (a 1.5M-document slice of FineWeb2). "Math docs kept" is the share of judge-confirmed 3+ documents found by either classifier that the rule keeps.
| Selection rule | Share of corpus kept | Precision | Math docs kept |
|---|---|---|---|
| This model ≥ 2.5 | 0.190% | 0.46 | 0.85 |
| Original classifier ≥ 2.5 | 0.196% | 0.45 | 0.85 |
| Average of both ≥ 2.5 | 0.159% | 0.55 | 0.84 |
| Average of both ≥ 3.0 | 0.076% | 0.74 | 0.55 |
| Average of both ≥ 3.5 | 0.034% | 0.90 | 0.29 |
model.pt 45 MiBmodel.safetensors 45 MiB