Official repository for the UL-XCoT paper
Chenyuan Zhang, Qiguang Chen, Xie Chen,
Zhuotao Tian, Bowen Xing, Meishan Zhang, Libo Qin, Baotian Hu, Min Zhang
Overview of the UL-XCoT framework.
Cross-lingual chain-of-thought (XCoT) reasoning can improve multilingual problem solving, but it often introduces substantial inference overhead. UL-XCoT addresses this efficiency bottleneck from two complementary directions:
- Less Languages: route each query to a small set of helpful auxiliary languages in a unified logic space instead of reasoning over many languages.
- Less Tokens: prune low-quality reasoning trajectories during decoding with early stopping to reduce unnecessary token generation.
In this repository, UL-XCoT is mainly evaluated on:
- PolyMath across 18 languages
- MMLU-ProX-Lite style multilingual evaluation across 29 languages
The main backbone used in the paper is DeepSeek-R1-Distill-Qwen-7B.
The repository is organized around four main stages of the framework:
- Unified Logic Mechanism
Project multilingual hidden states into a shared logic space so reasoning behavior can be compared across languages. - Candidate Language Selection
Use routing metadata to select a small auxiliary-language set for each query. - Dynamic CoT Pruning
Monitor decoding trajectories and early-stop low-confidence branches. - Voting
Aggregate the remaining trajectories to produce the final prediction.
git clone --recurse-submodules https://github.com/chenyuanTKCY/UL-XCoT.git
cd UL-XCoTIf you already cloned without submodules:
git submodule update --init --recursiveconda env create -f environment.yml
conda activate LangRouterThe file environment.yml was exported from the original runtime environment used in this project.
3. Install hidden_vllm
hidden_vllm is a customized vLLM backend used to expose hidden states during decoding. It is required by the UL-XCoT inference pipeline.
cd hidden_vllm
pip install -e .
cd ..The public scripts use environment variables instead of machine-specific hard-coded paths.
export ULXCOT_MODEL_PATH=/path/to/DeepSeek-R1-Distill-Qwen-7B
export PYTHON_BIN=/home/cyzhang/miniconda/envs/LangRouter/bin/python
export VLLM_SRC=$PWD/hidden_vllmNotes:
ULXCOT_MODEL_PATHshould point to the model directory or model identifier used for inference.PYTHON_BINshould point to the Python executable in your runtime environment.VLLM_SRCis added toPYTHONPATHby the retained shell scripts.- Some scripts assume a GPU environment similar to the paper setup.
bash scripts/get_assislan.shThis step prepares candidate-language routing information for later inference.
bash scripts/infer.shbash scripts/CLSP_acc.sh
bash scripts/self_consistency.sh
bash scripts/infer_MMLU.shexport OPENAI_API_KEY=your_key_here
bash scripts/get_acc.shbash scripts/get_cost.shFor more script-level notes, see scripts/README.md.
This GitHub release is intentionally lightweight and keeps only the benchmark inputs and metadata needed for code understanding and limited reproduction.
The public dataset/ directory currently centers on two multilingual reasoning benchmarks:
PolyMath: an 18-language mathematical reasoning benchmark with four difficulty levels, used here as the main testbed for cross-lingual routing and token-efficient CoT inferenceMMLU-ProX-Lite: a 29-language lightweight multilingual evaluation benchmark used to check whether UL-XCoT generalizes beyond the math-focused setting
The retained files include:
dataset/polymath/input/dataset/MMLU-ProX-Lite_2col_tsv_by_lang/*/{test,validation}.tsvdataset/MMLU-ProX-Lite_2col_tsv_by_lang/routing_results_polymath_ds7b_new.json
For detailed data provenance, structure, and omitted artifacts, see dataset/README.md.
UL-XCoT/
├── README.md
├── environment.yml
├── requirements.txt
├── process_query.py
├── get_assistant_languages.py
├── eval_answer.py
├── get_cost.py
├── dataset/
│ ├── polymath/
│ └── MMLU-ProX-Lite_2col_tsv_by_lang/
├── scripts/
│ ├── infer.sh
│ ├── CLSP_acc.sh
│ ├── self_consistency.sh
│ ├── infer_MMLU.sh
│ ├── get_assislan.sh
│ ├── get_acc.sh
│ └── get_cost.sh
├── utils/
├── paper/
└── hidden_vllm/
Key files:
process_query.py: main inference entry for UL-XCoT and retained baselinesget_assistant_languages.py: candidate-language routing generationeval_answer.py: answer evaluationget_cost.py: token-cost statisticsutils/language_router.py: language routing logicutils/early_stop.py: dynamic pruning / early stopping logicutils/inference_utils.py: inference wrapper
If you find this idea useful for your research, please consider citing our:
@article{zhang2026ulxcot,
title={Less Languages, Less Tokens: An Efficient Unified Logic Cross-lingual Chain-of-Thought Reasoning Framework},
author={Zhang, Chenyuan and Chen, Qiguang and Chen, Xie and Tian, Zhuotao and Xing, Bowen and Zhang, Meishan and Qin, Libo and Hu, Baotian and Zhang, Min},
booktitle={Proc. of ACL 2026},
year={2026}
}Please email Chenyuan Zhang and Libo Qin if you have any questions or suggestions.