SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2311.09948 · 2023

Hijacking Large Language Models via Adversarial In-Context Learning

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/2311.09948.json · badge: /api/ran/2311.09948.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
RookieZxy/GGI-attack canonical (classifier label)
classifier basis: census
3 ran · 5 no recorded run
FunctionStatusWhere it lives
split_string Ran
ran; our contract draft was wrong, not the code
RookieZxy/GGI-attack/GGI-attack/llm_attacks/ggi/string_utils.py
pointer only (licence: NONE); the stored copy get_code serves, from rookiezxy/gbtl, is pointer only (licence: NONE) · get_code("2e16b01dcf774c0d")
How it ran

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

trimmed_mean Ran
ran; our contract draft was wrong, not the code
RookieZxy/GGI-attack/Baseline-attack/utils/constants.py
pointer only (licence: NONE) · get_code("7c5149fc31eebb8f")
How it ran

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

tuple_type Ran
ran, honoured the contract we drafted
RookieZxy/GGI-attack/Baseline-attack/utils/constants.py
pointer only (licence: NONE) · get_code("54af014068eb7eff")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, RookieZxy/GGI-attack 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_embedding_layer Not yet run
unverified (harvested, no recorded run)
RookieZxy/GGI-attack/GGI-attack/llm_attacks/base/attack_manager.py
pointer only (licence: NONE) · get_code("08e65c38a5b1c5a1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, RookieZxy/GGI-attack 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_embedding_matrix Not yet run
unverified (harvested, no recorded run)
RookieZxy/GGI-attack/GGI-attack/llm_attacks/base/attack_manager.py
pointer only (licence: NONE) · get_code("2703f8b621b73255")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, RookieZxy/GGI-attack 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_embeddings Not yet run
unverified (harvested, no recorded run)
RookieZxy/GGI-attack/GGI-attack/llm_attacks/base/attack_manager.py
pointer only (licence: NONE) · get_code("33377834cc7d0c84")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, RookieZxy/GGI-attack 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_filtered_cands Not yet run
unverified (harvested, no recorded run)
RookieZxy/GGI-attack/GGI-attack/llm_attacks/ggi/opt_utils.py
pointer only (licence: NONE) · get_code("8de79cc4c0ca62d1")
How it ran

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

sample_control Not yet run
unverified (harvested, no recorded run)
RookieZxy/GGI-attack/GGI-attack/llm_attacks/ggi/opt_utils.py
pointer only (licence: NONE) · get_code("94d7ddaf0169dbf1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, RookieZxy/GGI-attack 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, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 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
sample_control 6 other papers
6 later
2402.13459 (2024-02)
Learning to Poison Large Language Models for Downstream Manipulation
2403.01251 (2024-03)
Accelerating Greedy Coordinate Gradient and General Prompt Optimization via Probe Sampling
2404.13968 (2024-04)
Protecting Your LLMs with Information Bottleneck
and 3 more not named here
split_string 1 other paper
1 later
2402.13459 (2024-02)
Learning to Poison Large Language Models for Downstream Manipulation

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

In-context learning (ICL) has emerged as a powerful paradigm leveraging LLMs for specific downstream tasks by utilizing labeled examples as demonstrations (demos) in the preconditioned prompts. Despite its promising performance, crafted adversarial attacks pose a notable threat to the robustness of LLMs. Existing attacks are either easy to detect, require a trigger in user input, or lack specificity towards ICL. To address these issues, this work introduces a novel transferable prompt injection attack against ICL, aiming to hijack LLMs to generate the target output or elicit harmful responses. In our threat model, the hacker acts as a model publisher who leverages a gradient-based prompt search method to learn and append imperceptible adversarial suffixes to the in-context demos via prompt injection. We also propose effective defense strategies using a few shots of clean demos, enhancing the robustness of LLMs during ICL. Extensive experimental results across various classification and jailbreak tasks demonstrate the effectiveness of the proposed attack and defense strategies. This work highlights the significant security vulnerabilities of LLMs during ICL and underscores the need for further in-depth studies.

For agents

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

get_harvested_code_for_paper("2311.09948")
get_code_for_paper("2311.09948")
have("2311.09948")

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

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

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

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

Connect an agent — have() is free.