Papers › Charformer: Fast Character Transformers via Gradient-based Subword Tokenization

Charformer: Fast Character Transformers via Gradient-based Subword Tokenization

23 Jun 2021ICLR 2022 4arXiv:2106.12672archive 2025-07-28

Yi Tay, Vinh Q. Tran, Sebastian Ruder, Jai Gupta, Hyung Won Chung, Dara Bahri, Zhen Qin, Simon Baumgartner, Cong Yu, Donald Metzler

State-of-the-art models in natural language processing rely on separate rigid subword tokenization algorithms, which limit their generalization ability and adaptation to new settings. In this paper, we propose a new model inductive bias that learns a subword tokenization end-to-end as part of the model. To this end, we introduce a soft gradient-based subword tokenization module (GBST) that automatically learns latent subword representations from characters in a data-driven fashion. Concretely, GBST enumerates candidate subword blocks and learns to score them in a position-wise fashion using a block scoring network. We additionally introduce Charformer, a deep Transformer model that integrates GBST and operates on the byte level. Via extensive experiments on English GLUE, multilingual, and noisy text datasets, we show that Charformer outperforms a series of competitive byte-level baselines while generally performing on par and sometimes outperforming subword-based models. Additionally, Charformer is fast, improving the speed of both vanilla byte-level and subword-level Transformers by 28%-100% while maintaining competitive quality. We believe this work paves the way for highly performant token-free models that are trained completely end-to-end.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2106.12672")

Code

Syntology Ran 7 of 10 code samples harvested from 1 repository linked to this paper; 3 have no recorded run. Of those that ran: 1 ran · honoured contract; 3 ran · our draft was wrong; 3 ran with no contract checked.

By repository: community (archive-listed): 10 samples from 1 repository, 7 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

google-research/google-research officialmentioned in papertf report
lucidrains/charformer-pytorch mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

10 samples harvested; 7 ran; 1 honoured the contract we drafted; 3 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
3ran · our draft was wrong
3ran
3unverified

Licence: 0 of the 10 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from lucidrains/charformer-pytorch. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

DepthwiseConv1d lucidrains/charformer-pytorch/charformer_pytorch/charformer_pytorch.py community (archive-listed) ran fingerprinted MIT (permissive) · c943760822a257f4 · report
GBST lucidrains/charformer-pytorch/charformer_pytorch/charformer_pytorch.py community (archive-listed) ran MIT (permissive) · 6b018c0bea889c94 · report
Pad lucidrains/charformer-pytorch/charformer_pytorch/charformer_pytorch.py community (archive-listed) ran fingerprinted MIT (permissive) · 72d15a97b98b8f2d · report
masked_mean lucidrains/charformer-pytorch/charformer_pytorch/charformer_pytorch.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 830a1e254dcbecbe · report
masked_mean lucidrains/charformer-pytorch/charformer_pytorch/charformer_pytorch.py community (archive-listed) ran · our draft was wrong MIT (permissive) · a32cff24bac6b0fd · report
next_divisible_length lucidrains/charformer-pytorch/charformer_pytorch/charformer_pytorch.py community (archive-listed) ran · honoured contract fingerprinted MIT (permissive) · a78cb0f6103c1464 · report
pad_to_multiple lucidrains/charformer-pytorch/charformer_pytorch/charformer_pytorch.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 5a84e35f3a42e1eb · report
exists lucidrains/charformer-pytorch/charformer_pytorch/charformer_pytorch.py community (archive-listed) unverified MIT (permissive) · 9632f809d8608df4 · report
lcm lucidrains/charformer-pytorch/charformer_pytorch/charformer_pytorch.py community (archive-listed) unverified MIT (permissive) · 9f9701376e781647 · report
next_divisible_length lucidrains/charformer-pytorch/charformer_pytorch/charformer_pytorch.py community (archive-listed) unverified MIT (permissive) · f52d38502f83c1fb · report

Tasks

Inductive BiasLinguistic AcceptabilityNatural Language InferenceParaphrase IdentificationSemantic Textual SimilaritySentiment Analysis

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Linguistic Acceptability CoLA Charformer-Tall Accuracy 51.8% #36 of 43 Archive leaderboard report
Natural Language Inference MultiNLI Charformer-Tall Matched 83.7 #35 of 67 Archive leaderboard report
Natural Language Inference MultiNLI Charformer-Tall Mismatched 84.4 #35 of 67 Archive leaderboard report
Natural Language Inference QNLI Charformer-Tall Accuracy 91.0% #31 of 43 Archive leaderboard report
Paraphrase Identification Quora Question Pairs Charformer-Tall Accuracy 91.4 #3 of 31 Archive leaderboard report
Paraphrase Identification Quora Question Pairs Charformer-Tall F1 88.5 #3 of 31 Archive leaderboard report
Semantic Textual Similarity MRPC Charformer-Tall Accuracy 87.5% #25 of 45 Archive leaderboard report
Semantic Textual Similarity MRPC Charformer-Tall F1 91.4 #25 of 45 Archive leaderboard report
Semantic Textual Similarity STS Benchmark Charformer-Tall Pearson Correlation 0.873 #24 of 66 Archive leaderboard report
Sentiment Analysis SST-2 Binary classification Charformer-Base Accuracy 91.6 #51 of 87 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Introduced by this paper: Charformer, Gradient-Based Subword Tokenization

Absolute Position EncodingsAdamAttentionBPECharformerDense ConnectionsDropoutGBSTGradient-Based Subword TokenizationLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections