Skip to content

NJUNLP/AdaR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Making Mathematical Reasoning Adaptive

📃 Paper | ⚙️ Code | 🤖 Project | 📭 Contact


🌱 Overview

Large Language Models (LLMs) have shown impressive reasoning capabilities, yet they often rely on spurious reasoning — producing answers from superficial features, leading to failure at robustness and generalization.

We propose AdaR framework to enable adaptive reasoning, wherein models rely on problem-solving logic to produce answers. AdaR synthesizes logically equivalent queries by varying variable values, and trains models with RLVR on these data to penalize spurious logic while encouraging adaptive logic.

The framework integrates data synthesis and RLVR training to enhance both robustness (in-domain) and generalization (out-of-domain).

AdaR Process Framework

Figure 1.
Subfigure I: Three reasoning modes — direct inference (black), spurious reasoning (red), adaptive reasoning (green).
Subfigure II: Logic-preserving variable perturbation and gold-answer generation via executable logic.
Subfigure III: RLVR optimization encouraging adaptive reasoning through comparative feedback.

📈 Highlights

  • 🚀 +8.5 Average Improvement across in-domain robustness tasks and out-of-domain tasks.
  • 🧮 Only 9K synthetic data needed for significant gains.
  • ⚖️ Enable algebraic thinking and improved stability under scaling.
  • 🔁 Generalizable framework applicable to instruct models.

Instructions for AdaR

⚙️ Installation

git clone https://github.com/LaiZhejian/AdaR.git
cd AdaR
uv sync

📂 Data Preparation

AdaR expects data in JSONL format, with each line as:

{
  "query": "The math problem statement",
  "chosen": "The chain-of-thought reasoning",
  "answer": "The gold standard answer"
}
Field Description
query Input math problem
chosen Chain-of-thought reasoning
answer Ground-truth answer

⚙️ Configuration

Modify parameters in scripts/config.yaml:

  • is_parallel:
    • true → Parallel querying (API-based).
    • false → Sequential querying (local).

You may adjust hyperparameters according to your dataset and model choice.

🔧 Running Data Synthesis

Once configuration is set:

bash synthesis.sh

This script will launch the AdaR data synthesis and RLVR training pipeline.


📜 Citation

If you find this repository helpful, please cite:

@misc{lai2025makingmathematicalreasoningadaptive,
      title={Making Mathematical Reasoning Adaptive}, 
      author={Zhejian Lai and Xiang Geng and Zhijun Wang and Yang Bai and Jiahuan Li and Rongxiang Weng and Jingang Wang and Xuezhi Cao and Xunliang Cai and Shujian Huang},
      year={2025},
      eprint={2510.04617},
      archivePrefix={arXiv},
      primaryClass={cs.AI},
      url={https://arxiv.org/abs/2510.04617}, 
}

⭐️ If you find AdaR helpful, please give this repo a star!
Designed for robust and interpretable mathematical reasoning.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published