SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2508.15868 · EMNLP · 2025

CARFT: Boosting LLM Reasoning via Contrastive Learning with Annotated Chain-of-Thought-based Reinforced Fine-Tuning

Ji Liu, Yulun Zhang, Wenqiao Zhu, Haipang Wu, Rongjunchen Zhang

arXiv · PDF · Open in the Atlas

Code that ran

11 of 21 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, 1 violated it and 0 have no contract verdict; 9 failures of our instrument; 10 no recorded run), measured 2026-11-24; 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/2508.15868.json · badge: /api/ran/2508.15868.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
WNQzhu/CARFT canonical (classifier label)
classifier basis: census
11 ran · 10 no recorded run
FunctionStatusWhere it lives
collate_fn Ran
ran; our contract draft was wrong, not the code
WNQzhu/CARFT/code/mwp_ReFT/sampling.py
pointer only (licence: NONE) · get_code("2bb5bd3526f55ecb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

extract Ran
ran; our contract draft was wrong, not the code
WNQzhu/CARFT/code/parse/parse_qr.py
pointer only (licence: NONE) · get_code("d19fa71dac29272a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

floatify Ran
ran, honoured the contract we drafted
WNQzhu/CARFT/code/mwp_ReFT/src/utils.py
pointer only (licence: NONE) · get_code("f21a5f0d5bae0c14")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

hotmap_tex Ran
ran; our contract draft was wrong, not the code
WNQzhu/CARFT/code/parse/gen_hotmap_tex.py
pointer only (licence: NONE) · get_code("38b19bc8cb4f088b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

is_numeric Ran
ran, violated the contract we drafted
WNQzhu/CARFT/code/mwp_ReFT/src/utils.py
pointer only (licence: NONE) · get_code("c3b86a3bceec86cd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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_myacc_log Ran
ran; our contract draft was wrong, not the code
WNQzhu/CARFT/code/eval/parse_log.py
pointer only (licence: NONE) · get_code("847bf603df6fa258")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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_reft_loss Ran
ran; our contract draft was wrong, not the code
WNQzhu/CARFT/code/eval/parse_log.py
pointer only (licence: NONE) · get_code("da9bd1e1dc9932a9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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_train_log Ran
ran; our contract draft was wrong, not the code
WNQzhu/CARFT/code/eval/parse_log.py
pointer only (licence: NONE) · get_code("a44a508945459d5c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

process_code Ran
ran; our contract draft was wrong, not the code
WNQzhu/CARFT/code/mwp_ReFT/src/python_engine.py
pointer only (licence: NONE) · get_code("8b9f60df8d2c8a82")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

rgb_and_word Ran
ran; our contract draft was wrong, not the code
WNQzhu/CARFT/code/parse/gen_hotmap_tex.py
pointer only (licence: NONE) · get_code("ac6a453c49c69110")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

tokenize_fn Ran
ran; our contract draft was wrong, not the code
WNQzhu/CARFT/code/mwp_ReFT/sampling.py
pointer only (licence: NONE) · get_code("951fe709737c50b9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

do_gather Not yet run
unverified (harvested, no recorded run)
WNQzhu/CARFT/code/mwp_ReFT/src/utils.py
pointer only (licence: NONE) · get_code("32851be78f5ecd4c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

eval_code Not yet run
unverified (harvested, no recorded run)
WNQzhu/CARFT/code/mwp_ReFT/src/python_engine.py
pointer only (licence: NONE) · get_code("7fcae9f5e120bafe")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

evaluate_rerank Not yet run
unverified (harvested, no recorded run)
WNQzhu/CARFT/code/mwp_ReFT/train_reward_model.py
pointer only (licence: NONE) · get_code("c8164df09b7d7a68")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

parse_gen_log Not yet run
unverified (harvested, no recorded run)
WNQzhu/CARFT/code/parse/parse_qr.py
pointer only (licence: NONE) · get_code("0e659750d9f0ed7c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

prepare_datasets_and_data_loaders Not yet run
unverified (harvested, no recorded run)
WNQzhu/CARFT/code/mwp_ReFT/train_reward_model.py
pointer only (licence: NONE) · get_code("4d434f6e5fd591b5")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

prepare_datasets_and_data_loaders Not yet run
unverified (harvested, no recorded run)
WNQzhu/CARFT/code/mwp_ReFT/train_sft_model.py
pointer only (licence: NONE) · get_code("2df5a69f894bc2b7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

prepare_datasets_and_data_loaders Not yet run
unverified (harvested, no recorded run)
WNQzhu/CARFT/code/mwp_ReFT/train_sl_model.py
pointer only (licence: NONE) · get_code("9f0489fe01df9539")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

prepare_datasets_and_data_loaders Not yet run
unverified (harvested, no recorded run)
WNQzhu/CARFT/code/mwp_ReFT/train_rl_reft.py
pointer only (licence: NONE) · get_code("449e6a4081f8d019")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

prepare_datasets_and_data_loaders Not yet run
unverified (harvested, no recorded run)
WNQzhu/CARFT/code/mwp_ReFT/train_rl_sl.py
pointer only (licence: NONE) · get_code("01e9a5c8f882c073")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

train_one_epoch Not yet run
unverified (harvested, no recorded run)
WNQzhu/CARFT/code/mwp_ReFT/train_reward_model.py
pointer only (licence: NONE) · get_code("d3b8681876990bfa")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, WNQzhu/CARFT 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.

Also present in other papers' code

Of 21 samples lifted from this paper's linked repositories, 21 carry a function identity and 0 do not. Of the 21 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, 0 later) and 7 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
do_gather 3 other papers
3 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2402.05808 (2024-02)
Training Large Language Models for Reasoning through Reverse Curriculum Reinforcement Learning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
is_numeric 3 other papers
3 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2402.05808 (2024-02)
Training Large Language Models for Reasoning through Reverse Curriculum Reinforcement Learning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
collate_fn 2 other papers
2 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
eval_code 2 other papers
2 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
evaluate_rerank 2 other papers
2 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
floatify 2 other papers
2 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
prepare_datasets_and_data_loaders 2 other papers
2 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
prepare_datasets_and_data_loaders 2 other papers
2 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
prepare_datasets_and_data_loaders 2 other papers
2 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
prepare_datasets_and_data_loaders 2 other papers
2 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
process_code 2 other papers
2 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
tokenize_fn 2 other papers
2 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
train_one_epoch 2 other papers
2 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning
2404.03592 (2024-04)
ReFT: Representation Finetuning for Language Models
prepare_datasets_and_data_loaders 1 other paper
1 dated earlier
2401.08967 (2024-01)
REFT: Reasoning with REinforced Fine-Tuning

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

Reasoning capability plays a significantly critical role in the the broad applications of Large Language Models (LLMs). To enhance the reasoning performance of LLMs, diverse Reinforcement Learning (RL)-based fine-tuning approaches have been proposed to address the limited generalization capability of LLMs trained solely via Supervised Fine-Tuning (SFT). Despite their effectiveness, two major limitations hinder the advancement of LLMs. First, vanilla RL-based approaches ignore annotated Chainof-Thought (CoT) and incorporate unstable reasoning path sampling, which typically results in model collapse, unstable training process, and suboptimal performance. Second, existing SFT approaches generally overemphasize the annotated CoT, potentially leading to performance degradation due to insufficient exploitation of potential CoT. In this paper, we propose a Contrastive learning with annotated CoT-based Reinforced Fine-Tuning approach, i.e., CARFT, to enhance the reasoning performance of LLMs while addressing the aforementioned limitations. Specifically, we propose learning a representation for each CoT. Based on this representation, we design novel contrastive signals to guide the fine-tuning process. Our approach not only fully exploits the available annotated CoT but also stabilizes the finetuning procedure by incorporating an additional unsupervised learning signal. We conduct comprehensive experiments and in-depth analysis with three baseline approaches, two foundation models, and two datasets to demonstrate significant advantages of CARFT in terms of robustness, performance (up to 10.15%), and efficiency (up to 30.62%). Code is available at https://github.com/WNQzhu/CARFT.

For agents

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

get_harvested_code_for_paper("2508.15868")
get_code_for_paper("2508.15868")
have("2508.15868")

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

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

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

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

Connect an agent — have() is free.