Lune

EMNLP2024Top-tier venue

Fishing for Magikarp: Automatically Detecting Under-trained Tokens in Large Language Models

Sander Land, Max Bartolo

Abstract

The disconnect between tokenizer creation and model training in language models allows for specific inputs, such as the infamous SolidGoldMagikarp token, to induce unwanted model behaviour. Although such ‘glitch tokens’, tokens present in the tokenizer vocabulary but that are nearly or entirely absent during model training, have been observed across various models, a reliable method to identify and address them has been missing. We present a comprehensive analysis of Large Language Model tokenizers, specifically targeting this issue of detecting under-trained tokens. Through a combination of tokenizer analysis, model weight-based indicators, and prompting techniques, we develop novel and effective methods for automatically detecting these problematic tokens. Our findings demonstrate the prevalence of such tokens across a diverse set of models and provide insights into improving the efficiency and safety of language models.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

31 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • OLMo: Accelerating the Science of Language Models cites Pythia: A Suite for Analyzing Large Language Models Across Training and Scaling
  • One Tokenizer To Rule Them All: Emergent Language Plasticity via Multilingual Tokenizers cites Pythia: A Suite for Analyzing Large Language Models Across Training and Scaling
  • One Tokenizer To Rule Them All: Emergent Language Plasticity via Multilingual Tokenizers cites Zero-Shot Tokenizer Transfer
  • Data Mixture Inference Attack: BPE Tokenizers Reveal Training Data Compositions cites OLMo: Accelerating the Science of Language Models
  • Data Mixture Inference Attack: BPE Tokenizers Reveal Training Data Compositions cites Pythia: A Suite for Analyzing Large Language Models Across Training and Scaling
  • SpaceByte: Towards Deleting Tokenization from Large Language Modeling cites MEGABYTE: Predicting Million-byte Sequences with Multiscale Transformers
  • Zero-Shot Tokenizer Transfer cites MEGABYTE: Predicting Million-byte Sequences with Multiscale Transformers
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers31

  1. Not All Tokens Are What You Need for PretrainingZhenghao Lin, Zhibin Gou, Yeyun Gong, Xiao Liu et al.NeurIPS 2024 · 99 citations
  2. Zero-Shot Tokenizer TransferBenjamin Minixhofer, Edoardo Maria Ponti, Ivan VulicNeurIPS 2024 · 37 citations
  3. Dense SAE Latents Are Features, Not BugsXiaoqing Sun, Alessandro Stolfo, Joshua Engels, Ben Wu et al.NeurIPS 2025 · 19 citations
  4. Data Mixture Inference Attack: BPE Tokenizers Reveal Training Data CompositionsJonathan Hayase, Alisa Liu, Yejin Choi, Sewoong Oh et al.NeurIPS 2024 · 16 citations
  5. One Tokenizer To Rule Them All: Emergent Language Plasticity via Multilingual TokenizersDiana Abagyan, Alejandro Salamanca, Andrés Felipe Cruz-Salinas, Kris Cao et al.ACL 2026 · 11 citations

Builds on6

  1. Pythia: A Suite for Analyzing Large Language Models Across Training and ScalingStella Biderman, Hailey Schoelkopf, Quentin Gregory Anthony, Herbie Bradley et al.ICML 2023 · 1,822 citations
  2. MEGABYTE: Predicting Million-byte Sequences with Multiscale TransformersLili Yu, Daniel Simig, Colin Flaherty, Armen Aghajanyan et al.NeurIPS 2023 · 197 citations
  3. Byte Pair Encoding is Suboptimal for Language Model PretrainingKaj Bostrom, Greg DurrettEMNLP Findings 2020 · 180 citations
  4. OLMo: Accelerating the Science of Language ModelsDirk Groeneveld, Iz Beltagy, Evan Pete Walsh, Akshita Bhagia et al.ACL 2024 · 52 citations
  5. SpaceByte: Towards Deleting Tokenization from Large Language ModelingKevin SlagleNeurIPS 2024 · 34 citations

Related papers

  1. Glitch Tokens in Large Language Models: Categorization Taxonomy and Effective DetectionYuxi Li, Yi Liu, Gelei Deng, Ying Zhang et al.FSE 2024 · 12 citations
  2. GlitchProber: Advancing Effective Detection and Mitigation of Glitch Tokens in Large Language ModelsZhibo Zhang, Wuxia Bai, Yuxi Li, Mark Huasong Meng et al.ASE 2024 · 2 citations
  3. GlitchMiner: Mining Glitch Tokens in Large Language Models via Gradient-based Discrete OptimizationZihui Wu, Haichang Gao, Ping Wang, Shudong Zhang et al.AAAI 2026 · 1 citation
  4. One Bad Token Spoils the Barrel: Assessment, Detection, and Remediation of Glitch Tokens in Large Language ModelsKunsheng Tang, Peigui Qi, Yide Song, Wenbo Zhou et al.USENIX Security 2026
  5. GlitchCleaner: Lightweight Glitch Tokens Repairing by Lossless Gated LoRA in Large Language ModelsYibo Fan, Jingru Li, Huan LiAAAI 2026
Dusk over the sea between two cliffs drawn in fine vertical lines