Papers › The Need for Speed: Pruning Transformers with One Recipe

The Need for Speed: Pruning Transformers with One Recipe

26 Mar 2024arXiv:2403.17921archive 2025-07-28

Samir Khaki, Konstantinos N. Plataniotis

We introduce the One-shot Pruning Technique for Interchangeable Networks (OPTIN) framework as a tool to increase the efficiency of pre-trained transformer architectures without requiring re-training. Recent works have explored improving transformer efficiency, however often incur computationally expensive re-training procedures or depend on architecture-specific characteristics, thus impeding practical wide-scale adoption. To address these shortcomings, the OPTIN framework leverages intermediate feature distillation, capturing the long-range dependencies of model parameters (coined trajectory), to produce state-of-the-art results on natural language, image classification, transfer learning, and semantic segmentation tasks without re-training. Given a FLOP constraint, the OPTIN framework will compress the network while maintaining competitive accuracy performance and improved throughput. Particularly, we show a ≤2% accuracy degradation from NLP baselines and a 0.5% improvement from state-of-the-art methods on image classification at competitive FLOPs reductions. We further demonstrate the generalization of tasks and architecture with comparative performance using Mask2Former for semantic segmentation and cnn-style networks. OPTIN presents one of the first one-shot efficient frameworks for compressing transformer architectures that generalizes well across different class domains, in particular: natural language and image-related tasks, without re-training.

PaperPDFCodeCode Syntology ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 23 code samples harvested from 1 repository linked to this paper: 15 ran (of which 0 constructed an object rather than computing a result; 9 with no instrument failure: 8 honoured, 1 violated, 0 with no contract checked; 6 where Syntology's instrument failed) · 8 unverified. Where Syntology's instrument failed: 6 where our contract draft was wrong; failures of Syntology's instrument, not of the code.

By repository: official repository: 23 samples from 1 repository, 15 ran (9 with no instrument failure; 6 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written on 2026-09-22 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed. 2 of the 15 samples that ran have no recorded date.

skhaki18/optin-transformer-pruning officialmentioned in papermentioned on GitHubpytorchSyntology: 23 samples, 15 ran (6 instrument-failed) · 8 unverified 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

23 samples harvested: 15 ran (of which 0 constructed an object rather than computing a result; 9 with no instrument failure: 8 honoured, 1 violated, 0 with no contract checked; 6 where Syntology's instrument failed) · 8 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

8ran · honoured contract
1ran · violated contract
6ran · our draft was wrong
8unverified

Licence: 0 of the 23 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 skhaki18/optin-transformer-pruning. “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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

skhaki18/optin-transformer-pruning official repository 23 samples, 15 ran (6 instrument-failed) · 8 unverified
KLDiv prune/loss_components.py ran · honoured contract MIT (permissive) · 027ae849d003750b · report fixture: signature TeacherOutput:ModelOutput/0/?, StudentOutput:ModelOutput/0/?, temp:int/0/int · returned Tensor · level recorded, date not recorded
KLDiv prune/main_prune.py ran · honoured contract MIT (permissive) · da78ffebac4be236 · report fixture: signature TeacherOutput:ModelOutput/0/?, StudentOutput:ModelOutput/0/?, temp:int/0/int · returned Tensor · level recorded 2026-09-22
calculateComplexity prune/main_prune.py ran · our draft was wrong MIT (permissive) · 3e6b8dd06f26bd2e · report fixture: signature args:DummyArgs/0/?, model:callable/0/?, train_dataset:list/1/tuple, prunedProps:dict/0/?, pruningParams:dict/0/? · returned tuple · level recorded 2026-09-22
compute_base_mac prune/main_prune.py ran · honoured contract MIT (permissive) · b8a3e26f899df98f · report fixture: signature args:MockArgs/0/?, prunedProps:dict/0/?, skipConv:bool/0/bool · returned float · level recorded 2026-09-22
compute_mac prune/main_prune.py ran · violated contract fingerprinted MIT (permissive) · b9d5144329aa001b · report fixture: signature head_mask:list/1/int, neuron_mask:list/1/int, patch_mask:list/1/int, seq_len:int/0/int, hidden_size:int/0/int, attention_head_size:int/0/int · returned float · level recorded 2026-09-22
compute_patch_mac prune/main_prune.py ran · honoured contract MIT (permissive) · 18b585baff750730 · report fixture: signature args:dict/0/?, prunedProps:dict/0/?, mac_details:dict/0/? · returned list · level recorded 2026-09-22
compute_pruned_mac prune/main_prune.py ran · honoured contract MIT (permissive) · 57a2ac87aeb75bf5 · report fixture: signature args:Args/0/?, prunedProps:dict/0/?, pruningParams:dict/0/?, skipConv:bool/0/bool · returned float · level recorded 2026-09-22
get_mac_details prune/main_prune.py ran · our draft was wrong MIT (permissive) · 8addab3b55f6f68e · report fixture: signature args:ArgsStandIn/0/?, prunedProps:dict/0/? · returned dict · level recorded 2026-09-22
globalRankingLanguage prune/main_prune.py ran · our draft was wrong MIT (permissive) · fa816ac012e18bee · report fixture: signature args:Args/0/?, prunedProps:dict/0/?, languageProps:dict/0/? · returned dict · level recorded 2026-09-22
mac_per_head prune/main_prune.py ran · honoured contract fingerprinted MIT (permissive) · 77c8d1bcdfe79662 · report fixture: signature seq_len:int/0/int, hidden_size:int/0/int, attention_head_size:int/0/int · returned int · level recorded 2026-09-22
mac_per_neuron prune/main_prune.py ran · honoured contract fingerprinted MIT (permissive) · 159b80cd46f12b30 · report fixture: signature seq_len:int/0/int, hidden_size:int/0/int · returned int · level recorded 2026-09-22
manifold_Distillation prune/loss_components.py ran · our draft was wrong MIT (permissive) · 82a7f6c6a07d3234 · report fixture: signature args:Args/0/?, teacher:Tensor/3/float, student:Tensor/3/float · returned Tensor · level recorded, date not recorded
manifold_Distillation prune/main_prune.py ran · our draft was wrong MIT (permissive) · 93b2e14d2ed2e49d · report fixture: signature args:Args/0/?, teacher:Tensor/3/float, student:Tensor/3/float · returned Tensor · level recorded 2026-09-22
process_patch_mask prune/main_prune.py ran · our draft was wrong MIT (permissive) · dda1ad56be460a00 · report fixture: signature patch_mask:list/1/Tensor · returned list · level recorded 2026-09-22
query_conv_mac prune/main_prune.py ran · honoured contract MIT (permissive) · 4cabaf97a1cafcd2 · report fixture: signature args:SimpleArgs/0/? · returned int · level recorded 2026-09-22
ModelHooking prune/main_prune.py unverified MIT (permissive) · 72a06dbfb15610ae · report
Prune prune/main_prune.py unverified MIT (permissive) · cb63f4eebf8926c2 · report
cnn_mmd prune/loss_components.py unverified MIT (permissive) · fb4f698a0e53c90a · report
globalRankingVision prune/main_prune.py unverified MIT (permissive) · a7ccc4f26fd33e50 · report
pruneHead prune/main_prune.py unverified MIT (permissive) · 053bf2646cdcfa75 · report
pruneLanguageNeurons prune/main_prune.py unverified MIT (permissive) · c07e8573b3785e73 · report
pruneModel prune/main_prune.py unverified MIT (permissive) · 76238266383a6956 · report
pruneVisionNeurons prune/main_prune.py unverified MIT (permissive) · cd869fbca8ce1494 · report

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it.

1 assembly on this paper: 1 harvested, 0 generated.

harvested Assembly for OPTIN (graph method: OPTIN). 20 bricks; individually on a fixture: 13 ran (of which 0 constructed an object rather than computing a result; 8 with no instrument failure: 7 honoured, 1 violated, 0 with no contract checked; 5 where Syntology's instrument failed) · 7 unverified. The assembly has not been run end-to-end.

  1. pruneModel entry · level 0 · unverified · 76238266383a6956
  2. calculateComplexity helper · level 1 · ran · our draft was wrong · 3e6b8dd06f26bd2e
  3. get_mac_details helper · level 1 · ran · our draft was wrong · 8addab3b55f6f68e
  4. globalRankingLanguage helper · level 1 · ran · our draft was wrong · fa816ac012e18bee
  5. globalRankingVision helper · level 0 · unverified · a7ccc4f26fd33e50
  6. pruneHead model · level 0 · unverified · 053bf2646cdcfa75
  7. pruneLanguageNeurons model · level 0 · unverified · c07e8573b3785e73
  8. pruneVisionNeurons model · level 0 · unverified · cd869fbca8ce1494
  9. compute_base_mac helper · level 1 · ran · honoured contract · b8a3e26f899df98f
  10. compute_pruned_mac helper · level 1 · ran · honoured contract · 57a2ac87aeb75bf5
  11. compute_patch_mac helper · level 1 · ran · honoured contract · 18b585baff750730
  12. mac_per_head helper · level 1 · ran · honoured contract · 77c8d1bcdfe79662
  13. mac_per_neuron helper · level 1 · ran · honoured contract · 159b80cd46f12b30
  14. process_patch_mask helper · level 1 · ran · our draft was wrong · dda1ad56be460a00
  15. ModelHooking helper · level 0 · unverified · 72a06dbfb15610ae
  16. Prune model · level 0 · unverified · cb63f4eebf8926c2
  17. compute_mac helper · level 1 · ran · violated contract · b9d5144329aa001b
  18. query_conv_mac helper · level 1 · ran · honoured contract · 4cabaf97a1cafcd2
  19. KLDiv helper · level 1 · ran · honoured contract · da78ffebac4be236
  20. manifold_Distillation helper · level 1 · ran · our draft was wrong · 93b2e14d2ed2e49d

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2403.17921") returns these assemblies with each brick's role and wiring (how to connect).

Tasks

Image ClassificationSemantic SegmentationTransfer Learningimage-classification

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

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