CoolFace
Modelpublic

LHL3341/Caco-CodeGen

sourceHugging Faceapache-2.0updated 11mo agoView on Hugging Face
4likes21downloads
Model Card

Caco: Scaling Code-Assisted Chain-of-Thoughts and Instructions for Model Reasoning

![Paper](https://arxiv.org/abs/2510.04081) ![Conference](https://neurips.cc/) ![License](https://opensource.org/licenses/Apache-2.0)

Caco-CodeGen is a code-driven reasoning generation model trained under the Caco framework. It serves as the core engine for expanding executable Code Chain-of-Thoughts (Code CoTs), enabling diverse, verifiable, and pattern-aware reasoning data synthesis at scale.


๐Ÿš€ Overview

Traditional Chain-of-Thought (CoT) data often lacks verifiability and diversity. Caco addresses this by grounding reasoning in executable programs, enabling automatic correctness checks and scalable reasoning synthesis.

PropertyDescription
Model TypeCode LLM (Code-Aware Generator)
Base ModelQwen2.5-Coder-7B
Training ObjectiveNext-token prediction on executable reasoning traces
Training DataCode CoTs extracted and unified from math and algorithmic datasets
Output TypePython-like executable reasoning steps (code_cot)
VerificationCode execution + output consistency filter

๐Ÿง  Methodology

<p align="center"> <img src="https://github.com/LHL3341/Caco/blob/main/caco.png?raw=true" alt="Caco Framework Overview" width="600"/> </p>

Caco constructs reasoning data through three scalable stages:

1. Unifying Code CoT

Collect diverse seed reasoning traces (mathematical + algorithmic), normalize them into a unified executable format.

2. Scaling Code CoT

Train a Code Generator to expand reasoning traces via Pattern-level Augmentation โ€” restructuring logic (e.g., decomposition, reformulation, alternative solution paths).

3. Instruction Reversing

Back-translate executable reasoning into natural language problems and solutions, and apply dual correctness verification.


โš™๏ธ Usage

Example Inference

bash
from transformers import AutoTokenizer, AutoModelForCausalLM

model_name = "LHL3341/Caco-CodeGen"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name).to("cuda")

prompt = "<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")

outputs = model.generate(**inputs, max_new_tokens=1024)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Example use cases

  • โ€”Fine-tuning reasoning LLMs (math, logic, or code tasks)
  • โ€”Verifiable reasoning data augmentation
  • โ€”Program-based RL reward modeling (RLVR)
  • โ€”Cross-domain reasoning transfer experiments

๐Ÿ“ˆ Benchmarks (Caco Models)

ModelMATHOlympiadTheorem-QA
DeepSeekMath-7B-Caco68.229.533.8
Qwen2.5-7B-Caco82.446.546.0
Llama3-8B-Caco70.634.131.0

Models trained on Caco show consistent improvements across multiple reasoning benchmarks and domains.


๐Ÿ”ฌ Citation

If you use Caco in your research, please cite:

bibtex
@article{caco,
  title={Scaling Code-Assisted Chain-of-Thoughts and Instructions for Model Reasoning},
  author={Honglin Lin and Qizhi Pei and Xin Gao and Zhuoshi Pan and Yu Li and Juntao Li and Conghui He and Lijun Wu},
  journal={arXiv preprint arXiv:2510.04081},
  year={2025}
}

๐Ÿ“œ License

Apache 2.0 โ€” free for academic and commercial use, with attribution.


๐ŸŒฑ Related Resources


๐Ÿ’ก Future Directions

  • โ€”Raising Difficulty: integrate harder datasets (AM-Thinking-distill, DAPO)
  • โ€”Expanding Diversity: add science, proofs, procedural planning
  • โ€”RL with Verifiable Rewards (RLVR): use code execution as low-noise reward signal