Papers › Learned Token Pruning for Transformers

Learned Token Pruning for Transformers

2 Jul 2021arXiv:2107.00910archive 2025-07-28

Sehoon Kim, Sheng Shen, David Thorsley, Amir Gholami, Woosuk Kwon, Joseph Hassoun, Kurt Keutzer

Deploying transformer models in practice is challenging due to their inference cost, which scales quadratically with input sequence length. To address this, we present a novel Learned Token Pruning (LTP) method which adaptively removes unimportant tokens as an input sequence passes through transformer layers. In particular, LTP prunes tokens with an attention score below a threshold value which is learned for each layer during training. Our threshold-based method allows the length of the pruned sequence to vary adaptively based on the input sequence, and avoids algorithmically expensive operations such as top-k token selection. We extensively test the performance of LTP on GLUE tasks and show that our method outperforms the prior state-of-the-art token pruning methods by up to ~2.5% higher accuracy with the same amount of FLOPs. In particular, LTP achieves up to 2.1x FLOPs reduction with less than 1% accuracy drop, which results in up to 1.9x and 2.0x throughput improvement on Intel Haswell CPUs and NVIDIA V100 GPUs, respectively. Furthermore, we demonstrate that LTP is more robust than prior methods to variations on input sentence lengths. Our code has been developed in PyTorch and has been open-sourced.

PaperPDFCodeCode 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="2107.00910")

Code

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

By repository: official repository: 12 samples from 1 repository, 6 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

kssteven418/ltp officialmentioned in papermentioned on GitHubjaxApache-2.0 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

12 samples harvested; 6 ran; 0 honoured the contract we drafted; 6 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 · our draft was wrong
5ran
6unverified

Licence: 12 of the 12 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 kssteven418/ltp. “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.

check_number_comma kssteven418/ltp/src/transformers/convert_slow_tokenizer.py official repository ran Apache-2.0 recorded; this copy not marked cleared · pointer only · a727df5fd2f5599a · report
ensure_valid_input kssteven418/ltp/src/transformers/convert_graph_to_onnx.py official repository ran Apache-2.0 recorded; this copy not marked cleared · pointer only · d770e1dd1d799a47 · report
gelu_fast kssteven418/ltp/src/transformers/activations.py official repository ran · our draft was wrong fingerprinted Apache-2.0 recorded; this copy not marked cleared · pointer only · a4475703ff58ecf9 · report
gelu_new kssteven418/ltp/src/transformers/activations.py official repository ran fingerprinted Apache-2.0 recorded; this copy not marked cleared · pointer only · 45bb87451230d5e8 · report
generate_identified_filename kssteven418/ltp/src/transformers/convert_graph_to_onnx.py official repository ran Apache-2.0 recorded; this copy not marked cleared · pointer only · 7efe3db5c9e2f94d · report
mish kssteven418/ltp/src/transformers/activations.py official repository ran fingerprinted Apache-2.0 recorded; this copy not marked cleared · pointer only · f889d53c68539013 · report
collect_data kssteven418/ltp/make_pibert_paper_plots.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 75992437e8972200 · report
convert_slow_tokenizer kssteven418/ltp/src/transformers/convert_slow_tokenizer.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 5de43db1a351fd89 · report
create_position_ids_from_input_ids kssteven418/ltp/src/transformers/models/ltp/modeling_ltp.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 83995d570ba89e6d · report
gelu_fast kssteven418/ltp/src/transformers/activations_tf.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · ac1bc5cb23b3f2ec · report
infer_shapes kssteven418/ltp/src/transformers/convert_graph_to_onnx.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 3449d7d975edfb89 · report
mish kssteven418/ltp/src/transformers/activations_tf.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · cc8c8c3ebf0c343f · report

Tasks

Sentence

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Pruning

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