This recipe provides step-by-step guidance for the cold-start stage of InftyThink+.
For each data instance, we partition the original reasoning process (
python3 to_jsonl.py # save dataset in jsonl format
python3 segmentation.py -d ./OpenThoughts-114k.jsonl -o ./OpenThoughts-114k-seg-6k.jsonl # partitionFor each reasoning segment, we construct a concise summary that distills its key insights and reflects the incremental progress toward the final solution. We adopt a high-capacity foundation model M for summary generation, specifically, Qwen3-4B-Instruct-2507. All summaries are generated using carefully designed prompts.
python3 inftythink_runner.py -m Qwen/Qwen3-4B-Instruct-2507 -i ./OpenThoughts-114k-seg-6k.jsonl -o ./OpenThoughts-114k-seg-6k-out.jsonl --max_compression_tokens 1024Based on the segmented reasoning traces and their corresponding summaries, we construct a set of training instances that explicitly supervise the model to perform iterative reasoning with intermediate summarization.
python3 format_inftythink.py -i ./OpenThoughts-114k-seg-6k-out.jsonl -o ./OpenThoughts-114k-seg-6k-inftythink-train.jsonlWe use ms-swift as our SFT training backend.
cd ms-swift
# please refer to https://swift.readthedocs.io/zh-cn/latest/ to setup the training environment
export MODELSCOPE_CACHE=xxx
export MEGATRON_LM_PATH=xxx
python3 auto_train.py -c examples/config/DeepSeek-R1-Distill-Qwen-1.5B-OpenThoughts-114k-vanilla-bs8.json # for vanilla
python3 auto_train.py -c examples/config/DeepSeek-R1-Distill-Qwen-1.5B-OpenThoughts-114k-inftythink-6k-bs8.json # for InftyThink