SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.20315 · ACL · 2024

ANAH: Analytical Annotation of Hallucinations in Large Language Models

Ziwei Ji, Dahua Lin, Kai Chen, Wenwei Zhang, Yuzhe Gu, Chengqi Lyu

arXiv · PDF · Open in the Atlas

Code that ran

9 of 9 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 0 have no contract verdict; 8 failures of our instrument; 0 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/2405.20315.json · badge: /api/ran/2405.20315.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
InternLM/lmdeploy canonical (classifier label)
classifier basis: census
9 ran · 0 no recorded run
FunctionStatusWhere it lives
check_vl_llm Ran
ran, violated the contract we drafted
InternLM/lmdeploy/lmdeploy/archs.py
code served (permissive licence) · get_code("2bf6c00c566b801c")
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 torch
import torch.nn as nn

# Test case 1: DeepseekV2ForCausalLM with language_config and vision_config
config_deepseek = {
    'language_config': {
        'architectures': ['DeepseekV2ForCausalLM']
    },
    'vision_config': {},
    'architectures': ['DeepseekV2ForCausalLM']
}

# Test case 2: Supported architecture - LlavaLlamaForCausalLM
config_llava = {
    'architectures': ['LlavaLlamaForCausalLM']
}

# Test case 3: MultiModalityCausalLM with language_config
config_multimodal = {
    'architectures': ['MultiModalityCausalLM'],
    'language_config': {}
}

# Test case 4: ChatGLMModel with vision_config
config_chatglm = {
    'architectures': ['ChatGLMModel'],
    'vision_config': {}
}

# Test case 5: Unsupported architecture
config_unsupported = {
    'architectures': ['SomeOtherModel']
}

# Use one of the configs for ARGS
ARGS = {
    'backend': 'vllm',
    'config': config_llava
}
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 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
compile_response_format Ran
ran; our contract draft was wrong, not the code
InternLM/lmdeploy/lmdeploy/_guided_decoding.py
code served (permissive licence) · get_code("77ce2711c2f8950d")
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 json
from typing import Any


# Create a mock compiler that has the required methods
class MockCompiler:
    def compile_json_schema(self, source: str):
        return f"compiled_json_schema({source[:20]}...)"
    
    def compile_regex(self, source: str):
        return f"compiled_regex({source[:20]}...)"
    
    def compile_structural_tag(self, source: str):
        return f"compiled_structural_tag({source[:20]}...)"


# Test case 1: json_schema with simple dict schema
response_format_json_schema = {
    'type': 'json_schema',
    'json_schema': {
        'type': 'object',
        'properties': {
            'name': {'type': 'string'},
            'age': {'type': 'integer'}
        }
    }
}

# Test case 2: regex_schema
response_format_regex = {
    'type': 'regex_schema',
    'regex_schema': r'^[a-zA-Z0-9]+$'
}

# Test case 3: json_object
response_format_json_object = {
    'type': 'json_object'
}

# Test case 4: structural_tag
response_format_structural_tag = {
    'type': 'structural_tag',
    'tag_name': 'example_tag',
    'attributes': {'key': 'value'}
}

# Test case 5: text (default)
response_format_text = {
    'type': 'text'
}

# Test case 6: json_schema with nested schema key
response_format_nested = {
    'type': 'json_schema',
    'json_schema': {
        'schema': {
            'type': 'object',
            'properties': {'field': {'type': 'string'}}
        }
    }
}

# Create a compiler instance
compiler = MockCompiler()

# Define ARGS for the primary function compile_response_format
# Using json_schema as the main test case
ARGS = {
    'compiler': compiler,
    'response_format': response_format_json_schema
}
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
get_text Ran
ran; our contract draft was wrong, not the code
InternLM/lmdeploy/lmdeploy/model.py
code served (permissive licence) · get_code("7004ae9213140ec9")
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

# Test case 1: content as a string
content_string = "This is a simple text response"

# Test case 2: content as a list of dicts with ChatCompletionContentPartTextParam structure
content_list = [
    {"text": "This is text from a list"},
    {"text": "This is a second element that should be ignored"}
]

ARGS = {
    "content": content_string
}
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
to_json Ran
ran; our contract draft was wrong, not the code
InternLM/lmdeploy/lmdeploy/deepseek_v32_encoding.py
code served (permissive licence) · get_code("c8ad433b6fe18d53")
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 json
from typing import Any

torch_imported = False
try:
    import torch
    torch_imported = True
except ImportError:
    pass

# The function to_json takes a single parameter 'value' of type Any
# and attempts to JSON serialize it with ensure_ascii=False, 
# falling back to ensure_ascii=True if that fails.
# We need to provide a value that can be serialized to JSON.

# Test with various types that are JSON-serializable
ARGS = {
    "value": {
        "string": "hello",
        "number": 42,
        "float": 3.14,
        "boolean": True,
        "null": None,
        "list": [1, 2, 3],
        "nested": {"key": "value"},
        "unicode": "こんにちは"
    }
}
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
to_json Ran
ran; our contract draft was wrong, not the code
InternLM/lmdeploy/lmdeploy/deepseek_v4_encoding.py
code served (permissive licence) · get_code("ee1294cf4de7d8c0")
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 json
from typing import Any

torch_imported = False
try:
    import torch
    torch_imported = True
    torch.manual_seed(0)
except ImportError:
    pass

# Test various types that can be serialized to JSON
ARGS = {
    "value": {
        "string": "hello",
        "number": 42,
        "float": 3.14,
        "bool": True,
        "null": None,
        "list": [1, 2, 3],
        "nested": {"key": "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 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
tool_calls_from_openai_format Ran
ran; our contract draft was wrong, not the code
InternLM/lmdeploy/lmdeploy/deepseek_v32_encoding.py
code served (permissive licence) · get_code("e9281cecc545ad6f")
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

# Construct tool_calls in OpenAI format
# The function expects a list of dicts with 'function' key containing 'name' and 'arguments'
tool_calls = [
    {
        'function': {
            'name': 'get_weather',
            'arguments': '{"location": "San Francisco", "unit": "celsius"}'
        }
    },
    {
        'function': {
            'name': 'search',
            'arguments': '{"query": "python programming", "limit": 10}'
        }
    }
]

ARGS = {
    'tool_calls': tool_calls
}
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
tool_calls_from_openai_format Ran
ran; our contract draft was wrong, not the code
InternLM/lmdeploy/lmdeploy/deepseek_v4_encoding.py
code served (permissive licence) · get_code("8b8cee237b9dc9d0")
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 json

# Define the ARGS dictionary with valid OpenAI-format tool calls
ARGS = {
    'tool_calls': [
        {
            'function': {
                'name': 'get_weather',
                'arguments': json.dumps({'location': 'San Francisco', 'unit': 'celsius'})
            }
        },
        {
            'function': {
                'name': 'calculate_sum',
                'arguments': json.dumps({'numbers': [1, 2, 3, 4]})
            }
        }
    ]
}
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
tools_from_openai_format Ran
ran; our contract draft was wrong, not the code
InternLM/lmdeploy/lmdeploy/deepseek_v32_encoding.py
code served (permissive licence) · get_code("aa8d2113d1ab432e")
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

# The function extracts the 'function' key from each tool in a list of tools
# Tools should be in OpenAI format: a list of dicts with 'function' key

ARGS = {
    'tools': [
        {
            'function': {
                'name': 'get_weather',
                'description': 'Get the weather for a location',
                'parameters': {
                    'type': 'object',
                    'properties': {
                        'location': {'type': 'string'},
                        'unit': {'type': 'string'}
                    }
                }
            },
            'type': 'function'
        },
        {
            'function': {
                'name': 'calculate_sum',
                'description': 'Add two numbers',
                'parameters': {
                    'type': 'object',
                    'properties': {
                        'a': {'type': 'number'},
                        'b': {'type': 'number'}
                    }
                }
            },
            'type': 'function'
        },
        {
            'function': {
                'name': 'send_email',
                'description': 'Send an email',
                'parameters': {
                    'type': 'object',
                    'properties': {
                        'to': {'type': 'string'},
                        'subject': {'type': 'string'},
                        'body': {'type': 'string'}
                    }
                }
            },
            'type': 'function'
        }
    ]
}
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
tools_from_openai_format Ran
ran; our contract draft was wrong, not the code
InternLM/lmdeploy/lmdeploy/deepseek_v4_encoding.py
code served (permissive licence) · get_code("a2584d89f3a50342")
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

# Construct valid arguments for tools_from_openai_format
# The function expects a list of dicts in OpenAI tool format
# Each dict should have a 'function' key with function definition data

tools = [
    {
        'type': 'function',
        'function': {
            'name': 'get_weather',
            'description': 'Get the current weather',
            'parameters': {
                'type': 'object',
                'properties': {
                    'location': {'type': 'string'},
                    'unit': {'type': 'string', 'enum': ['celsius', 'fahrenheit']}
                }
            }
        }
    },
    {
        'type': 'function',
        'function': {
            'name': 'calculate_sum',
            'description': 'Calculate the sum of two numbers',
            'parameters': {
                'type': 'object',
                'properties': {
                    'a': {'type': 'number'},
                    'b': {'type': 'number'}
                }
            }
        }
    }
]

ARGS = {
    'tools': tools
}
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

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 0 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
check_vl_llm 1 other paper
1 dated earlier
2306.00978 (2023-06)
AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration
compile_response_format 1 other paper
1 dated earlier
2306.00978 (2023-06)
AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration
get_text 1 other paper
1 dated earlier
2306.00978 (2023-06)
AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration
to_json 1 other paper
1 dated earlier
2306.00978 (2023-06)
AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration
tool_calls_from_openai_format 1 other paper
1 dated earlier
2306.00978 (2023-06)
AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration
tools_from_openai_format 1 other paper
1 dated earlier
2306.00978 (2023-06)
AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration

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

Reducing the 'hallucination' problem of Large Language Models (LLMs) is crucial for their wide applications. A comprehensive and finegrained measurement of the hallucination is the first key step for the governance of this issue but is under-explored in the community. Thus, we present ANAH, a bilingual dataset that offers ANalytical Annotation of Hallucinations in LLMs within Generative Question Answering. Each answer sentence in our dataset undergoes rigorous annotation, involving the retrieval of a reference fragment, the judgment of the hallucination type, and the correction of hallucinated content. ANAH consists of ∼12k sentence-level annotations for ∼4.3k LLM responses covering over 700 topics, constructed by a human-in-the-loop pipeline. Thanks to the fine granularity of the hallucination annotations, we can quantitatively confirm that the hallucinations of LLMs progressively accumulate in the answer and use ANAH to train and evaluate hallucination annotators. We conduct extensive experiments on studying generative and discriminative annotators and show that, although current open-source LLMs have difficulties in fine-grained hallucination annotation, the generative annotator trained with ANAH can surpass all open-source LLMs and GPT-3.5, obtain performance competitive with GPT-4, and exhibits better generalization ability on unseen questions. 1 * Equal contributions † Corresponding author 1 Please find the dataset, code, and model at https:// github.com/open-compass/ANAH.

For agents

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

get_harvested_code_for_paper("2405.20315")
get_code_for_paper("2405.20315")
have("2405.20315")

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

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

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

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

Connect an agent — have() is free.