README.md

September 9, 2026 · View on GitHub

A*-Thought Comparison

☄️ A*-Thought

A*-Thought: Efficient Reasoning via Bidirectional Compression for Low-Resource Settings

Paper   GitHub   Hugging Face   NeurIPS 2025

A*-Thought-V2: Efficient Latent Reasoning via Geometric Dynamics of LLM

Paper   GitHub   Hugging Face

📜 News · 📌 Resources · 👀 Overview · 🚀 Quick Start · 📂 Compress Data · 🔥 Train · 💭 Evaluate · ✨ Citation

📜 News

📌 Resources

💫 A*-Thought

TypeNameBackboneHugging Face RepoDescription
DatasetAStar-Thought-1ks1.1-1k🤗 HF DataThe training dataset used for A*-Thought model training.
ModelAStar-Thought-QwQ-32BQwQ-32B🤗 HF ModelQwQ-32B trained on AStar-Thought-1k.
ModelAStar-Thought-DeepSeek-R1-Distill-Qwen-32BDeepSeek-R1-Distill-Qwen-32B🤗 HF ModelDeepSeek-R1-Distill-Qwen-32B trained on AStar-Thought-1k.
ModelAStar-Thought-s1.1-32Bs1.1-32B🤗 HF Models1.1-32B trained on AStar-Thought-1k.

💫 A*-Thought-V2

TypeNameBackboneHugging Face RepoDescription
DatasetAStar-Thought-V2-OpenR1-Math-3kOpenR1-Math-3k🤗 HF DataThe training dataset used for A*-Thought-V2 model training.
ModelAStar-Thought-V2-Qwen3.5-9BQwen3.5-9B🤗 HF ModelQwen3.5-9B trained on AStar-Thought-V2-OpenR1-Math-3k.
ModelAStar-Thought-V2-Qwen3.6-27BQwen3.6-27B🤗 HF ModelQwen3.5-9B trained on AStar-Thought-V2-OpenR1-Math-3k.

👀 Overview

💫 A*-Thought

A*-Thought Framework

A*-Thought introduces a unified framework for identifying and isolating the most essential thoughts from long reasoning chains produced by large reasoning models.

The method automatically discovers compact and effective reasoning paths by leveraging both step-level and path-level signals:

  1. Step-level bidirectional importance estimation
    A bidirectional importance estimation mechanism quantifies the significance of each thinking step according to its relevance to both the original question and the prospective solution.

  2. Path-level A* search
    A* search efficiently navigates the exponential search space. It uses cost functions to assess:

    • the quality of the current reasoning path;
    • the conditional self-information of the solution given the current path.

Together, these signals estimate both the current and future cost required to reach a desirable final solution.

💫 A*-Thought-V2

A*-Thought Framework

A*-Thought-V2 is an explicit and implicit interleaved efficient reasoning architecture guided by LLM dynamics. By interweaving the introduction of implicit latent space reasoning in explicit text, it achieves lossless compression of CoT.

🚀 Quick Start

Install dependencies with uv:

cd LlamaFactory
uv pip install -e .

Install the modified vllm used by A*-Thought-V2:

pip download --no-deps "vllm==0.17.0" -d path-to-wheel

cd vllm
VLLM_VERSION_OVERRIDE=0.17.0 \
VLLM_PRECOMPILED_WHEEL_LOCATION=path-to-wheel \
uv pip install .

Note

Only A*-Thought-V2 requires the modified vllm, other options allow for the original vllm.

Install remaining requirements:

uv pip install -r requirements.txt

📂 Compress Data

This repository supports two compression pipelines:

  • A*-Thought
  • A*-Thought-V2

💫 A*-Thought

Run the following command to compress long CoT data with the A*-Thought pipeline:

device_map="0,1,2,3,4,5,6,7"

CUDA_VISIBLE_DEVICES="${device_map}" \
python long_cot_compress_v1.py \
    --scorer_model_path "openai-community/gpt2" \
    --validator_model_path "simplescaling/s1.1-32B" \
    --data_path "simplescaling/s1K-1.1" \
    --cache_path "./saves/cache/s1K-1.1-bis.jsonl" \
    --output_path "./saves/data/AStar-Thought-s1K-1.1.jsonl" \
    --scorer_works_num 32 \
    --scorer_device_map "${device_map}" \
    --validator_device_map "${device_map}" \
    --thought_begin_tag "<|begin_of_thought|>" \
    --thought_end_tag "<|end_of_thought|>" \
    --solution_begin_tag "<|begin_of_solution|>" \
    --solution_end_tag "<|end_of_solution|>" \
    --alpha 0.5 \
    --beta 0.1 \
    --min_search_steps 5 \
    --max_search_steps 20 \
    --load_s1k

Key Hyperparameters

ArgumentDescription
--alphaBalances the question-side and solution-side weights in the Bidirectional Importance Score, ranging from 0 to 1.
--betaControls the weight of the current cost function G in A* search.
--min_search_stepsMinimum number of A* search steps.
--max_search_stepsMaximum number of A* search steps.

You can modify the default configuration in:

💫 A*-Thought-V2

Run the following command to compress long CoT data with the A*-Thought-V2 pipeline:

device_map="0,1,2,3,4,5,6,7"

CUDA_VISIBLE_DEVICES="${device_map}" \
python long_cot_compress_v2.py \
    --model_path "Qwen/Qwen3.5-0.8B" \
    --data_path "TeichAI/deepseek-v3.2-speciale-openr1-math-3k/deepseek-v3.2-speciale-openr1-math-3k.jsonl" \
    --device_map "${device_map}" \
    --works_num 8 \
    --trajectory_pca_cache_path "./saves/cache/trajectory-pca.jsonl" \
    --output_path "./saves/data/AStar-Thought-V2-OpenR1-Math-3k/train.jsonl" \
    --thought_begin_tag "<think>" \
    --thought_end_tag "</think>" \
    --pca_angle_threshold "90"

Key Hyperparameters

ArgumentDescription
--pca_angle_thresholdControls the strictness of retained thinking steps. The value ranges from 0 to 180.
Lower thresholdRetains thinking steps more strictly, resulting in a higher compression rate.
Higher thresholdRetains thinking steps more leniently, resulting in a lower compression rate.

You can modify the default configuration in:

🔥 Train

Before training, write the compressed data path obtained from the compression step into:

💫 A*-Thought

Train with the A*-Thought pipeline:

cd LlamaFactory
bash run_train_v1.sh

You can modify the training script in:

💫 A*-Thought-V2

Train with the A*-Thought-V2 pipeline:

cd LlamaFactory
bash run_train_v2.sh

You can modify the training script in:

💭 Evaluate

Before evaluation, write the model path obtained from the training step into:

💫 A*-Thought

Evaluate an A*-Thought model with vllm:

CUDA_VISIBLE_DEVICES="0,1,2,3,4,5,6,7" \
python -m astarthought.evals.cli evaluate \
    --model "your model path here" \
    --task "math500" \
    --sampling-params temperature=0.6,top_p=0.95,max_tokens=1024 \
    --backend vllm \
    --backend-args tensor_parallel_size=8 \
    --result-dir ./saves/eval

You can modify the evaluation script in:

💫 A*-Thought-V2

Evaluate an A*-Thought-V2 model with hyperparameter-controlled latent inference:

max_latent_count=4
max_latent_len=32

python -m astarthought.evals.cli evaluate \
    --task ${task} \
    --model ${model} \
    --backend vllm \
    --backend-args "tensor_parallel_size=8,gpu_memory_utilization=0.8,hf_overrides={'max_latent_count':${max_latent_count},'max_latent_len':${max_latent_len}}" \
    --sampling-params temperature=1.0,top_p=0.95,max_tokens=${max_tokens} \
    --result-dir ./saves/eval \
    --overwrite \
    --batch-size 512

Key Hyperparameters

ArgumentDescription
max_latent_countMaximum number of switches from text mode to latent mode.
max_latent_lenMaximum token length for a single latent-mode segment.

You can modify the evaluation script in:

For logs and results of evaluation, please refer to: A*-Thought-V2 Experiments Results.

✨ Citation

Please cite our paper if you find this work useful:

@inproceedings{A*-Thought,
  title     = {A*-Thought: Efficient Reasoning via Bidirectional Compression for Low-Resource Settings},
  author    = {Xiaoang Xu and Shuo Wang and Xu Han and Zhenghao Liu and Huijia Wu and Pei Pei Li and Zhiyuan Liu and Maosong Sun and Zhaofeng He},
  booktitle = {The Thirty-ninth Annual Conference on Neural Information Processing Systems},
  year      = {2025},
  url       = {https://openreview.net/forum?id=uvyr9bYwL6}
}
@misc{A*-Thought-V2,
      title={A*-Thought-V2: Efficient Latent Reasoning via Geometric Dynamics of LLM}, 
      author={Xiaoang Xu and Siyuan Liu and Shuo Wang and Junlan Feng and Fanyu Meng and Zhu Zhang and Jixun Wang and Xiaorong Wang and Zihan Zhou and Xin Li and Chaojun Xiao and Yiming Zhang and Huijia Wu and Liuyu Xiang and Peipei Li and Zhaofeng He},
      year={2026},
      eprint={2609.07821},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2609.07821}, 
}