SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.03951 · 2023

Chain of Natural Language Inference for Reducing Large Language Model Ungrounded Hallucinations

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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; 5 failures of our instrument; 0 no recorded run), measured 2026-11-24; 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/2310.03951.json · badge: /api/ran/2310.03951.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
microsoft/conli_hallucination canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
clean_span Ran
ran; our contract draft was wrong, not the code
microsoft/conli_hallucination/CoNLI/CoNLI/run_hallucination_evaluator.py
code served (permissive licence) · get_code("148f24e5d98bded3")
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 re

def clean_span(x):
    return ' '.join(re.sub('[\\<].*?[\\>]', '', x).split())

# The function takes a single parameter 'x' which is a string
# It removes angle bracket patterns from the string and cleans up whitespace

ARGS = {
    'x': 'This is <tag>some</tag> text with <another>tags</another> in it'
}
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
count_tokens Ran
ran, honoured the contract we drafted
microsoft/conli_hallucination/CoNLI/CoNLI/modules/hallucination_detector.py
code served (permissive licence) · get_code("89115682f5989ce7")
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 int, ndim 0, dtype family int, 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 re

def count_tokens(text: str) -> int:
    import re
    return len(re.findall('\\w+', text))

# Setup code
ARGS = {
    "text": "Hello world this is a test string with multiple words"
}
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 int, ndim 0, dtype family int, 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
create_openai_arguments Ran
ran; our contract draft was wrong, not the code
microsoft/conli_hallucination/CoNLI/CoNLI/modules/arguments.py
code served (permissive licence) · get_code("5ca9b0d44540ff90")
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 OpenaiArguments. 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
from pathlib import Path

# Create a temporary config file for the function to read
config_data = {
    "gpt-4-32k": {
        "USE_CHAT_COMPLETIONS": True
    },
    "gpt-3.5-turbo": {
        "USE_CHAT_COMPLETIONS": False
    }
}

# Create a temporary directory and config file
temp_dir = tempfile.mkdtemp()
config_file_path = os.path.join(temp_dir, 'aoai_config.json')
with open(config_file_path, 'w') as f:
    json.dump(config_data, f)

ARGS = {
    'config_setting_key': 'gpt-4-32k',
    'max_parallelism': 4,
    'config_file': config_file_path
}
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 OpenaiArguments — a OpenaiArguments output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OpenaiArguments 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
create_ta_arguments Ran
ran; our contract draft was wrong, not the code
microsoft/conli_hallucination/CoNLI/CoNLI/modules/arguments.py
code served (permissive licence) · get_code("d56a5a7a9e1bd244")
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 TAArguments. 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
from pathlib import Path
from dataclasses import dataclass, field
from typing import Optional, List
import os

# Create a temporary config file with valid TA settings
temp_dir = tempfile.mkdtemp()
config_file_path = os.path.join(temp_dir, 'ta_config.json')

ta_config = {
    "ta-health": {
        "ENDPOINT": "https://example-endpoint.cognitiveservices.azure.com/",
        "API_KEY": "test-api-key-12345",
        "ENTITIES": ["Person", "Location", "Organization"]
    },
    "ta-standard": {
        "ENDPOINT": "https://standard-endpoint.cognitiveservices.azure.com/",
        "API_KEY": "standard-api-key-67890",
        "ENTITIES": ["Event", "Product"]
    }
}

with open(config_file_path, 'w') as f:
    json.dump(ta_config, f)

ARGS = {
    'config_key': 'ta-health',
    'ta_config_file': config_file_path
}
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 TAArguments — a TAArguments output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a TAArguments 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_optional_field Ran
ran; our contract draft was wrong, not the code
microsoft/conli_hallucination/CoNLI/CoNLI/run_hallucination_detection.py
code served (permissive licence) · get_code("4860d7cabcaf1622")
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)

# Construct arguments for get_optional_field
# The function takes:
# - hallucination: a dict-like object
# - field_name: a string key to look up
# - default_value: a string to return if key not found (default '')

hallucination = {
    'name': 'test_hallucination',
    'value': 42,
    'description': 'A test object'
}

field_name = 'name'

default_value = 'default_result'

ARGS = {
    'hallucination': hallucination,
    'field_name': field_name,
    'default_value': default_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
get_required_field Ran
ran; our contract draft was wrong, not the code
microsoft/conli_hallucination/CoNLI/CoNLI/run_hallucination_detection.py
code served (permissive licence) · get_code("240f39e05a931cbf")
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 numpy as np

torch.manual_seed(0)

# The function accesses hallucination[field_name] and converts it to string
# So hallucination needs to be a dict-like object with at least one key

hallucination = {
    "field_1": 42,
    "field_2": "test_value",
    "field_3": 3.14159
}

field_name = "field_1"

ARGS = {
    "hallucination": hallucination,
    "field_name": field_name
}
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 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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 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 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.

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-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large language models (LLMs) can generate fluent natural language texts when given relevant documents as background context. This ability has attracted considerable interest in developing industry applications of LLMs. However, LLMs are prone to generate hallucinations that are not supported by the provided sources. In this paper, we propose a hierarchical framework to detect and mitigate such ungrounded hallucination. Our framework uses Chain of Natural Language Inference (CoNLI) for hallucination detection and hallucination reduction via post-editing. Our approach achieves state-of-the-art performance on hallucination detection and enhances text quality through rewrite, using LLMs without any fine-tuning or domain-specific prompt engineering. We show that this simple plug-and-play framework can serve as an effective choice for hallucination detection and reduction, achieving competitive performance across various contexts.

For agents

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

get_harvested_code_for_paper("2310.03951")
get_code_for_paper("2310.03951")
have("2310.03951")

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

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

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

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

Connect an agent — have() is free.