File size: 5,336 Bytes
52ff651
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9d5a536
52ff651
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
library_name: transformers
license: apache-2.0
base_model: Qwen/Qwen3-4B-Thinking-2507
base_model_relation: finetune
pipeline_tag: text-generation
language:
- en
datasets:
- Word2Li/CoTranslator-Nemotron-SFT-Math-v4-Pairs
tags:
- cotranslator
- reasoning-distillation
- chain-of-thought
- math
- qwen3
- supervised-fine-tuning
---

# CoTranslator-4B

Main translator trained on the 1/8 paired-data subset, introduced in **[CoTranslator: Reverse to Forward Chain-of-Thought Translator for Reasoning Distillation](https://arxiv.org/abs/2610.20828)**.
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](assets/main.png)

*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](https://huggingface.co/Qwen/Qwen3-4B-Thinking-2507) |
| Parameters stored | 4,022,468,096 |
| Training | Full-parameter supervised fine-tuning |
| Source pair configuration | [`subset_1_8`](https://huggingface.co/datasets/Word2Li/CoTranslator-Nemotron-SFT-Math-v4-Pairs) |
| Rows in the source JSONL | 33,286, before training preprocessing and packing |
| Checkpoint step | 616 |
| Weights | BF16, two Safetensors shards |

The companion translator is [CoTranslator-4B-Full](https://huggingface.co/Word2Li/CoTranslator-4B-Full).

## 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:

```text
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.
```

```text
<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.

```bash
pip install -U transformers accelerate torch datasets
```

This example translates the input trajectory from one released training pair:

```python
import torch
from datasets import load_dataset
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "Word2Li/CoTranslator-4B"
data = load_dataset(
    "Word2Li/CoTranslator-Nemotron-SFT-Math-v4-Pairs", "subset_1_8",
    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](https://huggingface.co/Qwen/Qwen3-4B-Thinking-2507/blob/main/LICENSE). Training data attribution and source-specific data licenses are described in the [paired dataset card](https://huggingface.co/datasets/Word2Li/CoTranslator-Nemotron-SFT-Math-v4-Pairs).