SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2507.03038 · 2025

Cautious Next Token Prediction

arXiv · PDF · Open in the Atlas

Code that ran

9 of 14 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; 8 failures of our instrument; 5 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/2507.03038.json · badge: /api/ran/2507.03038.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
wyzjack/CNTP canonical (classifier label)
classifier basis: census
9 ran · 5 no recorded run
FunctionStatusWhere it lives
get_imports Ran
ran; our contract draft was wrong, not the code
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/dynamic_module_utils.py
pointer only (licence: MIT); the stored copy get_code serves, from JD-GenX/Uni-AdGen, is pointer only (licence: NONE) · get_code("1adcf2d05b2faed1")
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 JD-GenX/Uni-AdGen, 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.

get_relative_import_files Ran
ran; our contract draft was wrong, not the code
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/dynamic_module_utils.py
pointer only (licence: MIT); the stored copy get_code serves, from JD-GenX/Uni-AdGen, is pointer only (licence: NONE) · get_code("518f6a89865f25d2")
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 JD-GenX/Uni-AdGen, 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.

get_relative_imports Ran
ran; our contract draft was wrong, not the code
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/dynamic_module_utils.py
pointer only (licence: MIT); the stored copy get_code serves, from JD-GenX/Uni-AdGen, is pointer only (licence: NONE) · get_code("4af5faa701d0f2c9")
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 JD-GenX/Uni-AdGen, 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.

infer_metric_tags_from_eval_results Ran
ran; our contract draft was wrong, not the code
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/modelcard.py
pointer only (licence: MIT); the stored copy get_code serves, from shen8424/CORE, is pointer only (licence: NONE) · get_code("dd8f7751ef859581")
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 shen8424/CORE, 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.

parse_keras_history Ran
ran; our contract draft was wrong, not the code
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/modelcard.py
pointer only (licence: MIT); the stored copy get_code serves, from shen8424/CORE, is pointer only (licence: NONE) · get_code("e6632a5722f0840d")
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 shen8424/CORE, 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.

prepare_fa2_from_position_ids Ran
ran; our contract draft was wrong, not the code
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/modeling_flash_attention_utils.py
code served (permissive licence) · get_code("a77b72cc8d5c90f0")
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 tuple. 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)

batch_size = 2
query_length = 5
kv_seq_len = 6
num_heads = 4
num_key_value_heads = 2
head_dim = 3

query = torch.randn(batch_size, query_length, num_heads, head_dim)
key = torch.randn(batch_size, kv_seq_len, num_key_value_heads, head_dim)
value = torch.randn(batch_size, kv_seq_len, num_key_value_heads, head_dim)

position_ids = torch.tensor([
    [1, 1, 1, 0, 1, 0],
    [1, 1, 0, 1, 1, 1]
], dtype=torch.int32)

ARGS = {
    "query": query,
    "key": key,
    "value": value,
    "position_ids": position_ids
}
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 tuple — a tuple output has no array shape of its own; none is 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
quick_gelu Ran
ran, honoured the contract we drafted
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/modeling_flax_utils.py
pointer only (licence: MIT); the stored copy get_code serves, from shen8424/CORE, is pointer only (licence: NONE) · get_code("a66d2b78670c85e1")
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 shen8424/CORE, 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.

rename_key_and_reshape_tensor Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/modeling_flax_pytorch_utils.py
pointer only (licence: MIT); the stored copy get_code serves, from shen8424/CORE, is pointer only (licence: NONE) · get_code("30d50ff2ced6b7a3")
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 shen8424/CORE, 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.

reverse_permute_weights Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/modeling_gguf_pytorch_utils.py
code served (permissive licence) · get_code("bb3c4ecbbdf8a9c1")
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 (16, 8) 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

# Construct valid arguments for reverse_permute_weights
# The function reshapes and swaps axes of weight matrices based on number of heads

# Create a simple weight matrix
# Shape: (n_head * dim * 2, other_dims...)
# Let's use n_head=2, dim=4, so shape[0] = 2 * 4 * 2 = 16
n_head = 2
dim = 4
weights = np.random.randn(16, 8)  # (n_head * dim * 2, feature_dim)

ARGS = {
    "weights": weights,
    "n_head": n_head,
    "num_kv_heads": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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 (16, 8) — shape (16, 8) 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
convert_pytorch_state_dict_to_flax Not yet run
unverified (harvested, no recorded run)
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/modeling_flax_pytorch_utils.py
code served (permissive licence) · get_code("b1260d802f5e3997")
How it ran

no invocation recorded.

dtype_byte_size Not yet run
unverified (harvested, no recorded run)
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/modeling_flax_utils.py
code served (permissive licence) · get_code("5e01aab2a01fb6db")
How it ran

no invocation recorded.

flax_shard_checkpoint Not yet run
unverified (harvested, no recorded run)
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/modeling_flax_utils.py
code served (permissive licence) · get_code("80d41fe6d81de3dd")
How it ran

no invocation recorded.

is_hf_dataset Not yet run
unverified (harvested, no recorded run)
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/modelcard.py
pointer only (licence: MIT); the stored copy get_code serves, from shen8424/CORE, is pointer only (licence: NONE) · get_code("ec7b1528a936234d")
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 shen8424/CORE, 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. No invocation recorded.

read_field Not yet run
unverified (harvested, no recorded run)
wyzjack/CNTP/custom_transformers_packages/gsm8k_strategyqa/transformers/modeling_gguf_pytorch_utils.py
code served (permissive licence) · get_code("befefbd3afa0731c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 14 are also present in other papers whose code we hold (14 with at least one paper dated earlier, 0 the same month, 10 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
infer_metric_tags_from_eval_results 19 other papers
16 dated earlier, 3 later
2022.findings-emnlp.427 (2022 (year only))
2305.15756 (2023-05)
UniTRec: A Unified Text-to-Text Transformer and Joint Contrastive Learning Framework for Text-based Recommendation
2310.05107 (2023-10)
OV-PARTS: Towards Open-Vocabulary Part Segmentation
and 16 more not named here
quick_gelu 17 other papers
15 dated earlier, 2 later
2022.findings-emnlp.427 (2022 (year only))
2303.14582 (2023-03)
Identification of Negative Transfers in Multitask Learning Using Surrogate Models
2305.15756 (2023-05)
UniTRec: A Unified Text-to-Text Transformer and Joint Contrastive Learning Framework for Text-based Recommendation
and 14 more not named here
is_hf_dataset 16 other papers
13 dated earlier, 3 later
2310.05107 (2023-10)
OV-PARTS: Towards Open-Vocabulary Part Segmentation
2310.09832 (2023-10)
Merging Experts into One: Improving Computational Efficiency of Mixture of Experts
2312.09979 (2023-12)
LoRAMoE: Alleviate World Knowledge Forgetting in Large Language Models via MoE-Style Plugin
and 13 more not named here
parse_keras_history 16 other papers
13 dated earlier, 3 later
2310.05107 (2023-10)
OV-PARTS: Towards Open-Vocabulary Part Segmentation
2310.09832 (2023-10)
Merging Experts into One: Improving Computational Efficiency of Mixture of Experts
2312.09979 (2023-12)
LoRAMoE: Alleviate World Knowledge Forgetting in Large Language Models via MoE-Style Plugin
and 13 more not named here
flax_shard_checkpoint 14 other papers
13 dated earlier, 1 later
2305.15756 (2023-05)
UniTRec: A Unified Text-to-Text Transformer and Joint Contrastive Learning Framework for Text-based Recommendation
2310.05107 (2023-10)
OV-PARTS: Towards Open-Vocabulary Part Segmentation
2310.09832 (2023-10)
Merging Experts into One: Improving Computational Efficiency of Mixture of Experts
and 11 more not named here
get_relative_import_files 7 other papers
5 dated earlier, 2 later
2403.09766 (2024-03)
An Image Is Worth 1000 Lies: Adversarial Transferability across Prompts on Vision-Language Models
2403.13263 (2024-03)
SC-Tune: Unleashing Self-Consistent Referential Comprehension in Large Vision Language Models
2406.02395 (2024-06)
GrootVL: Tree Topology is All You Need in State Space Model
and 4 more not named here
get_relative_imports 7 other papers
5 dated earlier, 2 later
2403.09766 (2024-03)
An Image Is Worth 1000 Lies: Adversarial Transferability across Prompts on Vision-Language Models
2403.13263 (2024-03)
SC-Tune: Unleashing Self-Consistent Referential Comprehension in Large Vision Language Models
2406.02395 (2024-06)
GrootVL: Tree Topology is All You Need in State Space Model
and 4 more not named here
rename_key_and_reshape_tensor 7 other papers
5 dated earlier, 2 later
2403.09766 (2024-03)
An Image Is Worth 1000 Lies: Adversarial Transferability across Prompts on Vision-Language Models
2403.13263 (2024-03)
SC-Tune: Unleashing Self-Consistent Referential Comprehension in Large Vision Language Models
2406.02395 (2024-06)
GrootVL: Tree Topology is All You Need in State Space Model
and 4 more not named here
get_imports 6 other papers
4 dated earlier, 2 later
2403.09766 (2024-03)
An Image Is Worth 1000 Lies: Adversarial Transferability across Prompts on Vision-Language Models
2403.13263 (2024-03)
SC-Tune: Unleashing Self-Consistent Referential Comprehension in Large Vision Language Models
2406.02395 (2024-06)
GrootVL: Tree Topology is All You Need in State Space Model
and 3 more not named here
convert_pytorch_state_dict_to_flax 3 other papers
2 dated earlier, 1 later
2406.02395 (2024-06)
GrootVL: Tree Topology is All You Need in State Space Model
2505.19235 (2025-05)
CoreMatching: A Co-adaptive Sparse Inference Framework with Token and Neuron Pruning for Comprehensive Acceleration of Vision-Language Models
2510.13183 (2025-10)
DSCD: Large Language Model Detoxification with Self-Constrained Decoding
dtype_byte_size 1 other paper
1 dated earlier
2502.13963 (2025-02)
MuDAF: Long-Context Multi-Document Attention Focusing through Contrastive Learning on Attention Heads
prepare_fa2_from_position_ids 1 other paper
1 dated earlier
2502.13963 (2025-02)
MuDAF: Long-Context Multi-Document Attention Focusing through Contrastive Learning on Attention Heads
read_field 1 other paper
1 dated earlier
2502.13963 (2025-02)
MuDAF: Long-Context Multi-Document Attention Focusing through Contrastive Learning on Attention Heads
reverse_permute_weights 1 other paper
1 dated earlier
2502.13963 (2025-02)
MuDAF: Long-Context Multi-Document Attention Focusing through Contrastive Learning on Attention Heads

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

Next token prediction paradigm has been prevailing for autoregressive models in the era of LLMs. The current default sampling choice for popular LLMs is temperature scaling together with nucleus sampling to balance diversity and coherence. Nevertheless, such approach leads to inferior performance in various NLP tasks when the model is not certain about testing questions. To this end, we propose a brand new training-free decoding strategy, dubbed as Cautious Next Token Prediction (CNTP). In the decoding process, if the model has comparatively high prediction entropy at a certain step, we sample multiple trials starting from the step independently and stop when encountering any punctuation. Then we select the trial with the lowest perplexity score viewed as the most probable and reliable trial path given the model's capacity. The trial number is negatively correlated with the prediction confidence, i.e., the less confident the model is, the more trials it should sample. This is consistent with human beings' behaviour: when feeling uncertain or unconfident, one tends to think more creatively, exploring multiple thinking paths, to cautiously select the path one feels most confident about. Extensive experiments on both LLMs and MLLMs show that our proposed CNTP approach outperforms existing standard decoding strategies consistently by a clear margin. Moreover, the integration of CNTP with self consistency can further improve over vanilla self consistency. We believe our proposed CNTP has the potential to become one of the default choices for LLM decoding. Code is available at https://github.com/wyzjack/CNTP.

For agents

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

get_harvested_code_for_paper("2507.03038")
get_code_for_paper("2507.03038")
have("2507.03038")

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

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

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

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

Connect an agent — have() is free.