SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.16797 · 2024

Lottery Ticket Adaptation: Mitigating Destructive Interference in LLMs

arXiv · PDF · Open in the Atlas

Code that ran

8 of 9 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; 2 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/2406.16797.json · badge: /api/ran/2406.16797.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
kiddyboots216/lottery-ticket-adaptation canonical (classifier label)
classifier basis: census
8 ran · 1 no recorded run
FunctionStatusWhere it lives
compute_accuracy Ran
ran, honoured the contract we drafted
kiddyboots216/lottery-ticket-adaptation/rlaif/eval_model_all.py
code served (permissive licence) · get_code("6619147dea2d2ff6")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np

# Test case for 'gsm8k' dataset
dataset_gsm8k = 'gsm8k'
pred_gsm8k = ['42', '100', '5']
gold_gsm8k = ['42', '100', '5']

# Test case for 'arc' dataset
dataset_arc = 'arc'
pred_arc = [['A'], ['B'], ['C']]
gold_arc = [['A'], ['B'], ['C']]

# Test case for 'sql' dataset
dataset_sql = 'sql'
pred_sql = ['SELECT * FROM table', 'SELECT id FROM users', 'SELECT count(*) FROM data']
gold_sql = ['SELECT * FROM table', 'SELECT id FROM users', 'SELECT count(*) FROM data']

# Test case for 'samsum' dataset
dataset_samsum = 'samsum'
pred_samsum = ['The meeting discussed project timelines', 'Budget was reviewed', 'Next steps planned']
gold_samsum = ['The meeting discussed project timelines', 'Budget was reviewed', 'Next steps planned']

# Test case for 'hexphi' dataset (safety/jailbreak detection)
dataset_hexphi = 'hexphi'
pred_hexphi = ['I am sorry I cannot help with that', 'This is a normal response', 'I apologize for any confusion']
gold_hexphi = ['dummy1', 'dummy2', 'dummy3']

# Test case for commonsense task (e.g., 'boolq')
dataset_commonsense = 'boolq'
pred_commonsense = ['yes', 'no', 'yes']
gold_commonsense = ['yes', 'no', 'yes']

ARGS = {
    'dataset': dataset_gsm8k,
    'pred': pred_gsm8k,
    'gold': gold_gsm8k,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, rouge_score — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
dpo_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
kiddyboots216/lottery-ticket-adaptation/rlaif/single_gpu_trainers.py
code served (permissive licence) · get_code("16a2450aff4a3577")
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, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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.functional as F

torch.manual_seed(0)

# Create tiny batch tensors with shape (batch_size,)
batch_size = 2

policy_chosen_logps = torch.randn(batch_size, dtype=torch.float32)
policy_rejected_logps = torch.randn(batch_size, dtype=torch.float32)
reference_chosen_logps = torch.randn(batch_size, dtype=torch.float32)
reference_rejected_logps = torch.randn(batch_size, dtype=torch.float32)

ARGS = {
    "policy_chosen_logps": policy_chosen_logps,
    "policy_rejected_logps": policy_rejected_logps,
    "reference_chosen_logps": reference_chosen_logps,
    "reference_rejected_logps": reference_rejected_logps,
    "beta": 0.1,
    "reference_free": False,
    "importance_correction": False,
    "ipo": False,
    "robust_eps": 0.0,
}
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, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
extract_answer Ran
ran, honoured the contract we drafted
kiddyboots216/lottery-ticket-adaptation/rlaif/eval_model_all.py
code served (permissive licence) · get_code("bd0cc71c62b4a212")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 re

ANSWER_PROMPT = 'The final answer is: '

commonsense_tasks = ['boolq', 'piqa', 'social_i_qa', 'ARC-Challenge', 'ARC-Easy', 'openbookqa', 'hellaswag', 'winogrande']

def extract_answer_commonsense(dataset, sentence: str) -> float:
    sentence = sentence.replace(',', '')
    sentence = sentence.split('### Response:')[-1]
    if dataset == 'boolq':
        sentence_ = sentence.strip()
        pred_answers = re.findall('true|false', sentence_)
        if not pred_answers:
            return ''
        return pred_answers[0]
    elif dataset == 'piqa':
        sentence_ = sentence.strip()
        pred_answers = re.findall('solution1|solution2', sentence_)
        if not pred_answers:
            return ''
        return pred_answers[0]
    elif dataset in ['social_i_qa', 'ARC-Challenge', 'ARC-Easy', 'openbookqa']:
        sentence_ = sentence.strip()
        pred_answers = re.findall('answer1|answer2|answer3|answer4|answer5', sentence_)
        if not pred_answers:
            return ''
        return pred_answers[0]
    elif dataset == 'hellaswag':
        sentence_ = sentence.strip()
        pred_answers = re.findall('ending1|ending2|ending3|ending4', sentence_)
        if not pred_answers:
            return ''
        return pred_answers[0]
    elif dataset == 'winogrande':
        sentence_ = sentence.strip()
        pred_answers = re.findall('option1|option2', sentence_)
        if not pred_answers:
            return ''
        return pred_answers[0]

def extract_answer(dataset, sentence: str) -> str:

    def extract_answer_purebad(sentence: str) -> str:
        return sentence

    def extract_answer_general(sentence: str) -> str:
        sentence = sentence.replace(',', '')
        segment = sentence.split(ANSWER_PROMPT)
        if len(segment) > 1:
            return segment[1].strip()
        return sentence

    def extract_answer_gsm8k(sentence: str) -> float:
        sentence = sentence.replace(',', '')
        pred = [s for s in re.findall('-?\\d+\\.?\\d*', sentence)]
        if not pred:
            return float('inf')
        segment = sentence.split(ANSWER_PROMPT)
        if len(segment) > 1:
            pred_answer = segment[1]
            pred_answer = [s for s in re.findall('-?\\d+\\.?\\d*', pred_answer)]
            if len(pred_answer) > 0:
                pred_answer = pred_answer[0]
            else:
                pred_answer = str(pred[-1])
        else:
            pred_answer = str(pred[-1])
        if isinstance(pred_answer, str):
            try:
                pred_answer = str(pred_answer)
            except ValueError as e:
                pred_answer = str('inf')
        return float(pred_answer)
    if dataset == 'gsm8k':
        return extract_answer_gsm8k(sentence)
    elif dataset == 'hexphi':
        return extract_answer_purebad(sentence)
    elif dataset in commonsense_tasks:
        return extract_answer_commonsense(dataset, sentence)
    else:
        return extract_answer_general(sentence)


ARGS = {
    'dataset': 'gsm8k',
    'sentence': 'The final answer is: 42'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
extract_answer_commonsense Ran
ran; our contract draft was wrong, not the code
kiddyboots216/lottery-ticket-adaptation/rlaif/eval_model_all.py
code served (permissive licence) · get_code("e5839cde967af922")
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 str. 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 re

def extract_answer_commonsense(dataset, sentence: str) -> float:
    sentence = sentence.replace(',', '')
    sentence = sentence.split('### Response:')[-1]
    if dataset == 'boolq':
        sentence_ = sentence.strip()
        pred_answers = re.findall('true|false', sentence_)
        if not pred_answers:
            return ''
        return pred_answers[0]
    elif dataset == 'piqa':
        sentence_ = sentence.strip()
        pred_answers = re.findall('solution1|solution2', sentence_)
        if not pred_answers:
            return ''
        return pred_answers[0]
    elif dataset in ['social_i_qa', 'ARC-Challenge', 'ARC-Easy', 'openbookqa']:
        sentence_ = sentence.strip()
        pred_answers = re.findall('answer1|answer2|answer3|answer4|answer5', sentence_)
        if not pred_answers:
            return ''
        return pred_answers[0]
    elif dataset == 'hellaswag':
        sentence_ = sentence.strip()
        pred_answers = re.findall('ending1|ending2|ending3|ending4', sentence_)
        if not pred_answers:
            return ''
        return pred_answers[0]
    elif dataset == 'winogrande':
        sentence_ = sentence.strip()
        pred_answers = re.findall('option1|option2', sentence_)
        if not pred_answers:
            return ''
        return pred_answers[0]

ARGS = {
    'dataset': 'boolq',
    'sentence': 'This is a question.### Response: The answer is true because it makes sense.'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
extract_anthropic_prompt Ran
ran; our contract draft was wrong, not the code
kiddyboots216/lottery-ticket-adaptation/rlaif/preference_datasets.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from junkangwu/beta-DPO, is pointer only (licence: NONE) · get_code("12f6803880f9b17e")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from junkangwu/beta-DPO, 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.

find_layers Ran
ran; our contract draft was wrong, not the code
kiddyboots216/lottery-ticket-adaptation/rlaif/save_mask.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from zyxxmu/dsnot, is pointer only (licence: NONE) · get_code("2ed16fcdc14ad951")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from zyxxmu/dsnot, 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.

get_global_sparsity_masks Ran
ran; our contract draft was wrong, not the code
kiddyboots216/lottery-ticket-adaptation/rlaif/save_mask.py
code served (permissive licence) · get_code("f197c6d6b08d51d6")
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 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
import os
import tempfile

torch.manual_seed(0)

# Create a simple model with weight parameters
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.layer1_weight = nn.Parameter(torch.randn(4, 3))
        self.layer2_weight = nn.Parameter(torch.randn(3, 2))
        self.layer3_bias = nn.Parameter(torch.randn(2))
        
    def forward(self, x):
        return x

model = SimpleModel()

# Define a pruning function that returns True for layers we want to prune
def pruning_fn(name):
    return 'layer' in name and 'weight' in name

# Create a temporary directory for saving masks
temp_dir = tempfile.mkdtemp()

ARGS = {
    'model': model,
    'sparsity_ratios': [0.3, 0.5, 0.7],
    'save_path': temp_dir,
    'pruning_fn': pruning_fn,
    'only_update_prune': False,
    'bottom_k': False
}
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 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
get_random_sparsity_masks Ran
ran; our contract draft was wrong, not the code
kiddyboots216/lottery-ticket-adaptation/rlaif/save_mask.py
code served (permissive licence) · get_code("5c52580792c440fc")
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 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
import os
import tempfile

torch.manual_seed(0)

# Create a simple model with named parameters
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.layer1_weight = nn.Parameter(torch.randn(4, 3))
        self.layer2_weight = nn.Parameter(torch.randn(5, 4))
        self.layer3_bias = nn.Parameter(torch.randn(5))
        self.conv_weight = nn.Parameter(torch.randn(8, 3, 3, 3))
    
    def forward(self, x):
        return x

model = SimpleModel()

# Create a pruning function that decides which parameters to prune
def pruning_fn(name):
    # Only prune parameters with 'weight' in name, excluding certain layers if needed
    return 'weight' in name

# Create a temporary directory for saving masks
save_path = tempfile.mkdtemp()

# Define sparsity ratios to test
sparsity_ratios = [0.5, 0.7]

# Construct ARGS dict with all required parameters
ARGS = {
    'model': model,
    'sparsity_ratios': sparsity_ratios,
    'save_path': save_path,
    'pruning_fn': pruning_fn,
    'only_update_prune': False
}
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 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
dump_files Not yet run
unverified (harvested, no recorded run)
kiddyboots216/lottery-ticket-adaptation/rlaif/generate_samples.py
code served (permissive licence) · get_code("e34197d16076c994")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 1 the same month, 2 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
find_layers 21 other papers
7 dated earlier, 1 the same month, 12 later, 1 same year, order not determinable · 5 only as an assembly brick
2306.11695 (2023-06)
A Simple and Effective Pruning Approach for Large Language Models
2310.05175 (2023-10)
Outlier Weighed Layerwise Sparsity (OWL ): A Missing Secret Sauce for Pruning LLMs to High Sparsity
2310.08915 (2023-10)
Dynamic Sparse No Training: Training-Free Fine-tuning for Sparse LLMs
and 18 more not named here
extract_anthropic_prompt 15 other papers
10 dated earlier, 5 later
2309.16240 (2023-09)
Beyond Reverse KL: Generalizing Direct Preference Optimization with Diverse Divergence Constraints
2310.08164 (2023-10)
Interpreting Learned Feedback Patterns in Large Language Models
2311.08380 (2023-11)
Direct Preference Optimization for Neural Machine Translation with Minimum Bayes Risk Decoding
and 12 more not named here
dpo_loss 1 other paper
1 dated earlier
2402.12366 (2024-02)
A Critical Evaluation of AI Feedback for Aligning Large Language Models

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

Existing methods for adapting large language models (LLMs) to new tasks are not suited to multi-task adaptation because they modify all the model weights -- causing destructive interference between tasks. The resulting effects, such as catastrophic forgetting of earlier tasks, make it challenging to obtain good performance on multiple tasks at the same time. To mitigate this, we propose Lottery Ticket Adaptation (LoTA), a sparse adaptation method that identifies and optimizes only a sparse subnetwork of the model. We evaluate LoTA on a wide range of challenging tasks such as instruction following, reasoning, math, and summarization. LoTA obtains better performance than full fine-tuning and low-rank adaptation (LoRA), and maintains good performance even after training on other tasks -- thus, avoiding catastrophic forgetting. By extracting and fine-tuning over lottery tickets (or sparse task vectors), LoTA also enables model merging over highly dissimilar tasks. Our code is made publicly available at https://github.com/kiddyboots216/lottery-ticket-adaptation.

For agents

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

get_harvested_code_for_paper("2406.16797")
get_code_for_paper("2406.16797")
have("2406.16797")

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

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

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

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

Connect an agent — have() is free.