SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.14627 · EMNLP · 2023

Enabling Large Language Models to Generate Text with Citations

Danqi Chen, Tianyu Gao, Jiatong Yu, Howard Yen

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; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 5 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/2305.14627.json · badge: /api/ran/2305.14627.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
princeton-nlp/alce canonical (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
FunctionStatusWhere it lives
doc_to_text_dense Ran
ran; our contract draft was wrong, not the code
princeton-nlp/alce/searcher.py
pointer only (licence: MIT); the stored copy get_code serves, from beastyz/llm-verified-retrieval, is pointer only (licence: NONE) · get_code("6fd0394cdc745c1a")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from beastyz/llm-verified-retrieval, and GitHub detected no licence in that repository 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.

doc_to_text_tfidf Ran
ran; our contract draft was wrong, not the code
princeton-nlp/alce/searcher.py
pointer only (licence: MIT); the stored copy get_code serves, from beastyz/llm-verified-retrieval, is pointer only (licence: NONE) · get_code("af88e97a5d3a1410")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from beastyz/llm-verified-retrieval, and GitHub detected no licence in that repository 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.

gtr_build_index Ran
ran on a synthesized input
princeton-nlp/alce/retrieval.py
code served (permissive licence) · get_code("c15a972a302a288b")
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 (2, 4) 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 os
import pickle
import torch
import numpy as np
from unittest.mock import MagicMock

torch.manual_seed(0)

# Create a mock encoder that has an encode method
class MockEncoder:
    def encode(self, docs, batch_size=4, show_progress_bar=True, normalize_embeddings=True):
        # Return embeddings with shape (num_docs, embedding_dim)
        num_docs = len(docs)
        embedding_dim = 4
        embs = np.random.randn(num_docs, embedding_dim).astype('float32')
        return embs

encoder = MockEncoder()

# Create sample documents
docs = ["document one", "document two"]

# Set up the GTR_EMB environment variable to point to a temporary location
os.environ['GTR_EMB'] = '/tmp/gtr_embeddings.pkl'

ARGS = {
    'encoder': encoder,
    'docs': docs
}
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 ndarray, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
make_doc_prompt Ran
ran; our contract draft was wrong, not the code
princeton-nlp/alce/utils.py
code served (permissive licence) · get_code("c7d29eb322d5d6e3")
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

torch.manual_seed(0)

# Construct valid arguments for make_doc_prompt
doc = {
    'text': 'This is the main body text of the document.',
    'title': 'Sample Document Title',
    'summary': 'This is a shorter summary version.'
}

doc_id = 0

doc_prompt = 'Document {ID}: {T}\n{P}'

use_shorter = None

ARGS = {
    'doc': doc,
    'doc_id': doc_id,
    'doc_prompt': doc_prompt,
    'use_shorter': use_shorter
}
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
normalize_answer Ran
ran; our contract draft was wrong, not the code
princeton-nlp/alce/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from shmsw25/GraphRetriever, is pointer only (licence: NONE) · get_code("dae7ab386661a4f4")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from shmsw25/GraphRetriever, and GitHub detected no licence in that repository 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.

remove_citations Ran
ran; our contract draft was wrong, not the code
princeton-nlp/alce/post_hoc_cite.py
code served (permissive licence) · get_code("5df8b525aada9853")
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 remove_citations(sent):
    return re.sub('\\[\\d+', '', re.sub(' \\[\\d+', '', sent)).replace(' |', '').replace(']', '')

ARGS = {
    'sent': 'This is a sample sentence [1 with citations [2 and more [3 text.'
}
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

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, 6 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 6 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
normalize_answer 133 other papers
41 dated earlier, 2 the same month, 88 later, 1 same year, order not determinable, 1 undated · 1 only as an assembly brick
1508.06615 (2015-08)
Character-Aware Neural Language Models
1606.05250 (2016-06)
SQuAD: 100,000+ Questions for Machine Comprehension of Text
1608.07905 (2016-08)
Machine Comprehension Using Match-LSTM and Answer Pointer
and 130 more not named here
remove_citations 7 other papers
7 later
2311.07838 (2023-11)
LLatrieval: LLM-Verified Retrieval for Verifiable Generation
2402.04315 (2024-02)
Training Language Models to Generate Text with Citations via Fine-grained Rewards
2402.16617 (2024-02)
Long-Context Language Modeling with Parallel Context Encoding
and 4 more not named here
make_doc_prompt 3 other papers
3 later
2311.07838 (2023-11)
LLatrieval: LLM-Verified Retrieval for Verifiable Generation
2402.04315 (2024-02)
Training Language Models to Generate Text with Citations via Fine-grained Rewards
2025.findings-acl.588 (2025 (year only))
All That Glitters is Not Gold: Improving Robust Retrieval-Augmented Language Models with Fact-Centric Preference Alignment
doc_to_text_dense 2 other papers
2 later
2311.07838 (2023-11)
LLatrieval: LLM-Verified Retrieval for Verifiable Generation
2025.findings-acl.588 (2025 (year only))
All That Glitters is Not Gold: Improving Robust Retrieval-Augmented Language Models with Fact-Centric Preference Alignment
doc_to_text_tfidf 2 other papers
2 later
2311.07838 (2023-11)
LLatrieval: LLM-Verified Retrieval for Verifiable Generation
2025.findings-acl.588 (2025 (year only))
All That Glitters is Not Gold: Improving Robust Retrieval-Augmented Language Models with Fact-Centric Preference Alignment
gtr_build_index 1 other paper
1 later
2025.findings-acl.588 (2025 (year only))
All That Glitters is Not Gold: Improving Robust Retrieval-Augmented Language Models with Fact-Centric Preference Alignment

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

Large language models (LLMs) have emerged as a widely-used tool for information seeking, but their generated outputs are prone to hallucination. In this work, our aim is to allow LLMs to generate text with citations, improving their factual correctness and verifiability. Existing work mainly relies on commercial search engines and human evaluation, making it challenging to reproduce and compare different modeling approaches. We propose ALCE, the first benchmark for Automatic LLMs' Citation Evaluation. ALCE collects a diverse set of questions and retrieval corpora and requires building end-to-end systems to retrieve supporting evidence and generate answers with citations. We develop automatic metrics along three dimensions-fluency, correctness, and citation quality-and demonstrate their strong correlation with human judgements. Our experiments with state-of-the-art LLMs and novel prompting strategies show that current systems have considerable room for improvement-For example, on the ELI5 dataset, even the best models lack complete citation support 50% of the time. Our analyses further highlight promising future directions, including developing better retrievers, advancing long-context LLMs, and improving the ability to synthesize information from multiple sources. 1 ASQA Exact Match Recall ELI5 Claim Recall When did the US break away from England? Question

For agents

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

get_harvested_code_for_paper("2305.14627")
get_code_for_paper("2305.14627")
have("2305.14627")

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

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

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

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

Connect an agent — have() is free.