SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.10502 · 2024

Causal Language Modeling Can Elicit Search and Reasoning Capabilities on Logic Puzzles

arXiv · PDF · Open in the Atlas

Code that ran

5 of 11 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 0 have no contract verdict; 5 failures of our instrument; 6 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/2409.10502.json · badge: /api/ran/2409.10502.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
kulinshah98/llm-reasoning-logic-puzzles canonical (classifier label)
classifier basis: census
5 ran · 6 no recorded run
FunctionStatusWhere it lives
create_dataset Ran
ran; our contract draft was wrong, not the code
kulinshah98/llm-reasoning-logic-puzzles/zebra-code/train/data.py
code served (permissive licence) · get_code("5bf07d2ee6a39c55")
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, 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 pickle
import numpy as np
import tensorflow as tf
import tempfile
import os

class Config:
    def __init__(self):
        self.dataset_path = tempfile.gettempdir() + '/'
        self.max_seq_len = 16
        self.max_m1 = 5
        self.max_n = 4
        self.minibatch_size = 2

def create_mock_pickle_file(file_path, is_train=True):
    """Create a mock pickle file with sample data."""
    data = []
    
    vocab_chars = ['A', 'N', 'S', 'W', 'E', 'R', 'ANSWER']
    
    for i in range(4):
        seq = ['A', 'N', 'S', 'W', 'E', 'R', 'ANSWER']
        answer_table = np.random.randint(0, 10, size=(4, 3), dtype=np.int16)
        data.append((seq, answer_table))
    
    with open(file_path, 'wb') as f:
        pickle.dump(data, f)

config = Config()

train_file = os.path.join(config.dataset_path, 'train.pkl')
test_file = os.path.join(config.dataset_path, 'test.pkl')

create_mock_pickle_file(train_file, is_train=True)
create_mock_pickle_file(test_file, is_train=False)

ARGS = {
    'config': config,
    'bs': 2,
    'train': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
get_pred_logits Ran
ran; our contract draft was wrong, not the code
kulinshah98/llm-reasoning-logic-puzzles/zebra-code/train/evaluater.py
code served (permissive licence) · get_code("983da1fb4db946b2")
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 3, dtype family float, shape (2, 10, 5) 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
import jax
from flax.training import common_utils
from unittest.mock import MagicMock


# Create a minimal config object with required attributes
class MinimalConfig:
    def __init__(self):
        self.max_seq_len = 10


# Create a minimal state object (used by p_forward_pass)
class MinimalState:
    def __init__(self):
        self.params = {}


# Create a minimal forward pass function that accepts state and batch
def mock_forward_pass(state, batch):
    # This function should return logits
    # batch shape: (num_devices, batch_size, seq_len)
    # Return dummy logits of appropriate shape
    batch_size = batch.shape[1] if len(batch.shape) > 1 else 1
    vocab_size = 5
    seq_len = batch.shape[2] if len(batch.shape) > 2 else 10
    logits = np.random.randn(batch_size, seq_len, vocab_size).astype(np.float32)
    return logits


# Prepare arguments
bs = 2  # batch size
max_seq_len = 10
current_seq_len = 6

# Create input sequence: shape (bs, current_seq_len)
cur_input_seq = np.array([
    [1, 2, 3, 4, 5, 6],
    [7, 8, 9, 10, 11, 12]
], dtype=np.int32)

# Create state object
state = MinimalState()

# Create config
config = MinimalConfig()

# Create the parameterized forward pass function
p_forward_pass = mock_forward_pass

ARGS = {
    "cur_input_seq": cur_input_seq,
    "bs": bs,
    "state": state,
    "p_forward_pass": p_forward_pass,
    "config": config
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family float, shape (2, 10, 5) — shape (2, 10, 5) 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
log_hyperparams_tb Ran
ran; our contract draft was wrong, not the code
kulinshah98/llm-reasoning-logic-puzzles/sudoku-code/train/train_and_evaluate.py
code served (permissive licence) · get_code("c22983473f7ce496")
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, 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 jax
import jax.numpy as jnp
import tensorflow as tf
from unittest.mock import MagicMock
import tempfile
import os

# Create a simple config dict-like object
class ConfigDict(dict):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.__dict__ = self

# Create initial_variables as a nested structure of JAX arrays
initial_variables = {
    'layer1': {
        'w': jnp.ones((4, 3)),
        'b': jnp.ones((3,)),
    },
    'layer2': {
        'w': jnp.ones((3, 2)),
        'b': jnp.ones((2,)),
    }
}

# Create config
config = ConfigDict({
    'learning_rate': 0.001,
    'batch_size': 32,
    'num_epochs': 100,
    'optimizer': 'adam'
})

# Create model_config
model_config = ConfigDict({
    'hidden_dim': 64,
    'num_layers': 2,
    'dropout': 0.1,
    'activation': 'relu'
})

# Create a temporary directory for TensorBoard logs
temp_dir = tempfile.mkdtemp()
log_dir = os.path.join(temp_dir, 'logs')
os.makedirs(log_dir, exist_ok=True)

# Create TensorFlow SummaryWriter
tf_summary_writer = tf.summary.create_file_writer(log_dir)

ARGS = {
    'config': config,
    'model_config': model_config,
    'initial_variables': initial_variables,
    'tf_summary_writer': tf_summary_writer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
train_one_step Ran
ran; our contract draft was wrong, not the code
kulinshah98/llm-reasoning-logic-puzzles/zebra-code/train/trainer.py
code served (permissive licence) · get_code("594c91edb211f85b")
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, 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 jax
import jax.numpy as jnp
import numpy as np
from flax import linen as nn
from flax.core import FrozenDict
import functools

# Create a minimal config
config = {
    'batch_size': 2,
    'learning_rate': 0.001,
    'num_devices': 1,
}

# Create a minimal state object (simulating TrainState)
class MinimalState:
    def __init__(self):
        self.params = FrozenDict({'w': jnp.ones((4, 3))})
        self.opt_state = None
        self.step = 0

state = MinimalState()

# Create step counter
step = 0

# Create dropout RNGs
dropout_rngs = jax.random.PRNGKey(0)

# Create a minimal training data iterator
# Each batch should be a tuple/list where:
# - batch[0] is inputs (will be sharded)
# - batch[2] is start_index (will be reshaped and sharded)
def create_train_data_iter():
    while True:
        # batch[0]: inputs tensor
        inputs = np.random.randn(2, 4).astype(np.float32)
        # batch[1]: some middle element (unused in this function)
        unused = np.array([0, 1])
        # batch[2]: start_index that will be reshaped to (-1, 1)
        start_index = np.array([0, 1]).astype(np.int32)
        yield (inputs, unused, start_index)

train_data_iter = create_train_data_iter()

# Create a minimal p_train_step function
# It should accept (state, inputs, start_index, dropout_rng) and return (state, metrics, _)
def p_train_step(state, inputs, start_index, dropout_rng):
    """Minimal training step function."""
    metrics = {'loss': 0.5}
    return (state, metrics, None)

ARGS = {
    'p_train_step': p_train_step,
    'config': config,
    'state': state,
    'step': step,
    'dropout_rngs': dropout_rngs,
    'train_data_iter': train_data_iter,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
valid_solution Ran
ran; our contract draft was wrong, not the code
kulinshah98/llm-reasoning-logic-puzzles/sudoku-code/train/evaluater.py
code served (permissive licence) · get_code("4b832a8d608fda5a")
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 numpy as np

# Create a valid Sudoku solution
# A valid solution has each number 1-9 appearing exactly once in each row, column, and 3x3 box
# The output_seq is a (243,) array where every 3 consecutive elements represent:
# [row_index, col_index, digit]

output_seq = np.zeros(243, dtype=int)

# Fill in a valid completed Sudoku
# We'll create a valid solution by iterating through all 81 cells (0-80)
# and for each cell at position i, we set:
# output_seq[3*i] = row number (0-8)
# output_seq[3*i+1] = col number (0-8)
# output_seq[3*i+2] = digit (1-9)

valid_sudoku = [
    [5, 3, 4, 6, 7, 8, 9, 1, 2],
    [6, 7, 2, 1, 9, 5, 3, 4, 8],
    [1, 9, 8, 3, 4, 2, 5, 6, 7],
    [8, 5, 9, 7, 6, 1, 4, 2, 3],
    [4, 2, 6, 8, 5, 3, 7, 9, 1],
    [7, 1, 3, 9, 2, 4, 8, 5, 6],
    [9, 6, 1, 5, 3, 7, 2, 8, 4],
    [2, 8, 7, 4, 1, 9, 6, 3, 5],
    [3, 4, 5, 2, 8, 6, 1, 7, 9]
]

for row in range(9):
    for col in range(9):
        cell_idx = row * 9 + col
        output_seq[3 * cell_idx] = row
        output_seq[3 * cell_idx + 1] = col
        output_seq[3 * cell_idx + 2] = valid_sudoku[row][col]

ARGS = {
    "output_seq": output_seq
}
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 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
create_dataset Not yet run
unverified (harvested, no recorded run)
kulinshah98/llm-reasoning-logic-puzzles/sudoku-code/train/data.py
code served (permissive licence) · get_code("e87fe7038ae1f4de")
How it ran

no invocation recorded.

create_iter Not yet run
unverified (harvested, no recorded run)
kulinshah98/llm-reasoning-logic-puzzles/sudoku-code/train/data.py
code served (permissive licence) · get_code("2eec2cf59b50fbda")
How it ran

no invocation recorded.

create_iter Not yet run
unverified (harvested, no recorded run)
kulinshah98/llm-reasoning-logic-puzzles/zebra-code/train/data.py
code served (permissive licence) · get_code("fb8dcfc1a0e1a5ea")
How it ran

no invocation recorded.

get_beam_search_candidates Not yet run
unverified (harvested, no recorded run)
kulinshah98/llm-reasoning-logic-puzzles/zebra-code/train/evaluater.py
code served (permissive licence) · get_code("a2f2069bde94109f")
How it ran

no invocation recorded.

get_eval_metrics Not yet run
unverified (harvested, no recorded run)
kulinshah98/llm-reasoning-logic-puzzles/sudoku-code/train/evaluater.py
code served (permissive licence) · get_code("0e85806b890a5909")
How it ran

no invocation recorded.

prepare_tf_data Not yet run
unverified (harvested, no recorded run)
kulinshah98/llm-reasoning-logic-puzzles/sudoku-code/train/data.py
code served (permissive licence) · get_code("9fd07dc9fd853492")
How it ran

no invocation recorded.

Also present in other papers' code

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

Causal language modeling using the Transformer architecture has yielded remarkable capabilities in Large Language Models (LLMs) over the last few years. However, the extent to which fundamental search and reasoning capabilities emerged within LLMs remains a topic of ongoing debate. In this work, we study if causal language modeling can learn a complex task such as solving Sudoku puzzles. To solve a Sudoku, the model is first required to search over all empty cells of the puzzle to decide on a cell to fill and then apply an appropriate strategy to fill the decided cell. Sometimes, the application of a strategy only results in thinning down the possible values in a cell rather than concluding the exact value of the cell. In such cases, multiple strategies are applied one after the other to fill a single cell. We observe that Transformer models trained on this synthetic task can indeed learn to solve Sudokus (our model solves $94.21\%$ of the puzzles fully correctly) when trained on a logical sequence of steps taken by a solver. We find that training Transformers with the logical sequence of steps is necessary and without such training, they fail to learn Sudoku. We also extend our analysis to Zebra puzzles (known as Einstein puzzles) and show that the model solves $92.04 \%$ of the puzzles fully correctly. In addition, we study the internal representations of the trained Transformer and find that through linear probing, we can decode information about the set of possible values in any given cell from them, pointing to the presence of a strong reasoning engine implicit in the Transformer weights.

For agents

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

get_harvested_code_for_paper("2409.10502")
get_code_for_paper("2409.10502")
have("2409.10502")

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

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

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

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

Connect an agent — have() is free.