SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2502.11190 · ACL · 2025

ReLearn: Unlearning via Learning for Large Language Models

Bryan Hooi, Ningyu Zhang, Shumin Deng, Huajun Chen, Mengru Wang, Haoming Xu, Nay Oo, Sendong Zhao, Liming Yang, Ningyuan Zhao

arXiv · PDF · Open in the Atlas

Code that ran

10 of 11 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, 1 violated it and 4 have no contract verdict; 5 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2502.11190.json · badge: /api/ran/2502.11190.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
zjunlp/unlearn canonical (classifier label)
classifier basis not recorded on the link
10 ran · 1 no recorded run
FunctionStatusWhere it lives
chinese_ratio Ran
ran on a synthesized input
zjunlp/unlearn/dataAugument/gather_proc_data.py
code served (permissive licence) · get_code("550cd04dd979ca21")
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

def chinese_ratio(text):
    if not text:
        return 0
    chinese_count = len(re.findall('[\\u4e00-\\u9fff]', text))
    total_chars = len(text.replace(' ', ''))
    return chinese_count / max(1, total_chars)

# Test with various text inputs
ARGS = {
    "text": "Hello世界你好World"
}
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
compute_cosine_similarity Ran
ran; our contract draft was wrong, not the code
zjunlp/unlearn/baselines/src/memflex_trainer.py
pointer only (licence: MIT); the stored copy get_code serves, from AIFrontierLab/KnowledgeSmith, is pointer only (licence: NONE) · get_code("835be88a656b57c2")
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 AIFrontierLab/KnowledgeSmith, 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.

contains_chinese Ran
ran, violated the contract we drafted
zjunlp/unlearn/dataAugument/gather_proc_data.py
code served (permissive licence) · get_code("33e3c69c78826a6b")
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 bool, 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

def contains_chinese(text):
    return bool(re.search('[\\u4e00-\\u9fff]', text))

ARGS = {
    "text": "Hello world with Chinese characters: 你好世界"
}
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 bool, 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
find_all_linear_names Ran
ran; our contract draft was wrong, not the code
zjunlp/unlearn/semeval25/unlearn-merging.py
code served (permissive licence) · get_code("649fc48067a48529")
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 list, ndim 1, 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 as nn

torch.manual_seed(0)

# Build a minimal model with Linear layers
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.layer1 = nn.Linear(4, 3)
        self.layer2 = nn.Sequential(
            nn.Linear(3, 2),
            nn.ReLU()
        )
        self.lm_head = nn.Linear(2, 5)
        self.other_linear = nn.Linear(5, 4)
    
    def forward(self, x):
        x = self.layer1(x)
        x = self.layer2(x)
        x = self.lm_head(x)
        x = self.other_linear(x)
        return x

model = SimpleModel()

ARGS = {
    "model": model
}
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 list, ndim 1, dtype family float — a list 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
fixed_cross_entropy Ran
ran on a synthesized input
zjunlp/unlearn/semeval25/unlearn-merging.py
code served (permissive licence) · get_code("1cdd69228f9ca358")
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 Tensor, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create small tensors for the function
# source: logits with shape (batch_size, num_classes)
# target: class indices with shape (batch_size,)
batch_size = 2
num_classes = 4

source = torch.randn(batch_size, num_classes)
target = torch.randint(0, num_classes, (batch_size,))

ARGS = {
    'source': source,
    'target': target,
    'num_items_in_batch': 2,
    'ignore_index': -100,
}
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 Tensor, 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
gather Ran
ran on a synthesized input
zjunlp/unlearn/dataAugument/gather_proc_data.py
code served (permissive licence) · get_code("d382772365dcb74d")
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 list, ndim 1, 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

torch.manual_seed(0)

# Construct sample data matching the structure expected by gather()
data = [
    {
        'original_question': 'What is 2+2?',
        'original_answer': '4',
        'question_variants': [
            'What does 2 plus 2 equal?',
            'Calculate 2+2',
            'Compute the sum of 2 and 2'
        ],
        'answer_variants': [
            'The answer is 4',
            '4',
            'Four'
        ]
    },
    {
        'original_question': 'What is the capital of France?',
        'original_answer': 'Paris',
        'question_variants': [
            'Name the capital of France',
            'Which city is the capital of France?'
        ],
        'answer_variants': [
            'Paris is the capital',
            'Paris'
        ]
    }
]

text_column = 'text'
labels_column = 'label'

ARGS = {
    'data': data,
    'text_column': text_column,
    'labels_column': labels_column
}
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 list, ndim 1, dtype family float — a list 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
get_basename Ran
ran; our contract draft was wrong, not the code
zjunlp/unlearn/baselines/src/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from AIFrontierLab/KnowledgeSmith, is pointer only (licence: NONE) · get_code("51bf57b170168770")
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 AIFrontierLab/KnowledgeSmith, 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_batch_loss Ran
ran; our contract draft was wrong, not the code
zjunlp/unlearn/baselines/src/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from AIFrontierLab/KnowledgeSmith, is pointer only (licence: NONE) · get_code("373cbe86765cc7cc")
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 AIFrontierLab/KnowledgeSmith, 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.

pad_or_trim_tensor Ran
ran on a synthesized input
zjunlp/unlearn/semeval25/unlearn-merging.py
code served (permissive licence) · get_code("046d9c0faf4fe5c5")
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 Tensor, ndim 1, dtype family float, shape (5,) 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 torch

torch.manual_seed(0)

# Create a small tensor with shape (3,) - less than target_length
tensor = torch.tensor([1.0, 2.0, 3.0])

# Target length is 5, so the tensor will be padded
target_length = 5

# Padding value to fill the extra slots
padding_value = 0.0

ARGS = {
    "tensor": tensor,
    "target_length": target_length,
    "padding_value": padding_value,
}
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 Tensor, ndim 1, dtype family float, shape (5,) — shape (5,) 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
read_text Ran
ran; our contract draft was wrong, not the code
zjunlp/unlearn/baselines/src/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from AIFrontierLab/KnowledgeSmith, is pointer only (licence: NONE) · get_code("ed81414ea2349a5f")
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 AIFrontierLab/KnowledgeSmith, 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.

choose_dataset Not yet run
unverified (harvested, no recorded run)
zjunlp/unlearn/baselines/src/dataset.py
pointer only (licence: MIT); the stored copy get_code serves, from AIFrontierLab/KnowledgeSmith, is pointer only (licence: NONE) · get_code("bd027a2307927c44")
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 AIFrontierLab/KnowledgeSmith, 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. No invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 7 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 7 later) and 4 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_all_linear_names 22 other papers
19 dated earlier, 2 later, 1 same year, order not determinable
2308.09936 (2023-08)
BLIVA: A Simple Multimodal LLM for Better Handling of Text-Rich Visual Questions
2310.13023 (2023-10)
GraphGPT: Graph Instruction Tuning for Large Language Models
2311.13194 (2023-11)
Towards Improving Document Understanding: An Exploration on Text-Grounding via MLLMs
and 19 more not named here
compute_cosine_similarity 2 other papers
1 dated earlier, 1 later
2407.01920 (2024-07)
To Forget or Not? Towards Practical Knowledge Unlearning for Large Language Models
2510.02392 (2025-10)
KnowledgeSmith: Uncovering Knowledge Updating in LLMs with Model Editing and Unlearning
choose_dataset 1 other paper
1 later
2510.02392 (2025-10)
KnowledgeSmith: Uncovering Knowledge Updating in LLMs with Model Editing and Unlearning
contains_chinese 1 other paper
1 later
2601.00423 (2026-01)
E-GRPO: High Entropy Steps Drive Effective Reinforcement Learning for Flow Models
get_basename 1 other paper
1 later
2510.02392 (2025-10)
KnowledgeSmith: Uncovering Knowledge Updating in LLMs with Model Editing and Unlearning
get_batch_loss 1 other paper
1 later
2510.02392 (2025-10)
KnowledgeSmith: Uncovering Knowledge Updating in LLMs with Model Editing and Unlearning
read_text 1 other paper
1 later
2510.02392 (2025-10)
KnowledgeSmith: Uncovering Knowledge Updating in LLMs with Model Editing and Unlearning

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-23.

Repositories linked to this paper

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

Abstract

Current unlearning methods for large language models usually rely on reverse optimization to reduce target token probabilities. However, this paradigm disrupts the subsequent tokens prediction, degrading model performance and linguistic coherence. Moreover, existing evaluation metrics overemphasize contextual forgetting while inadequately assessing response fluency and relevance. To address these challenges, we propose ReLearn, a data augmentation and fine-tuning pipeline for effective unlearning, along with a comprehensive evaluation framework. This framework introduces Knowledge Forgetting Ratio (KFR) and Knowledge Retention Ratio (KRR) to measure knowledgelevel preservation, and Linguistic Score (LS) to evaluate generation quality. Our experiments show that ReLearn successfully achieves targeted forgetting while preserving high-quality output. Through mechanistic analysis, we further demonstrate how reverse optimization disrupts coherent text generation, while ReLearn preserves this essential capability 1 . "The illiterate of the future are not those who can't read or write but those who cannot learn, unlearn, and relearn." -Alvin Toffler

For agents

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

get_harvested_code_for_paper("2502.11190")
get_code_for_paper("2502.11190")
have("2502.11190")

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

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

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

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

Connect an agent — have() is free.