SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2401.12200 · ICML · 2024

APT: Adaptive Pruning and Tuning Pretrained Language Models for Efficient Training and Inference

Hannaneh Hajishirzi, Qingqing Cao, Bowen Zhao

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 1 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2401.12200.json · badge: /api/ran/2401.12200.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
ROIM1998/APT canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
roim1998/apt canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
gather_core_info Ran
ran; our contract draft was wrong, not the code
ROIM1998/APT/collect_reports.py
code served (permissive licence) · get_code("374439cc0c90c6fe")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned DataFrame. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import json
import tempfile
import shutil
import pandas as pd

# Create a temporary directory structure with test data
temp_dir = tempfile.mkdtemp()

# Create nested directories and run_report.json files
def create_test_structure(base_dir):
    # Create bert-base-uncased/squad structure
    bert_squad_dir = os.path.join(base_dir, 'results', 'bert-base-uncased', 'squad')
    os.makedirs(bert_squad_dir, exist_ok=True)
    bert_squad_report = {
        'eval_accuracy': 0.92,
        'peak_mem': 2048,
        'train_runtime_per_epoch': 120.5,
        'time_to_best': 450.0,
        'bz32_t_mean': 0.5,
        'bz32_em_mean': 0.85,
        'bz128_t_mean': 0.6,
        'bz128_em_mean': 0.88,
        'model_flops': 1e9,
        'num_parameters': 110e6,
        'args': {'learning_rate': 0.00005, 'batch_size': 32}
    }
    with open(os.path.join(bert_squad_dir, 'run_report.json'), 'w') as f:
        json.dump(bert_squad_report, f)
    
    # Create roberta-base/squad structure (should be filtered out when model_name='bert')
    roberta_squad_dir = os.path.join(base_dir, 'results', 'roberta-base', 'squad')
    os.makedirs(roberta_squad_dir, exist_ok=True)
    roberta_squad_report = {
        'eval_accuracy': 0.94,
        'peak_mem': 2560,
        'train_runtime_per_epoch': 130.0,
        'time_to_best': 480.0,
        'bz32_t_mean': 0.52,
        'bz32_em_mean': 0.87,
        'bz128_t_mean': 0.62,
        'bz128_em_mean': 0.90,
        'model_flops': 1.1e9,
        'num_parameters': 125e6,
        'args': {'learning_rate': 0.00005, 'batch_size': 32}
    }
    with open(os.path.join(roberta_squad_dir, 'run_report.json'), 'w') as f:
        json.dump(roberta_squad_report, f)
    
    # Create bert-base-uncased/glue structure
    bert_glue_dir = os.path.join(base_dir, 'results', 'bert-base-uncased', 'glue')
    os.makedirs(bert_glue_dir, exist_ok=True)
    bert_glue_report = {
        'eval_accuracy': 0.88,
        'peak_mem': 1024,
        'train_runtime_per_epoch': 60.0,
        'time_to_best': 200.0,
        'bz32_t_mean': 0.45,
        'bz32_em_mean': 0.80,
        'bz128_t_mean': 0.55,
        'bz128_em_mean': 0.82,
        'model_flops': 1e9,
        'num_parameters': 110e6,
        'args': {'learning_rate': 0.00001, 'batch_size': 16}
    }
    with open(os.path.join(bert_glue_dir, 'run_report.json'), 'w') as f:
        json.dump(bert_glue_report, f)

create_test_structure(temp_dir)

ARGS = {
    'root': temp_dir,
    'model_name': 'bert',
    'task_name': 'squad'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
gather_raw_report Ran
ran; our contract draft was wrong, not the code
ROIM1998/APT/collect_reports.py
code served (permissive licence) · get_code("d4b2597fde6b30e2")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned DataFrame. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import json
import pandas as pd
import tempfile
import shutil

# Create a temporary directory structure with mock run_report.json files
temp_dir = tempfile.mkdtemp()

# Create nested directory structure with run_report.json files
os.makedirs(os.path.join(temp_dir, 'exp1', 'run1'), exist_ok=True)
os.makedirs(os.path.join(temp_dir, 'exp1', 'run2'), exist_ok=True)
os.makedirs(os.path.join(temp_dir, 'exp2'), exist_ok=True)

# Create sample run_report.json files
report1 = {
    'loss': 0.5,
    'accuracy': 0.95,
    'args': {
        'learning_rate': 0.001,
        'batch_size': 32,
        'epochs': 10
    }
}

report2 = {
    'loss': 0.3,
    'accuracy': 0.97,
    'args': {
        'learning_rate': 0.0001,
        'batch_size': 64,
        'epochs': 20
    }
}

report3 = {
    'loss': 0.4,
    'accuracy': 0.96,
    'args': {
        'learning_rate': 0.0005,
        'batch_size': 16,
        'epochs': 15
    }
}

with open(os.path.join(temp_dir, 'exp1', 'run1', 'run_report.json'), 'w') as f:
    json.dump(report1, f)

with open(os.path.join(temp_dir, 'exp1', 'run2', 'run_report.json'), 'w') as f:
    json.dump(report2, f)

with open(os.path.join(temp_dir, 'exp2', 'run_report.json'), 'w') as f:
    json.dump(report3, f)

ARGS = {
    'root_dir': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
gather_report Ran
ran; our contract draft was wrong, not the code
ROIM1998/APT/collect_reports.py
code served (permissive licence) · get_code("76fff866ac44da96")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned DataFrame. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import json
import tempfile
import shutil

# Create a temporary directory structure that mimics the expected output format
temp_root = tempfile.mkdtemp()

# Create directory structures for different tuning strategies
# Structure 1: minus (LoRA minus pruning)
minus_dir = os.path.join(
    temp_root,
    'bert-base-uncased_lora_minus_squad_magnitude_global_free_inout_nodistill/mac0.5/epoch3/bz32/numprune5/paramconfig1/lora_r8/lora_alpha16'
)
os.makedirs(minus_dir, exist_ok=True)

minus_report = {
    'f1': 0.85,
    'eval_loss': 0.25,
    'args': {'hidden_size': 768}
}
with open(os.path.join(minus_dir, 'run_report.json'), 'w') as f:
    json.dump(minus_report, f)

# Structure 2: lora (standard LoRA tuning)
lora_dir = os.path.join(
    temp_root,
    'bert-base-uncased_lora_mnli/epoch2/bz16/lora_r4/lora_alpha8'
)
os.makedirs(lora_dir, exist_ok=True)

lora_report = {
    'eval_accuracy': 0.92,
    'eval_loss': 0.15,
    'args': {'hidden_size': 768}
}
with open(os.path.join(lora_dir, 'run_report.json'), 'w') as f:
    json.dump(lora_report, f)

# Structure 3: full fine-tuning
ft_dir = os.path.join(
    temp_root,
    'bert-base-uncased_sst2_full/epoch4/bz8'
)
os.makedirs(ft_dir, exist_ok=True)

ft_report = {
    'eval_accuracy': 0.94,
    'eval_loss': 0.10,
    'args': {'hidden_size': 768}
}
with open(os.path.join(ft_dir, 'run_report.json'), 'w') as f:
    json.dump(ft_report, f)

# Structure 4: another task for variety
squad_ft_dir = os.path.join(
    temp_root,
    'roberta-base_squad/epoch3/bz16'
)
os.makedirs(squad_ft_dir, exist_ok=True)

squad_report = {
    'f1': 0.88,
    'eval_loss': 0.20,
    'args': {'hidden_size': 768}
}
with open(os.path.join(squad_ft_dir, 'run_report.json'), 'w') as f:
    json.dump(squad_report, f)

ARGS = {
    'root_dir': temp_root
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
lora_state_dict Ran
ran; our contract draft was wrong, not the code
ROIM1998/APT/loralib/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from shihaohou/FedPuReL, is pointer only (licence: NONE) · get_code("660073ae6862ac6e")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from shihaohou/FedPuReL, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

named_masks Ran
ran; our contract draft was wrong, not the code
roim1998/apt/models/modeling_bert.py
code served (permissive licence) · get_code("d52640851c04a485")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal config class with required attributes
class MinimalConfig:
    def __init__(self):
        self.hidden_size = 8
        self.num_attention_heads = 2
        self.num_hidden_layers = 2

# Create a minimal model with required attributes
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.config = MinimalConfig()
        # head_mask: shape (num_hidden_layers, num_attention_heads)
        self.head_mask = torch.ones(self.config.num_hidden_layers, self.config.num_attention_heads)
        # intermediate_mask: shape (num_hidden_layers, intermediate_size)
        # Using a different size for intermediate (16) to be distinct
        self.intermediate_mask = torch.ones(self.config.num_hidden_layers, 16)

model = MinimalModel()

# Create head_mask and intermediate_mask arguments
head_mask = torch.ones(2, 2)  # (num_hidden_layers=2, num_attention_heads=2)
intermediate_mask = torch.ones(2, 16)  # (num_hidden_layers=2, intermediate_size=16)

ARGS = {
    "model": model,
    "head_mask": head_mask,
    "intermediate_mask": intermediate_mask,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
select_wandb Ran
ran; our contract draft was wrong, not the code
ROIM1998/APT/loralib/layers.py
code served (permissive licence) · get_code("1ce92bb71b46dc70")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create small tensors for weight and bias
# weight: shape (out_features, in_features) = (3, 4)
weight = nn.Parameter(torch.randn(3, 4))

# bias: shape (out_features,) = (3,)
bias = nn.Parameter(torch.randn(3))

# Create index tensors for selection
# in_retained_indices: selects from dimension 1 of weight (in_features)
in_retained_indices = torch.tensor([0, 2], dtype=torch.long)

# out_retained_indices: selects from dimension 0 of weight and bias (out_features)
out_retained_indices = torch.tensor([1, 2], dtype=torch.long)

ARGS = {
    "weight": weight,
    "bias": bias,
    "in_retained_indices": in_retained_indices,
    "out_retained_indices": out_retained_indices,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
calculate_pruned_equivalent_weights Not yet run
unverified (harvested, no recorded run)
ROIM1998/APT/loralib/layers.py
code served (permissive licence) · get_code("ab59131d2a4914d3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 6 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
lora_state_dict 13 other papers
4 dated earlier, 8 later, 1 same year, order not determinable
2202.00535 (2022-02)
Novelty Controlled Paraphrase Generation with Retrieval Augmented Conditional Prompt Tuning
2202.07962 (2022-02)
Revisiting Parameter-Efficient Tuning: Are We Really There Yet?
2211.09790 (2022-11)
ConStruct-VL: Data-Free Continual Structured VL Concepts Learning
and 10 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Fine-tuning and inference with large Language Models (LM) are generally known to be expensive. Parameter-efficient fine-tuning over pretrained LMs reduces training memory by updating a small number of LM parameters but does not improve inference efficiency. Structured pruning improves LM inference efficiency by removing consistent parameter blocks, yet often increases training memory and time. To improve both training and inference efficiency, we introduce APT that adaptively prunes and tunes parameters for the LMs. At the early stage of finetuning, APT dynamically adds salient tuning parameters for fast and accurate convergence while discarding unimportant parameters for efficiency. Compared to baselines, our experiments show that APT maintains up to 98% task performance when pruning 60% of the parameters in RoBERTa and T5 models. APT also preserves 86.4% of LLaMA models' performance with 70% parameters remaining. Furthermore, APT speeds up LMs' fine-tuning by up to 8× and reduces large LMs' memory training footprint by up to 70%. Our code and models are publicly available at https://github.com/ROIM1998/APT.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2401.12200")
get_code_for_paper("2401.12200")
have("2401.12200")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2401.12200.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2401.12200.svg)](https://syntology.ai/paper/2401.12200)

Connect an agent — have() is free.