Papers › Locally Typical Sampling

Locally Typical Sampling

1 Feb 2022arXiv:2202.00666archive 2025-07-28

Clara Meister, Tiago Pimentel, Gian Wiher, Ryan Cotterell

Today's probabilistic language generators fall short when it comes to producing coherent and fluent text despite the fact that the underlying models perform well under standard metrics, e.g., perplexity. This discrepancy has puzzled the language generation community for the last few years. In this work, we posit that the abstraction of natural language generation as a discrete stochastic process--which allows for an information-theoretic analysis--can provide new insights into the behavior of probabilistic language generators, e.g., why high-probability texts can be dull or repetitive. Humans use language as a means of communicating information, aiming to do so in a simultaneously efficient and error-minimizing manner; in fact, psycholinguistics research suggests humans choose each word in a string with this subconscious goal in mind. We formally define the set of strings that meet this criterion: those for which each word has an information content close to the expected information content, i.e., the conditional entropy of our model. We then propose a simple and efficient procedure for enforcing this criterion when generating from probabilistic models, which we call locally typical sampling. Automatic and human evaluations show that, in comparison to nucleus and top-k sampling, locally typical sampling offers competitive performance (in both abstractive summarization and story generation) in terms of quality while consistently reducing degenerate repetitions.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2202.00666")

Code

Syntology Ran 6 of 25 code samples harvested from 2 repositories linked to this paper; 19 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 5 ran with no contract checked.

By repository: official repository: 15 samples from 1 repository, 6 ran; community (archive-listed): 10 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

cimeister/typical-sampling officialmentioned in papermentioned on GitHubjaxApache-2.0 report
guinmoon/llmfarm mentioned on GitHubMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

25 samples harvested; 6 ran; 0 honoured the contract we drafted; 19 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
5ran
19unverified

Licence: 15 of the 25 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

check_number_comma cimeister/typical-sampling/src/transformers/convert_slow_tokenizer.py official repository ran Apache-2.0 recorded; this copy not marked cleared · pointer only · a727df5fd2f5599a · report
ensure_valid_input cimeister/typical-sampling/src/transformers/convert_graph_to_onnx.py official repository ran Apache-2.0 recorded; this copy not marked cleared · pointer only · d770e1dd1d799a47 · report
gelu_fast cimeister/typical-sampling/src/transformers/activations.py official repository ran · our draft was wrong fingerprinted Apache-2.0 recorded; this copy not marked cleared · pointer only · a4475703ff58ecf9 · report
gelu_new cimeister/typical-sampling/src/transformers/activations.py official repository ran fingerprinted Apache-2.0 recorded; this copy not marked cleared · pointer only · 45bb87451230d5e8 · report
gelu_python cimeister/typical-sampling/src/transformers/activations.py official repository ran fingerprinted Apache-2.0 recorded; this copy not marked cleared · pointer only · 95f27ee4e1e8c5d3 · report
generate_identified_filename cimeister/typical-sampling/src/transformers/convert_graph_to_onnx.py official repository ran Apache-2.0 recorded; this copy not marked cleared · pointer only · 7efe3db5c9e2f94d · report
convert_slow_tokenizer cimeister/typical-sampling/src/transformers/convert_slow_tokenizer.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 4e643fa0b277f39b · report
deepspeed_reinit cimeister/typical-sampling/src/transformers/deepspeed.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · e187e5429b112df7 · report
detect_overflow cimeister/typical-sampling/src/transformers/debug_utils.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · c551a79d5bb1b062 · report
gelu_fast cimeister/typical-sampling/src/transformers/activations_tf.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 37a5eed2dbd663ca · report
get_abs_min_max cimeister/typical-sampling/src/transformers/debug_utils.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · b5db92a796ef38f1 · report
get_configuration_file cimeister/typical-sampling/src/transformers/configuration_utils.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 07e637f202f76ddb · report
infer_shapes cimeister/typical-sampling/src/transformers/convert_graph_to_onnx.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 3449d7d975edfb89 · report
mish cimeister/typical-sampling/src/transformers/activations_tf.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · cc8c8c3ebf0c343f · report
quick_gelu cimeister/typical-sampling/src/transformers/activations_tf.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · e2d56cb91f999bef · report
add_sq HomebrewNLP/HomebrewNLP-Jax/src/backend.py community (archive-listed) unverified BSD-2-Clause (permissive) · 29095fa631853bbe · report
decoder HomebrewNLP/HomebrewNLP-Jax/src/data.py community (archive-listed) unverified BSD-2-Clause (permissive) · 52eb8468051d0996 · report
fn_if_dataclass HomebrewNLP/HomebrewNLP-Jax/src/context.py community (archive-listed) unverified BSD-2-Clause (permissive) · 58bc40af1d90b395 · report
frame_encoder HomebrewNLP/HomebrewNLP-Jax/script/quantized_vid2tfrecord.py community (archive-listed) unverified BSD-2-Clause (permissive) · 5c302780d36773f7 · report
init_class_copy HomebrewNLP/HomebrewNLP-Jax/src/context.py community (archive-listed) unverified BSD-2-Clause (permissive) · 5fbd4f093295aa97 · report
one_hot HomebrewNLP/HomebrewNLP-Jax/inference.py community (archive-listed) unverified BSD-2-Clause (permissive) · e11d769ad67f0934 · report
promote_to HomebrewNLP/HomebrewNLP-Jax/src/backend.py community (archive-listed) unverified BSD-2-Clause (permissive) · f7c85a0d6b11bf74 · report
serialize HomebrewNLP/HomebrewNLP-Jax/src/context.py community (archive-listed) unverified BSD-2-Clause (permissive) · 417d7c14445e03e0 · report
square_grad HomebrewNLP/HomebrewNLP-Jax/src/backend.py community (archive-listed) unverified BSD-2-Clause (permissive) · de13583a2c04b400 · report
try_except HomebrewNLP/HomebrewNLP-Jax/script/quantized_vid2tfrecord.py community (archive-listed) unverified BSD-2-Clause (permissive) · 0a4d744fe302fd21 · report

Tasks

Abstractive Text SummarizationStory GenerationText Generation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections