SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2309.13339 · 2023

Enhancing Zero-Shot Chain-of-Thought Reasoning in Large Language Models through Logic

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 1 failure 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/2309.13339.json · badge: /api/ran/2309.13339.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
xf-zhao/lot canonical (classifier label)
classifier basis: census
3 ran · 0 no recorded run
FunctionStatusWhere it lives
extract_gold_answer Ran
ran, honoured the contract we drafted
xf-zhao/lot/logithoughts/utils.py
code served (permissive licence) · get_code("b4623247187b66ed")
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
from collections import Counter, defaultdict

INVALID_ANS = '[invalid]'

def extract_gold_answer(dataset_name, gold_completion):
    """Extract the gold answer from a completion.
    :param dataset_name (str): The name of the dataset.
    :param gold_completion (str): The gold completion.

    :return: The gold answer.
    """
    if dataset_name in ['GSM8K', 'SVAMP', 'MultiArith']:
        ANS_RE = re.compile('#### (\\-?[0-9\\.\\,]+)')
        match = ANS_RE.search(gold_completion)
        if match:
            match_str = match.group(1).strip()
            match_str = match_str.replace(',', '')
            return int(match_str)
        else:
            return INVALID_ANS
    elif dataset_name == 'ASDiv':
        if type(gold_completion) in [tuple, list]:
            answer = dict(Counter([int(ans) for ans in gold_completion]))
        else:
            answer = int(gold_completion)
        return answer
    elif dataset_name in ['Date', 'CLUTRR']:
        answer = gold_completion.split('#### ')[-1]
        return answer
    elif dataset_name == 'saycan':
        answer = eval(gold_completion)
        return answer
    elif dataset_name in ['StrategyQA']:
        answer = bool(gold_completion)
        return answer
    elif dataset_name in ['sports']:
        answer = bool(int(gold_completion))
        return answer
    elif dataset_name in ['LogiQA']:
        answer = int(gold_completion)
        return answer
    elif dataset_name in ['AQuA', 'CauseEffect', 'SocialQA', 'OddOneOut', 'Objects']:
        gold_completion = gold_completion.replace('Opt', '')
        answer = ord(gold_completion.lower()) - ord('a')
        return answer
    elif dataset_name in ['LastLetter']:
        return gold_completion
    else:
        return gold_completion


ARGS = {
    'dataset_name': 'GSM8K',
    'gold_completion': 'The answer is #### 42'
}
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
load_data Ran
ran; our contract draft was wrong, not the code
xf-zhao/lot/logithoughts/utils.py
code served (permissive licence) · get_code("a0bb1f1413adcc9e")
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 list, 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 json
import os
import tempfile
from pathlib import Path

# Create a temporary directory for test files
temp_dir = tempfile.mkdtemp()

# Create a test JSONL file
jsonl_file = os.path.join(temp_dir, "test.jsonl")
with open(jsonl_file, 'w') as f:
    f.write(json.dumps({"idx": 0, "text": "example 1"}) + "\n")
    f.write(json.dumps({"idx": 1, "text": "example 2"}) + "\n")

# Create a test JSON file
json_file = os.path.join(temp_dir, "test.json")
with open(json_file, 'w') as f:
    json.dump([{"text": "example 1"}, {"text": "example 2"}], f)

# Create a test CSV file
csv_file = os.path.join(temp_dir, "test.csv")
with open(csv_file, 'w') as f:
    f.write("name,age\n")
    f.write("Alice,30\n")
    f.write("Bob,25\n")

# Create a test TXT file (JSONL format)
txt_file = os.path.join(temp_dir, "test.txt")
with open(txt_file, 'w') as f:
    f.write(json.dumps({"idx": 0, "data": "line 1"}) + "\n")
    f.write(json.dumps({"idx": 1, "data": "line 2"}) + "\n")

ARGS = {
    "frn": jsonl_file,
    "format": "list",
    "mode": "r"
}
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 list, ndim 1, dtype family float — a list 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
str2num Ran
ran, honoured the contract we drafted
xf-zhao/lot/logithoughts/utils.py
code served (permissive licence) · get_code("0b07a58c5361c79c")
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 math
from fractions import Fraction

ARGS = {
    'answer_str': '3.14',
    'rounding': 'int',
    'abs_val': True
}
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

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 2 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
str2num 1 other paper
1 dated earlier
2301.13379 (2023-01)
Faithful Chain-of-Thought Reasoning

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

Recent advancements in large language models have showcased their remarkable generalizability across various domains. However, their reasoning abilities still have significant room for improvement, especially when confronted with scenarios requiring multi-step reasoning. Although large language models possess extensive knowledge, their reasoning often fails to effectively utilize this knowledge to establish a coherent thinking paradigm. These models sometimes show hallucinations as their reasoning procedures are unconstrained by logical principles. Aiming at improving the zero-shot chain-of-thought reasoning ability of large language models, we propose LoT (Logical Thoughts), a self-improvement prompting framework that leverages principles rooted in symbolic logic, particularly Reductio ad Absurdum, to systematically verify and rectify the reasoning processes step by step. Experimental evaluations conducted on language tasks in diverse domains, including arithmetic, commonsense, symbolic, causal inference, and social problems, demonstrate the efficacy of enhanced reasoning by logic. The implementation code for LoT can be accessed at: https://github.com/xf-zhao/LoT.

For agents

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

get_harvested_code_for_paper("2309.13339")
get_code_for_paper("2309.13339")
have("2309.13339")

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

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

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

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

Connect an agent — have() is free.