SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.12038 · 2024

Soft Prompting for Unlearning in Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

3 of 8 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 2 failures of our instrument; 5 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/2406.12038.json · badge: /api/ran/2406.12038.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
karuna-bhaila/llm_unlearning canonical (classifier label)
classifier basis: census
3 ran · 5 no recorded run
FunctionStatusWhere it lives
compute_metrics Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
karuna-bhaila/llm_unlearning/inference_vanilla.py
pointer only (licence: NONE) · get_code("49bb87ecc41d23fe")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, karuna-bhaila/llm_unlearning 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_model Ran
ran; our contract draft was wrong, not the code
karuna-bhaila/llm_unlearning/inference_vanilla.py
pointer only (licence: NONE) · get_code("39181472211f0ed1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, karuna-bhaila/llm_unlearning 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.

preprocess_logits_for_metrics Ran
ran, honoured the contract we drafted
karuna-bhaila/llm_unlearning/utils.py
pointer only (licence: NONE) · get_code("d2895bdf14e8f94f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, karuna-bhaila/llm_unlearning 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_data_path Not yet run
unverified (harvested, no recorded run)
karuna-bhaila/llm_unlearning/utils.py
pointer only (licence: NONE) · get_code("7e1ff286a54b3ec5")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, karuna-bhaila/llm_unlearning 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.

get_logits_from_base_model Not yet run
unverified (harvested, no recorded run)
karuna-bhaila/llm_unlearning/utils.py
pointer only (licence: NONE) · get_code("cfc673fbc4f72125")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, karuna-bhaila/llm_unlearning 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.

get_lora_model Not yet run
unverified (harvested, no recorded run)
karuna-bhaila/llm_unlearning/inference_base_model.py
pointer only (licence: NONE) · get_code("bb2d30c2f169cb27")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, karuna-bhaila/llm_unlearning 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.

get_lora_model Not yet run
unverified (harvested, no recorded run)
karuna-bhaila/llm_unlearning/qlora.py
pointer only (licence: NONE) · get_code("7cf32abedf8023cd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, karuna-bhaila/llm_unlearning 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.

get_unlearn_dataset Not yet run
unverified (harvested, no recorded run)
karuna-bhaila/llm_unlearning/inference_vanilla.py
pointer only (licence: NONE) · get_code("c9037aad77685aff")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, karuna-bhaila/llm_unlearning 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 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 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 7 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
preprocess_logits_for_metrics 7 other papers
6 dated earlier, 1 later
2010.11934 (2020-10)
mT5: A massively multilingual pre-trained text-to-text transformer
2304.08177 (2023-04)
Efficient and Effective Text Encoding for Chinese LLaMA and Alpaca
2310.09089 (2023-10)
Qilin-Med: Multi-stage Knowledge Injection Advanced Medical Large Language Model
and 4 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-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

The widespread popularity of Large Language Models (LLMs), partly due to their unique ability to perform in-context learning, has also brought to light the importance of ethical and safety considerations when deploying these pre-trained models. In this work, we focus on investigating machine unlearning for LLMs motivated by data protection regulations. In contrast to the growing literature on fine-tuning methods to achieve unlearning, we focus on a comparatively lightweight alternative called soft prompting to realize the unlearning of a subset of training data. With losses designed to enforce forgetting as well as utility preservation, our framework \textbf{S}oft \textbf{P}rompting for \textbf{U}n\textbf{l}earning (SPUL) learns prompt tokens that can be appended to an arbitrary query to induce unlearning of specific examples at inference time without updating LLM parameters. We conduct a rigorous evaluation of the proposed method and our results indicate that SPUL can significantly improve the trade-off between utility and forgetting in the context of text classification and question answering with LLMs. We further validate our method using multiple LLMs to highlight the scalability of our framework and provide detailed insights into the choice of hyperparameters and the influence of the size of unlearning data. Our implementation is available at \url{https://github.com/karuna-bhaila/llm_unlearning}.

For agents

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

get_harvested_code_for_paper("2406.12038")
get_code_for_paper("2406.12038")
have("2406.12038")

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

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

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

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

Connect an agent — have() is free.