Instructions to use Word2Li/CoTranslator-4B-Full with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Word2Li/CoTranslator-4B-Full with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Word2Li/CoTranslator-4B-Full") 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("Word2Li/CoTranslator-4B-Full") model = AutoModelForCausalLM.from_pretrained("Word2Li/CoTranslator-4B-Full", 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 Word2Li/CoTranslator-4B-Full with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Word2Li/CoTranslator-4B-Full" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Word2Li/CoTranslator-4B-Full", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Word2Li/CoTranslator-4B-Full
- SGLang
How to use Word2Li/CoTranslator-4B-Full 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 "Word2Li/CoTranslator-4B-Full" \ --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": "Word2Li/CoTranslator-4B-Full", "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 "Word2Li/CoTranslator-4B-Full" \ --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": "Word2Li/CoTranslator-4B-Full", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Word2Li/CoTranslator-4B-Full with Docker Model Runner:
docker model run hf.co/Word2Li/CoTranslator-4B-Full
CoTranslator-4B-Full
Translator variant trained on the full released paired dataset, introduced in CoTranslator: Reverse to Forward Chain-of-Thought Translator for Reasoning Distillation. CoTranslator learns to convert answer-conditioned reverse chain-of-thought (CoT) trajectories into trajectories resembling verified forward solutions. Its translations provide supervision for downstream student models.
Overview of CoTranslator. The translator learns from paired reverse and verified forward trajectories, then translates reverse trajectories at scale to construct student training data.
Released checkpoint
| Item | Value |
|---|---|
| Base model | Qwen/Qwen3-4B-Thinking-2507 |
| Parameters stored | 4,022,468,096 |
| Training | Full-parameter supervised fine-tuning |
| Source pair configuration | full |
| Rows in the source JSONL | 266,288, before training preprocessing and packing |
| Checkpoint step | 4921 |
| Weights | BF16, two Safetensors shards |
The companion translator is CoTranslator-4B.
Translation task
The teacher generates a reverse trajectory with access to the reference answer, using the semantic suppression prompt described in the manuscript. The translator receives that trajectory, including its reasoning and final response. During training, its target is the corresponding question-only forward response from the original Nemotron dataset, accepted by answer verification.
The translation input consists of the following system instruction and a user message containing the reverse trajectory:
You are a reasoning trajectory refiner. Given a teacher-generated solution trajectory, produce a more natural reasoning trajectory. Preserve the mathematical conclusion and answer format.
<think>
{{reasoning_content}}
</think>
{{content}}
At inference, supply the teacher trajectory in this format. The manuscript conditions the translator on the trajectory alone; the problem and reference answer are used for pairing and verification.
Training configuration
The settings below are recorded in this checkpoint's args.json and match the manuscript's translator configuration.
| Setting | Value |
|---|---|
| Framework | Megatron-Swift |
| Epochs | 3 |
| Learning rate | 5e-5 |
| LR schedule / warmup fraction | Cosine / 0.1 |
| Weight decay | 0.1 |
| Global / micro batch size | 32 / 2 |
| Sequence length | 65,536 tokens |
| Packing / precision | Enabled / BF16 |
| Adam beta1 / beta2 | 0.9 / 0.95 |
| Gradient clipping | 1.0 |
| Seed | 42 |
| Chat template | qwen3_thinking |
Training preprocessing drops examples exceeding the 65,536-token limit; the source JSONL row count precedes that preprocessing.
Usage
Use a recent Transformers release. The checkpoint configuration was saved with Transformers 5.12.1; local configuration and tokenizer loading were checked with that version.
pip install -U transformers accelerate torch datasets
This example translates the input trajectory from one released training pair:
import torch
from datasets import load_dataset
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Word2Li/CoTranslator-4B-Full"
data = load_dataset(
"Word2Li/CoTranslator-Nemotron-SFT-Math-v4-Pairs", "full",
split="train", streaming=True,
)
example = next(iter(data))
messages = example["messages"][:2]
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id, dtype="auto", device_map="auto",
)
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True,
)
inputs = tokenizer(prompt, add_special_tokens=False, return_tensors="pt").to(model.device)
with torch.inference_mode():
output = model.generate(
**inputs, max_new_tokens=32768, do_sample=True,
temperature=0.6, top_p=0.95, top_k=20,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id,
)
continuation = tokenizer.decode(
output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True,
)
# The bundled chat template already places the opening <think> in the prompt.
translated_trajectory = "<think>\n" + continuation
print(translated_trajectory)
The manuscript uses temperature 0.6, top-p 0.95, top-k 20, min-p 0, and a maximum of 32,768 generated tokens for translator inference.
License and attribution
This release uses Apache-2.0, matching the base model license. Training data attribution and source-specific data licenses are described in the paired dataset card.
- Downloads last month
- 159
Model tree for Word2Li/CoTranslator-4B-Full
Base model
Qwen/Qwen3-4B-Thinking-2507