Renaissance Labs · Skills

Skills / language-probe

Evaluation & Trust

language-probe

Zero-GPU language-readiness probe for Hugging Face base models. Measures tokenizer efficiency (fertility, bytes/token, parity vs. English on parallel text, word fragmentation, sub-character byte tokens) and optionally fetches only the needed input-embedding rows via HTTP range requests to inspect norm ratios, low-norm occurrence rates, and embedding isotropy without downloading full checkpoints. Includes Spearman correlation with permutation p-values against benchmark scores.

npx skills add RenaissanceLabs-EU/skills --skill language-probe

scripts/language_probe.py probes how a model's tokenizer and input-embedding table represent different languages — without downloading full model weights or needing a GPU.

It downloads only tokenizer.json (+ config.json) and, with --embeddings, fetches just the needed rows of embed_tokens.weight (or wte/word_embeddings) using HTTP Range requests against the Hub CDN.

Run it from this skill's folder:

# Probe tokenizer efficiency on the bundled 8-language parallel sample (en, sv, de, fr, fi, ko, zh, ar)
uv run -q scripts/language_probe.py probe Qwen/Qwen3-8B utter-project/EuroLLM-9B-Instruct --out probe.json

# Also probe input-embedding rows via HTTP range requests (no full checkpoint download)
uv run -q scripts/language_probe.py probe Qwen/Qwen3-8B utter-project/EuroLLM-9B-Instruct \
  --embeddings --langs en,sv,fi,ko,ar --out probe_emb.json

# Fetch a larger parallel corpus from FLORES+ (requires HF_TOKEN with dataset access)
python3 scripts/language_probe.py fetch-flores --langs en,sv,da,nb,fi,de,fr,ko,zh,ar --n 200 --out ./flores200

# Correlate structural probe metrics against your own benchmark scores CSV (columns: model,lang,score)
python3 scripts/language_probe.py correlate probe_emb.json --scores bench_scores.csv

# Render Markdown from any probe receipt
python3 scripts/language_probe.py report probe_emb.json

What it measures

MetricScopeWhat it tells you
tokens_per_word / tokens_per_charTokenizerFertility — how many tokens are spent per word (space-delimited languages) or per character (zh, ja, th, ...)
bytes_per_tokenTokenizerCompression efficiency in UTF-8 bytes per token
parity_vs_enTokenizer (parallel)Ratio of target-language tokens to English tokens on the exact same parallel sentences (1.0 = parity with English; 2.0 = twice the context cost and latency)
multi_token_word_rate / heavy_fragment_word_rateTokenizerShare of words split into >= 2 or >= 3 tokens
sub_char_token_rateTokenizerShare of tokens that split a single Unicode character into byte pieces (strong signal of poor script coverage)
weighted_norm_ratioEmbeddings (--embeddings)Occurrence-weighted L2 norm of the language's top tokens divided by the median norm of a random vocabulary baseline
low_norm_occurrence_rateEmbeddings (--embeddings)Share of corpus token occurrences whose embedding norm falls below the 2nd percentile of the random baseline (catches undertrained / collapsed token rows)
mean_centered_cosEmbeddings (--embeddings)Mean pairwise cosine similarity after subtracting the baseline mean (checks whether a language's tokens collapse into a tight cone)

Reading results honestly

  • Structure != benchmark accuracy: tokenizer efficiency and embedding norms measure *representation overhead and training coverage*, not reasoning quality or factual knowledge. Always use correlate against real benchmark scores before treating a metric as predictive.
  • Bundled sample vs. full parallel corpus: the bundled corpus in corpus/sample/ has 12 everyday parallel sentences per language — great for fast smoke checks and relative ranking, too small for fine-grained tail-token estimates. Use fetch-flores (or your own parallel <lang>.txt directory) for serious studies.
  • Tokenizer-only repos: requires tokenizer.json (fast tokenizer format). Legacy SentencePiece-only repos without tokenizer.json are skipped with status: missing_tokenizer.
  • Gated models: set HF_TOKEN (or log in with huggingface-cli login) after accepting the model's license; auth headers are stripped automatically on CDN redirects.