SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2412.11142 · 2024

AD-LLM: Benchmarking Large Language Models for Anomaly Detection

arXiv · PDF · Open in the Atlas

Code that ran

4 of 7 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; 3 failures of our instrument; 3 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/2412.11142.json · badge: /api/ran/2412.11142.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
usc-fortis/ad-llm canonical (classifier label)
classifier basis: census
4 ran · 3 no recorded run
FunctionStatusWhere it lives
generate_embeddings Ran
ran, honoured the contract we drafted
usc-fortis/ad-llm/baseline_w_gpt_embed.py
code served (permissive licence) · get_code("b45367566abc496b")
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 ndarray, ndim 2, dtype family float, shape (4, 1536) 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
from unittest.mock import Mock, MagicMock

# Create a mock GPT client that simulates the OpenAI API response
mock_gpt_client = Mock()

# Create mock embedding response objects
class MockEmbeddingItem:
    def __init__(self, embedding):
        self.embedding = embedding

class MockEmbeddingResponse:
    def __init__(self, embeddings_list):
        self.data = [MockEmbeddingItem(emb) for emb in embeddings_list]

# Configure the mock client to return embeddings
def create_embeddings_response(model, input):
    # Generate mock embeddings with shape (batch_size, 1536)
    # 1536 is the standard dimension for text-embedding-3-large
    batch_size = len(input) if isinstance(input, list) else 1
    embeddings = [np.random.randn(1536).tolist() for _ in range(batch_size)]
    return MockEmbeddingResponse(embeddings)

mock_gpt_client.embeddings.create.side_effect = create_embeddings_response

# Create a simple dataloader with text batches
dataloader = [
    ["The quick brown fox", "jumps over the lazy dog"],
    ["Hello world", "This is a test"],
]

ARGS = {
    "gpt_client": mock_gpt_client,
    "dataloader": dataloader,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 1536) — shape (4, 1536) 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
generate_prompt_setting_1 Ran
ran; our contract draft was wrong, not the code
usc-fortis/ad-llm/prompt/ad_1_gpt_prompt.py
code served (permissive licence) · get_code("141469aa23018895")
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

# Call generate_prompt_setting_1 with appropriate arguments
ARGS = {
    'text': 'This is a sample text about sports and fitness activities.',
    'normal_label_list': ['Sports', 'Health', 'Entertainment'],
    'anomaly_label_list': ['Spam', 'Noise', 'Gibberish'],
    'normal_desc_dict': {
        'Sports': 'Content related to athletic activities, games, and competitions',
        'Health': 'Content about medical information, wellness, and fitness',
        'Entertainment': 'Content about movies, music, TV shows, and entertainment'
    },
    'anomaly_desc_dict': {
        'Spam': 'Unwanted promotional or commercial content',
        'Noise': 'Random or incoherent text',
        'Gibberish': 'Meaningless character sequences'
    },
    'origianl_task': 'anomaly_detection'
}
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
generate_prompt_setting_1 Ran
ran; our contract draft was wrong, not the code
usc-fortis/ad-llm/prompt/ad_1_llama_prompt.py
code served (permissive licence) · get_code("8aa0ff2182ce2c41")
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 torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "text": "The weather today is sunny and warm, perfect for a picnic in the park.",
    "normal_label_list": ["sports", "weather", "politics"],
    "anomaly_label_list": ["spam", "noise"],
    "normal_desc_dict": {
        "sports": "Content related to athletic activities, games, and sporting events",
        "weather": "Information about meteorological conditions and forecasts",
        "politics": "Discussion of political topics, elections, and governance"
    },
    "anomaly_desc_dict": {
        "spam": "Unwanted or irrelevant commercial content",
        "noise": "Gibberish or random characters"
    },
    "origianl_task": "text_classification"
}
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 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
generate_prompt_setting_2 Ran
ran; our contract draft was wrong, not the code
usc-fortis/ad-llm/prompt/ad_2_gpt_prompt.py
code served (permissive licence) · get_code("d781fa3b578a72e3")
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)

ARGS = {
    'text': 'This is a sample text that needs to be analyzed for anomalies in the context of document classification.',
    'normal_label_list': ['sports', 'technology', 'politics'],
    'anomaly_label_list': ['spam', 'offensive'],
    'normal_desc_dict': {
        'sports': 'Content related to sports events, athletes, and competitions',
        'technology': 'Content about technological innovations, gadgets, and software',
        'politics': 'Content discussing political events, policies, and governance'
    },
    'anomaly_desc_dict': {
        'spam': 'Unsolicited or repetitive content trying to promote products or services',
        'offensive': 'Content containing hate speech, harassment, or abusive language'
    },
    'origianl_task': 'document_classification'
}
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
read_data_summary Not yet run
unverified (harvested, no recorded run)
usc-fortis/ad-llm/utils.py
code served (permissive licence) · get_code("8350c5663464101b")
How it ran

no invocation recorded.

read_json Not yet run
unverified (harvested, no recorded run)
usc-fortis/ad-llm/utils.py
code served (permissive licence) · get_code("772778f25f3bd45f")
How it ran

no invocation recorded.

read_normal_desc Not yet run
unverified (harvested, no recorded run)
usc-fortis/ad-llm/utils.py
code served (permissive licence) · get_code("abc3be5d5ec0f373")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 7 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 7 later) and 0 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
generate_embeddings 1 other paper
1 later
2025.findings-acl.79 (2025 (year only))
AD-LLM: Benchmarking Large Language Models for Anomaly Detection
generate_prompt_setting_1 1 other paper
1 later
2025.findings-acl.79 (2025 (year only))
AD-LLM: Benchmarking Large Language Models for Anomaly Detection
generate_prompt_setting_1 1 other paper
1 later
2025.findings-acl.79 (2025 (year only))
AD-LLM: Benchmarking Large Language Models for Anomaly Detection
generate_prompt_setting_2 1 other paper
1 later
2025.findings-acl.79 (2025 (year only))
AD-LLM: Benchmarking Large Language Models for Anomaly Detection
read_data_summary 1 other paper
1 later
2025.findings-acl.79 (2025 (year only))
AD-LLM: Benchmarking Large Language Models for Anomaly Detection
read_json 1 other paper
1 later
2025.findings-acl.79 (2025 (year only))
AD-LLM: Benchmarking Large Language Models for Anomaly Detection
read_normal_desc 1 other paper
1 later
2025.findings-acl.79 (2025 (year only))
AD-LLM: Benchmarking Large Language Models for Anomaly Detection

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

Anomaly detection (AD) is an important machine learning task with many real-world uses, including fraud detection, medical diagnosis, and industrial monitoring. Within natural language processing (NLP), AD helps detect issues like spam, misinformation, and unusual user activity. Although large language models (LLMs) have had a strong impact on tasks such as text generation and summarization, their potential in AD has not been studied enough. This paper introduces AD-LLM, the first benchmark that evaluates how LLMs can help with NLP anomaly detection. We examine three key tasks: (i) zero-shot detection, using LLMs' pre-trained knowledge to perform AD without tasks-specific training; (ii) data augmentation, generating synthetic data and category descriptions to improve AD models; and (iii) model selection, using LLMs to suggest unsupervised AD models. Through experiments with different datasets, we find that LLMs can work well in zero-shot AD, that carefully designed augmentation methods are useful, and that explaining model selection for specific datasets remains challenging. Based on these results, we outline six future research directions on LLMs for AD.

For agents

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

get_harvested_code_for_paper("2412.11142")
get_code_for_paper("2412.11142")
have("2412.11142")

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

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

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

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

Connect an agent — have() is free.