image

🧠 Qwen3.5-9B-Trace-Inversion

This repository contains a fully merged, standalone model based on Qwen/Qwen3.5-9B.

It was fine-tuned on the Trace-Inversion-1K-Preview dataset to master a specific technique called Trace Inversion.

🎯 What does this model do?

Instead of solving a problem from scratch, this model acts as a Reasoning Generator. You provide it with a problem and its known correct final answer, and it reconstructs the step-by-step logical reasoning (<think>...</think>) that connects the two.

This 9B version is significantly more capable than its 4B predecessor and is highly useful for:

  1. Distilling reasoning capabilities from massive models (like DeepSeek V4 or Claude Opus) into smaller 9B architectures.
  2. Data Augmentation: Generating synthetic Chain-of-Thought traces for existing datasets.
  3. Behavioral Cloning: Teaching small models how to structure their thoughts before answering, with better logic retention than smaller models.

🚀 How to use

Since this is a full model, you can load and use it directly with the standard transformers library.

(Note: Qwen3.5 models require explicit eos_token_id settings to prevent infinite <|im_end|> looping. The code below handles this correctly).

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "open-zzrl/Qwen3.5-9B-Trace-Inversion"

# 1. Load Model and Tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id, 
    torch_dtype=torch.bfloat16, 
    device_map="auto"
)
model.eval()

# 2. Prepare the prompt (Question + Known Answer)
problem = "How many trailing zeros are there in 100! (100 factorial)?"
known_answer = "24"

messages = [
    {"role": "user", "content": f"Question: {problem}\n\nAnswer: {known_answer}"}
]

inputs = tokenizer.apply_chat_template(
    messages, 
    tokenize=True, 
    add_generation_prompt=True, 
    return_tensors="pt"
).to(model.device)

# 3. Generate the reasoning
with torch.no_grad():
    outputs = model.generate(
        inputs, 
        max_new_tokens=2048, 
        temperature=0.6,
        do_sample=True,
        # CRITICAL: Prevents infinite <|im_end|> spam
        eos_token_id=tokenizer.convert_tokens_to_ids("<|im_end|>"),
        pad_token_id=tokenizer.pad_token_id
    )

# 4. Decode and print
generated_text = tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True)
print(generated_text)

⚠️ Limitations & Caveats

  1. Do not evaluate on standard benchmarks (AIME, MATH-500, HumanEval). These benchmarks were part of the training data. The model will likely score artificially high, not because it learned to generalize, but because it memorized the traces.
  2. It is not a general-purpose solver. This model expects the answer to be provided in the prompt. If you ask it to solve a problem without giving it the answer, it will likely fail.
  3. 9B Parameter Behavior. The 9B model shows excellent reasoning capabilities, successfully handling advanced university-level math (e.g., Legendre's formula) and complex algorithmic logic (e.g., Two Pointers). However, it may still occasionally double-count or make logical leaps on extremely tricky combinatorial problems.
  4. Qwen Native Tags. The dataset and this model use Qwen's native <think> and </think> tags.

📊 Training Details

  • Base Model: Qwen/Qwen3.5-9B
  • Dataset: open-zzrl/Trace-Inversion-1K-Preview (932 examples)
  • Epochs: 2
  • Max Sequence Length: 8192
  • Format: Fully merged 16-bit (BF16)
  • Framework: Unsloth
Downloads last month
18
Safetensors
Model size
9B params
Tensor type
F32
·
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for open-zzrl/Qwen3.5-9B-Trace-Inversion

Finetuned
Qwen/Qwen3.5-9B
Finetuned
(1,260)
this model

Dataset used to train open-zzrl/Qwen3.5-9B-Trace-Inversion

Collection including open-zzrl/Qwen3.5-9B-Trace-Inversion