SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.23368 · EMNLP · 2025

Threading the Needle: Reweaving Chain-of-Thought Reasoning to Explain Human Label Variation

Janet Yang, Chen Beiduo, Anna Liu, Barbara Korhonen, Plank Mainlp

arXiv · PDF · Open in the Atlas

Code that ran

2 of 2 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 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; 1 failure of our instrument; 0 no recorded run), measured 2026-11-24; 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/2505.23368.json · badge: /api/ran/2505.23368.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
mainlp/CoT2EL community
Papers with Code archive
2 ran · 0 no recorded run
FunctionStatusWhere it lives
Generator Ran
ran on a synthesized input · constructed an object; no result was computed
mainlp/CoT2EL/Pipeline/generator.py
code served (permissive licence) · get_code("b6414a37043550f3")
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 an instance of its own class, Generator: the run constructed the object and did not call it, so no result was computed. 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 os
import json
import tempfile
from unittest.mock import MagicMock, patch

# Create a minimal mock OpenAI client
class MockChatCompletion:
    def __init__(self, content, reasoning_content=None):
        self.content = content
        self.reasoning_content = reasoning_content

class MockChoice:
    def __init__(self, content, reasoning_content=None):
        self.message = MockChatCompletion(content, reasoning_content)

class MockResponse:
    def __init__(self, content, reasoning_content=None):
        self.choices = [MockChoice(content, reasoning_content)]

class MockCompletions:
    def create(self, model, messages, response_format=None):
        if response_format and response_format.get('type') == 'json_object':
            return MockResponse('{"Option A": {"support": [], "oppose": []}}')
        else:
            return MockResponse('A', reasoning_content='This is reasoning.')

class MockOpenAI:
    def __init__(self, api_key=None, base_url=None):
        self.chat = MagicMock()
        self.chat.completions = MockCompletions()

# Setup config dict
config = {
    'task_name': 'CommonsenseQA',
    'api_key': 'test-api-key',
    'base_url': 'http://localhost:8000',
    'output_dir': tempfile.mkdtemp(),
    'generation_stage_1_and_2': {
        'model_s1': 'gpt-4',
        'model_s2': 'gpt-4',
        'prompt_template_key_s1': 'cqa_s1_prompt',
        'prompt_template_key_s2': 's2_extraction_prompt'
    }
}

# Patch OpenAI client before defining ARGS
with patch('openai.OpenAI', MockOpenAI):
    ARGS = {
        'config': config
    }
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
openai, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Generator — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Generator 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
get_prompt Ran
ran; our contract draft was wrong, not the code
mainlp/CoT2EL/Pipeline/generator.py
code served (permissive licence) · get_code("556513f9f88952ef")
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
import torch.nn as nn

PROMPT_TEMPLATES = {'cqa_s1_prompt': 'Please read the following question, choose the most appropriate answer from the options provided and start your answer with a single letter\nQuestion: {question}\nA. {answerA}\nB. {answerB}\nC. {answerC}\nD. {answerD}\nE. {answerE}\nAnswer:', 'siqa_s1_prompt': 'Please read the following social scenario and the accompanying question, choose the most appropriate answer from the options provided and start your answer with a single letter\nScenario: {context}\nQuestion: {question}\nA. {answerA}\nB. {answerB}\nC. {answerC}\nAnswer:', 'varierr_s1_prompt': 'Please determine whether the following statement is true (entailment), undetermined (neutral), or false (contradiction) given the context below and select ONE of the listed options and start your answer with a single letter.\nContext: {premise}\nStatement: {hypothesis}\nA. Entailment\nB. Neutral\nC. Contradiction\nAnswer:', 's2_extraction_prompt': 'The content of your reasoning process is below:\n{reasoning}\nPlease extract and list all the sentences from the aforementioned reasoning process that support each option separately.', 'markdown_to_structured_json': '\n    Convert the given markdown into a structured JSON where each option has two keys: support and oppose. Each key should map to a list of statements from the markdown that either support or oppose that option.\n\n    EXAMPLE JSON OUTPUT:\n    {\n      "Option A": {\n        "support": ["SentenceA.1","SentenceA.2"],\n        "oppose": ["SentenceA.3"]\n      },\n      "Option B": {\n        "support": ["SentenceB.1"],\n        "oppose": []\n      }\n    }\n    '}

def get_prompt(template_key, **kwargs):
    """Formats and returns a prompt based on the given key."""
    if template_key not in PROMPT_TEMPLATES:
        raise ValueError(f"Prompt template with key '{template_key}' not found.")
    return PROMPT_TEMPLATES[template_key].format(**kwargs)

ARGS = {
    'template_key': 'cqa_s1_prompt',
    'question': 'What is the capital of France?',
    'answerA': 'London',
    'answerB': 'Berlin',
    'answerC': 'Paris',
    'answerD': 'Madrid',
    'answerE': 'Rome',
}
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

Also present in other papers' code

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

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-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The recent rise of reasoning-tuned Large Language Models (LLMs)-which generate chains of thought (CoTs) before giving the final answer-has attracted significant attention and offers new opportunities for gaining insights into human label variation, which refers to plausible differences in how multiple annotators label the same data instance. Prior work has shown that LLM-generated explanations can help align model predictions with human label distributions, but typically adopt a reverse paradigm: producing explanations based on given answers. In contrast, CoTs provide a forward reasoning path that may implicitly embed rationales for each answer option, before generating the answers. We thus propose a novel LLM-based pipeline enriched with linguistically-grounded discourse segmenters to extract supporting and opposing statements for each answer option from CoTs with improved accuracy. We also propose a rank-based HLV evaluation framework that prioritizes the ranking of answers over exact scores, which instead favor direct comparison of label distributions. Our method outperforms a direct generation method as well as baselines on three datasets, and shows better alignment of ranking methods with humans, highlighting the effectiveness of our approach.

For agents

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

get_harvested_code_for_paper("2505.23368")
get_code_for_paper("2505.23368")
have("2505.23368")

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

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

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

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

Connect an agent — have() is free.