Skip to content

Repository files navigation

Hugging Face Models Hugging Face Datasets ArXiv Publication GitHub OSCD GitHub ClimbSeq

Onramp Sequence Cross-Distillation (OSCD)

The implementation of this codebase corresponds to the arXiv preprint: "Native Multilingual Chain-of-Thought Reasoning in Low-Resource Southeast Asian Languages", of which enables the effective distillation of cross-lingual knowledge and reasoning capabilities from high- to low-resource languages. The training pipeline loads configurations from oscd_config.py and dataconfig.yaml via main.py, initializes oscd_trainer.py, and utilizes modifier.py for on-the-fly reasoning mutation and fine-tuning with joint-embedding semantic alignment.

The training script can be launched using a single NVIDIA H200 GPU. For clarity and ease of navigation, the reasoning modifier in this repository has been simplified to support just two operations:

  1. Deterministic per-word English text reversal (preserving code blocks).
  2. Reasoning compression into an ellipsis (...) for prompt-driven instruct mode of reasoning models.

Multilingual Modifier

Please refer separately to SG-Lim/ClimbSeq for the implementation of agentic translator loop in the original preprint. We leave the implementation layer of a harness/isolated environment connecting the OSCD trainer to the agentic translator an open area for users to freely explore, whether it's through simple queuing, event-driven message brokers, or direct API orchestration.

We hope this opens up broader training opportunities beyond conversational AI with reasoning language models, such as extending the training concepts into agentic tool-calling workflows.

Quick Start & Installation

This project uses uv for fast Python package management.

1. Set Up Environment Variables

Create a .env file in the root directory. You must configure your Hugging Face cache directory and provide an access token to download models and datasets:

HF_HOME=/path/to/your/custom/cache/dir
HF_TOKEN=your_huggingface_access_token_here

2. Install Dependencies

Initialize your virtual environment and sync dependencies using uv:

uv venv
uv sync

3. Run the Training Pipeline

You can launch the training job in one of two ways:

Option A: Using the Training Script (Recommended)

Make the script executable and run it in the background:

chmod +x train.sh
./train.sh

Option B: Direct Terminal Execution

If you prefer not to use the script file, execute the following commands directly in your terminal to set the environment and launch the job in the background:

CUDA_VISIBLE_DEVICES=0 WANDB_MODE=disabled CUDA_DEVICE_ORDER=PCI_BUS_ID \
  OUT_DIR="tmp/oscd" && \
  mkdir -p "$OUT_DIR" && \
  (uv run main.py --output_dir "$OUT_DIR" >> "${OUT_DIR}/train.log" 2>&1 &)

Credits

If you use this repository or build upon our work, please consider citing our preprint:

@misc{lim2026nativemultilingualchainofthoughtreasoning,
      title={Native Multilingual Chain-of-Thought Reasoning in Low-Resource Southeast Asian Languages}, 
      author={Sean Gip Lim and William Chandra Tjhi and Hai Leong Chieu},
      year={2026},
      eprint={2608.00533},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2608.00533}, 
}

This project is built upon and extends the codebases from huggingface/trl and idanshen/Self-Distillation. Please also consider citing the original works that served as the foundation for this codebase:

@software{vonwerra2020trl,
      title   = {{TRL: Transformers Reinforcement Learning}},
      author  = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
      license = {Apache-2.0},
      url     = {https://github.com/huggingface/trl},
      year    = {2020}
}
@inproceedings{shenfeld2026selfdistillation,
      title={Self-Distillation Enables Continual Learning},
      author={Idan Shenfeld and Mehul Damani and Jonas Hübotter and Pulkit Agrawal},
      booktitle={Forty-third International Conference on Machine Learning},
      year={2026},
      url={https://openreview.net/forum?id=qA6FgH0nnZ}
}

Our post-training philosophy is also build upon the prior works of galilai-group/llm-jepa:

@inproceedings{huang2026llmjepa,
      title={{LLM}-{JEPA}: Large Language Models Meet Joint Embedding Predictive Architectures},
      author={Hai Huang and Yann LeCun and Randall Balestriero},
      booktitle={The Fourteenth International Conference on Learning Representations},
      year={2026},
      url={https://openreview.net/forum?id=GbXKPo9QfH}
}