Instructions to use zitian-gao/qwen25math7b-one-shot-em with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zitian-gao/qwen25math7b-one-shot-em with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zitian-gao/qwen25math7b-one-shot-em") 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("zitian-gao/qwen25math7b-one-shot-em") model = AutoModelForCausalLM.from_pretrained("zitian-gao/qwen25math7b-one-shot-em", 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 zitian-gao/qwen25math7b-one-shot-em with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zitian-gao/qwen25math7b-one-shot-em" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zitian-gao/qwen25math7b-one-shot-em", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zitian-gao/qwen25math7b-one-shot-em
- SGLang
How to use zitian-gao/qwen25math7b-one-shot-em 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 "zitian-gao/qwen25math7b-one-shot-em" \ --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": "zitian-gao/qwen25math7b-one-shot-em", "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 "zitian-gao/qwen25math7b-one-shot-em" \ --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": "zitian-gao/qwen25math7b-one-shot-em", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use zitian-gao/qwen25math7b-one-shot-em with Docker Model Runner:
docker model run hf.co/zitian-gao/qwen25math7b-one-shot-em
One-shot Entropy Minimization
This model is described in the paper One-shot Entropy Minimization.
We trained 13,440 large language models and found that entropy minimization requires only a single unlabeled data and 10 steps optimization to achieve performance improvements comparable to or even greater than those obtained using thousands of data and carefully designed rewards in rule-based reinforcement learning. This striking result may prompt a rethinking of post-training paradigms for large language models.
Code: https://github.com/zitian-gao/one-shot-em Project Page: https://www.notion.so/One-shot-Entropy-Minimization-202606db813b80639773f850f39246a5
Installation
pip install torch transformers==4.47.1 accelerate deepspeed psutil pandas numpy wandb
Reproducing One-shot EM Training (SOTA)
accelerate launch train.py \
--model_name Qwen2.5-Math-7B \
--model_path /path/to/Qwen2.5-Math-7B \
--train_data dataset/1shot_rlvr/pi1_r1280.parquet \
--effective_batch 64 \
--micro_batch_size 2 \
--temperature 0.5 \
--learning_rate 2e-5 \
--max_steps 50 \
--log_steps 1 \
--save_steps 1 \
--run_name one_shot \
--wandb_project one-shot-em
Reproducing Multi-shot EM Training
accelerate launch train.py \
--model_name Qwen2.5-Math-7B \
--model_path /path/to/Qwen2.5-Math-7B \
--train_data dataset/numina/numina_00.parquet \
--effective_batch 64 \
--micro_batch_size 2 \
--temperature 0.5 \
--learning_rate 2e-5 \
--max_steps 50 \
--log_steps 1 \
--save_steps 1 \
--run_name multi_shot \
--wandb_project one-shot-em
Evaluation
cd Qwen2.5-Eval/evaluation
bash sh/eval_all_math.sh
Acknowledgements
Our dataset references and builds upon the following open-source contributions:
- NuminaMath-CoT
- DeepScaler
- One-shot RLVR β for data selection strategies
- Qwen2.5-Eval β for evaluation benchmarks
We sincerely thank the authors and maintainers of these projects for their excellent contributions to the research community!
Citation
@misc{gao2025oneshotentropyminimization,
title={One-shot Entropy Minimization},
author={Zitian Gao and Lynx Chen and Joey Zhou and Bryan Dai},
year={2025},
eprint={2505.20282},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2505.20282},
}
- Downloads last month
- 38