Papers › CARFT: Boosting LLM Reasoning via Contrastive Learning with Annotated...

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

21 Aug 2025EMNLParXiv:2508.15868added by Syntology

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

Title, abstract, authors and date from arXiv's metadata (CC0); this paper is not in the Papers with Code archive (frozen 2025-07-28).

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 Chain-of-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., \TheName{}, 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 fine-tuning 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 \TheName{} in terms of robustness, performance (up to 10.15\%), and efficiency (up to 30.62\%). Code is available at https://github.com/WNQzhu/CARFT.

PaperPDFCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2508.15868")

Code

Syntology Ran 0 of 21 code samples harvested from 1 repository linked to this paper; 21 have no recorded run.

By repository: found in paper text by Syntology: 21 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

WNQzhu/CARFT found in paper text by Syntology report

Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

21 samples harvested; 0 ran; 0 honoured the contract we drafted; 21 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

21unverified

Licence: 21 of the 21 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from WNQzhu/CARFT. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

collate_fn WNQzhu/CARFT/code/mwp_ReFT/sampling.py found in paper text by Syntology unverified no licence file found · pointer only · 2bb5bd3526f55ecb · report
do_gather WNQzhu/CARFT/code/mwp_ReFT/src/utils.py found in paper text by Syntology unverified no licence file found · pointer only · 32851be78f5ecd4c · report
eval_code WNQzhu/CARFT/code/mwp_ReFT/src/python_engine.py found in paper text by Syntology unverified no licence file found · pointer only · 7fcae9f5e120bafe · report
evaluate_rerank WNQzhu/CARFT/code/mwp_ReFT/train_reward_model.py found in paper text by Syntology unverified no licence file found · pointer only · c8164df09b7d7a68 · report
extract WNQzhu/CARFT/code/parse/parse_qr.py found in paper text by Syntology unverified no licence file found · pointer only · d19fa71dac29272a · report
floatify WNQzhu/CARFT/code/mwp_ReFT/src/utils.py found in paper text by Syntology unverified no licence file found · pointer only · f21a5f0d5bae0c14 · report
hotmap_tex WNQzhu/CARFT/code/parse/gen_hotmap_tex.py found in paper text by Syntology unverified no licence file found · pointer only · 38b19bc8cb4f088b · report
is_numeric WNQzhu/CARFT/code/mwp_ReFT/src/utils.py found in paper text by Syntology unverified no licence file found · pointer only · c3b86a3bceec86cd · report
parse_gen_log WNQzhu/CARFT/code/parse/parse_qr.py found in paper text by Syntology unverified no licence file found · pointer only · 0e659750d9f0ed7c · report
parse_myacc_log WNQzhu/CARFT/code/eval/parse_log.py found in paper text by Syntology unverified no licence file found · pointer only · 847bf603df6fa258 · report
parse_reft_loss WNQzhu/CARFT/code/eval/parse_log.py found in paper text by Syntology unverified no licence file found · pointer only · da9bd1e1dc9932a9 · report
parse_train_log WNQzhu/CARFT/code/eval/parse_log.py found in paper text by Syntology unverified no licence file found · pointer only · a44a508945459d5c · report
prepare_datasets_and_data_loaders WNQzhu/CARFT/code/mwp_ReFT/train_reward_model.py found in paper text by Syntology unverified no licence file found · pointer only · 4d434f6e5fd591b5 · report
prepare_datasets_and_data_loaders WNQzhu/CARFT/code/mwp_ReFT/train_sft_model.py found in paper text by Syntology unverified no licence file found · pointer only · 2df5a69f894bc2b7 · report
prepare_datasets_and_data_loaders WNQzhu/CARFT/code/mwp_ReFT/train_sl_model.py found in paper text by Syntology unverified no licence file found · pointer only · 9f0489fe01df9539 · report
prepare_datasets_and_data_loaders WNQzhu/CARFT/code/mwp_ReFT/train_rl_reft.py found in paper text by Syntology unverified no licence file found · pointer only · 449e6a4081f8d019 · report
prepare_datasets_and_data_loaders WNQzhu/CARFT/code/mwp_ReFT/train_rl_sl.py found in paper text by Syntology unverified no licence file found · pointer only · 01e9a5c8f882c073 · report
process_code WNQzhu/CARFT/code/mwp_ReFT/src/python_engine.py found in paper text by Syntology unverified no licence file found · pointer only · 8b9f60df8d2c8a82 · report
rgb_and_word WNQzhu/CARFT/code/parse/gen_hotmap_tex.py found in paper text by Syntology unverified no licence file found · pointer only · ac6a453c49c69110 · report
tokenize_fn WNQzhu/CARFT/code/mwp_ReFT/sampling.py found in paper text by Syntology unverified no licence file found · pointer only · 951fe709737c50b9 · report
train_one_epoch WNQzhu/CARFT/code/mwp_ReFT/train_reward_model.py found in paper text by Syntology unverified no licence file found · pointer only · d3b8681876990bfa · report

Results from the paper

The Papers with Code archive ends with its 2025-07-28 snapshot. This paper's arXiv identifier, 2508.15868, was issued in August 2025, after that date, so the archive has no leaderboard rows for it.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections