Run this model with HF Jobs
Run VanishD/Agentic-R1-SD on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/VanishD/Agentic-R1-SD. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/VanishD/Agentic-R1-SD on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/VanishD/Agentic-R1-SD. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/VanishD/Agentic-R1-SD. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use VanishD/Agentic-R1-SD with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use VanishD/Agentic-R1-SD with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="VanishD/Agentic-R1-SD") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("VanishD/Agentic-R1-SD") model = AutoModelForCausalLM.from_pretrained("VanishD/Agentic-R1-SD", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use VanishD/Agentic-R1-SD with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "VanishD/Agentic-R1-SD" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VanishD/Agentic-R1-SD", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/VanishD/Agentic-R1-SD
- SGLang
How to use VanishD/Agentic-R1-SD with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "VanishD/Agentic-R1-SD" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VanishD/Agentic-R1-SD", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "VanishD/Agentic-R1-SD" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VanishD/Agentic-R1-SD", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use VanishD/Agentic-R1-SD with Docker Model Runner:
docker model run hf.co/VanishD/Agentic-R1-SD
Improve model card for Agentic-R1
Browse filesThis PR significantly improves the model card for `VanishD/Agentic-R1` by:
- Adding the `pipeline_tag: text-generation` to ensure the model appears in relevant searches on the Hub.
- Adding `library_name: transformers` to enable the automated "How to use" code snippet, as the model is compatible with the `transformers` library (evidenced by `config.json` and typical Hugging Face model structure).
- Adding descriptive `tags` such as `qwen2`, `reasoning`, `tool-use`, and `llm` for better discoverability.
- Including a direct link to the paper: [Agentic-R1: Distilled Dual-Strategy Reasoning](https://huggingface.co/papers/2507.05707).
- Adding a link to the GitHub repository: `https://github.com/StigLidu/DualDistill`.
- Replacing the placeholder content with a comprehensive description derived from the paper abstract and the GitHub README, including:
- The paper abstract.
- Key Features.
- Datasets.
- Performance Results.
- Detailed Quick Start instructions (Installation, Inference Server, and Evaluation scripts) directly from the GitHub README.
- Information on Trained Models.
- Important Notes, License, Acknowledgments, and Contact details.
- The academic citation.
*Note*: A Python inference code snippet was not added to the "Quick Start" section as it was not explicitly found in the provided GitHub README, in strict adherence to the instructions.
1234567---license: mitlanguage:- enbase_model:- VanishD/Agentic-R1---123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143---base_model:- VanishD/Agentic-R1language:- enlicense: mitpipeline_tag: text-generationlibrary_name: transformerstags:- qwen2- reasoning- tool-use- llm---# Agentic-R1: Distilled Dual-Strategy ReasoningThe model was presented in the paper [Agentic-R1: Distilled Dual-Strategy Reasoning](https://huggingface.co/papers/2507.05707).Code: https://github.com/StigLidu/DualDistill## AbstractCurrent long chain-of-thought (long-CoT) models excel at mathematical reasoning but rely on slow and error-prone natural language traces. Tool-augmented agents address arithmetic via code execution, but often falter on complex logical tasks. We introduce a fine-tuning framework, DualDistill, that distills complementary reasoning strategies from multiple teachers into a unified student model. Using this approach, we train Agentic-R1, which dynamically selects the optimal strategy for each query, invoking tools for arithmetic and algorithmic problems, and using text-based reasoning for abstract ones. Our method improves accuracy across a range of tasks, including both computation-intensive and standard benchmarks, demonstrating the effectiveness of multi-strategy distillation in achieving robust and efficient reasoning.## Key Features- **Efficient Training**: Integrates tool use into long-chain-of-thought (CoT) reasoning using only 4 × A6000 GPUs- **Unified Reasoning**: Fuses heterogeneous reasoning traces from multiple teacher models into a single student model<div align="center"><img src="https://raw.githubusercontent.com/StigLidu/DualDistill/main/fig/overview.png" alt="Overview of DualDistill methodology" width="500"><p><em>Overview of DualDistill methodology</em></p></div>## Datasets| Dataset | Description | Link ||---------|-------------|------|| **Training Set** | Complete training dataset with teacher trajectories | [🤗 HuggingFace](https://huggingface.co/datasets/VanishD/DualDistill) || **Test Set** | Evaluation benchmarks | `dataset/test/` |## Results<div align="center"><img src="https://raw.githubusercontent.com/StigLidu/DualDistill/main/fig/result.png" alt="Performance comparison of Agentic-R1 models" width="700"></div>- **Agentic-R1** demonstrates significant performance gains on **DeepMath-L** and **Combinatorics300**, where both complex reasoning and tool use are crucial for success.- **Agentic-R1-SD** (Self-Distilled) further enhances performance through our self-distillation approach, consistently outperforming baseline models across nearly all evaluation tasks.## Quick Start### Installation1. **Clone the repository**:```bashgit clone https://github.com/StigLidu/DualDistill.gitcd DualDistill```2. **Create environment** (optional but recommended):```bashconda create -n dualdistill python=3.11conda activate dualdistill```3. **Install dependencies**:```bashpip install -r requirements.txtpip install flash-attn --no-build-isolation```### Inference Server and EvaluationTo run inference and evaluation using the provided scripts:1. **Start inference server**:```bashbash script/eval_script/start_inference_server.sh [model_path] [display_name] [port]```2. **Run Evaluation**:```bashbash script/eval_script/eval_remote_server.sh \[url] [display_name] [data_path] [code_mode] [max_token]```**Example**:```bashbash script/eval_script/eval_remote_server.sh \"http://localhost:8080/v1" "agentic-r1" "dataset/test/math.json" "true" "4096"```## Trained Models| Model | Description | HuggingFace Link ||-------|-------------|------------------|| **Agentic-R1-7B** | Base model with teacher distillation | [🤗 Download](https://huggingface.co/VanishD/Agentic-R1) || **Agentic-R1-7B-SD** | Enhanced model with self-distillation | [🤗 Download](https://huggingface.co/VanishD/Agentic-R1-SD) |## ⚠️ Important Notes- **Code Execution Safety**: The evaluation scripts execute model-generated code locally. Only use trusted models before execution.- **Inference Config**: If you are using vLLM (a recent version) and encounter an error regarding the maximum context length. You may need to modify the `model_max_length` in `tokenizer_config.json`.- **Self-Distillation Warning**: The self-distillation step requires sampling many trajectories and can be time-consuming.## LicenseThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.## AcknowledgmentsWe thank the following open-source projects for their foundational contributions:- [OpenHands](https://github.com/All-Hands-AI/OpenHands) - Agent framework- [DeepMath-103K](https://huggingface.co/datasets/zwhe99/DeepMath-103K) - Mathematical reasoning dataset- [vLLM](https://github.com/vllm-project/vllm) - High-performance inference engine## ContactFor questions or support, please contact:- **Weihua Du**: [weihuad@cs.cmu.edu](mailto:weihuad@cs.cmu.edu)## CitationIf you find our work useful, please consider citing:```bibtex@article{du2025agentic,title={Agentic-R1: Distilled Dual-Strategy Reasoning},author={Du, Weihua and Aggarwal, Pranjal and Welleck, Sean and Yang, Yiming},journal={arXiv preprint arXiv:2507.05707},year={2025}}```---<div align="center"><p>⭐ Star us on GitHub if this project helped you!</p></div>