SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2604.08499 · 2026

PIArena: A Platform for Prompt Injection Evaluation

Jinyuan Jia, Ying Chen, Chenlong Yin, Yanting Wang, Runpeng Geng

arXiv · PDF · Open in the Atlas

Code that ran

6 of 10 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; 4 no recorded run), measured 2026-11-23; 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/2604.08499.json · badge: /api/ran/2604.08499.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
sleeepeer/PIArena canonical (classifier label)
classifier basis: census
6 ran · 4 no recorded run
FunctionStatusWhere it lives
contexts_to_paragraphs Ran
ran; our contract draft was wrong, not the code
sleeepeer/PIArena/piarena/utils.py
code served (permissive licence) · get_code("c29519b91c75f744")
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
import numpy as np

torch.manual_seed(0)

# The function expects contexts to be a list where:
# - contexts[0] is a string that will be split by '\n\n'
# Let's create a simple list with a string containing multiple paragraphs

test_text = "First paragraph\n\nSecond paragraph\n\nThird paragraph"

contexts = [test_text]

ARGS = {
    "contexts": contexts
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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
find_indices Ran
ran; our contract draft was wrong, not the code
sleeepeer/PIArena/piarena/utils.py
code served (permissive licence) · get_code("5f69123a5c7e7f00")
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 int; 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)

# list1 and list2 are both lists
# The function iterates through list1 and finds the index of each element in list2
# It returns a list of indices

ARGS = {
    "list1": [1, 3, 5, 2],
    "list2": [0, 1, 2, 3, 4, 5, 6],
}
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 int — 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_openai_completion_with_retry Ran
ran; our contract draft was wrong, not the code
sleeepeer/PIArena/piarena/llm.py
code served (permissive licence) · get_code("8d2d2cdd2192c834")
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 time
from unittest.mock import Mock, MagicMock

# Create a mock OpenAI client
mock_client = Mock()

# Create a mock response structure
mock_message = Mock()
mock_message.content = "This is a test completion response"

mock_choice = Mock()
mock_choice.message = mock_message

mock_response = Mock()
mock_response.choices = [mock_choice]

# Set up the client to return the mock response
mock_client.chat.completions.create = MagicMock(return_value=mock_response)

ARGS = {
    'client': mock_client,
    'sleepsec': 10,
    'model': 'gpt-3.5-turbo',
    'messages': [{'role': 'user', 'content': 'Hello'}],
    'temperature': 0.7,
    'max_tokens': 100
}
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
load_gpt_model Ran
ran; our contract draft was wrong, not the code
sleeepeer/PIArena/piarena/llm.py
code served (permissive licence) · get_code("6975c261662e8360")
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 yaml
import tempfile
import os

# Create a temporary YAML config file
config_content = """
default:
  - azure_deployment: gpt-4
    client_class: "dict"
    api_key: "test-key-1"
    model: "gpt-4"
  - azure_deployment: gpt-3.5-turbo
    client_class: "dict"
    api_key: "test-key-2"
    model: "gpt-3.5-turbo"
"""

# Write config to temporary file
temp_dir = tempfile.gettempdir()
config_path = os.path.join(temp_dir, "test_openai_config.yaml")
with open(config_path, 'w') as f:
    f.write(config_content)

ARGS = {
    "openai_config_path": config_path,
    "model_name": "gpt-4",
    "api_key_index": 0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — 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
load_json Ran
ran; our contract draft was wrong, not the code
sleeepeer/PIArena/piarena/utils.py
code served (permissive licence) · get_code("ed4e52fc66e57123")
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 json
import tempfile
import os

# Create a temporary JSON file with valid content
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test_data.json")

test_data = {
    "key1": "value1",
    "key2": [1, 2, 3],
    "key3": {"nested": "object"}
}

with open(temp_file, 'w') as f:
    json.dump(test_data, f)

ARGS = {
    "file_path": temp_file
}
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 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
parse_attacker_feedback Ran
ran; our contract draft was wrong, not the code
sleeepeer/PIArena/piarena/attacks/utils.py
code served (permissive licence) · get_code("5f10378e01d98c6d")
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 AttackerFeedback. 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
import json
from dataclasses import dataclass
from typing import Optional, List, Dict, Callable

@dataclass
class AttackerFeedback:
    """Parsed attacker LLM output: improvement explanation + new attack prompt."""
    improvement: str
    prompt: str

def parse_attacker_feedback(content: str) -> Optional[AttackerFeedback]:
    """
    Parse attacker LLM response to extract {"improvement": ..., "prompt": ...} JSON.

    Handles markdown code blocks and malformed JSON by trying progressively
    shorter suffixes from the first '{' to the last valid '}'.

    Handles markdown code blocks and malformed JSON by trying progressively
    shorter suffixes from the first '{' to the last valid '}'.
    """
    if not content:
        return None
    content = content.strip()
    if '```' in content:
        m = re.search('```(?:json)?\\s*(\\{[\\s\\S]*?\\})\\s*```', content)
        if m:
            content = m.group(1)
    start = content.find('{')
    if start == -1:
        return None
    rest = content[start:]
    for end in range(len(rest), 0, -1):
        if rest[end - 1] != '}':
            continue
        try:
            obj = json.loads(rest[:end])
            if isinstance(obj, dict) and ('improvement' in obj or 'prompt' in obj):
                return AttackerFeedback(improvement=obj.get('improvement', ''), prompt=obj.get('prompt', ''))
        except json.JSONDecodeError:
            continue
    return None

# Test cases for different scenarios
test_case_1 = '{"improvement": "try better wording", "prompt": "new attack here"}'
test_case_2 = '```json\n{"improvement": "be more specific", "prompt": "attack with details"}\n```'
test_case_3 = '{"improvement": "focus on edge cases", "prompt": "test boundary conditions"} some trailing text'
test_case_4 = ''
test_case_5 = 'no json here at all'
test_case_6 = '{"improvement": "partial", "prompt":'

ARGS = {
    "content": test_case_1
}
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 AttackerFeedback — a AttackerFeedback output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AttackerFeedback 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
completion Not yet run
unverified (harvested, no recorded run)
sleeepeer/PIArena/piarena/attacks/attack_heuristic.py
code served (permissive licence) · get_code("99625ed919297229")
How it ran

no invocation recorded.

direct Not yet run
unverified (harvested, no recorded run)
sleeepeer/PIArena/piarena/attacks/attack_heuristic.py
code served (permissive licence) · get_code("e7d9c55ee6d15033")
How it ran

no invocation recorded.

ignore Not yet run
unverified (harvested, no recorded run)
sleeepeer/PIArena/piarena/attacks/attack_heuristic.py
code served (permissive licence) · get_code("f92e07d410dd5396")
How it ran

no invocation recorded.

refinement_judge Not yet run
unverified (harvested, no recorded run)
sleeepeer/PIArena/piarena/attacks/utils.py
code served (permissive licence) · get_code("eef78c4115fd4082")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 10 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.

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

Prompt injection attacks pose serious security risks across a wide range of real-world applications. While receiving increasing attention, the community faces a critical gap: the lack of a unified platform for prompt injection evaluation. This makes it challenging to reliably compare defenses, understand their true robustness under diverse attacks, or assess how well they generalize across tasks and benchmarks. For instance, many defenses initially reported as effective were later found to exhibit limited robustness on diverse datasets and attacks. To bridge this gap, we introduce PIArena, a unified and extensible platform for prompt injection evaluation that enables users to easily integrate state-of-the-art attacks and defenses and evaluate them across a variety of existing and new benchmarks. We also design a dynamic strategy-based attack that adaptively optimizes injected prompts based on defense feedback. Through comprehensive evaluation using PIArena, we uncover critical limitations of state-of-the-art defenses: limited generalizability across tasks, vulnerability to adaptive attacks, and fundamental challenges when an injected task aligns with the target task. The code and datasets are available at https://github.com/sleeepeer/PIArena.

For agents

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

get_harvested_code_for_paper("2604.08499")
get_code_for_paper("2604.08499")
have("2604.08499")

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

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

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

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

Connect an agent — have() is free.