Text Generation
Transformers
Safetensors
English
qwen3_5
image-text-to-text
reasoning
math
metacognition
sft
conversational
Instructions to use 12kimih/Qwen3.5-4B-MBT-R with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 12kimih/Qwen3.5-4B-MBT-R with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="12kimih/Qwen3.5-4B-MBT-R") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("12kimih/Qwen3.5-4B-MBT-R") model = AutoModelForMultimodalLM.from_pretrained("12kimih/Qwen3.5-4B-MBT-R", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use 12kimih/Qwen3.5-4B-MBT-R with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "12kimih/Qwen3.5-4B-MBT-R" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "12kimih/Qwen3.5-4B-MBT-R", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/12kimih/Qwen3.5-4B-MBT-R
- SGLang
How to use 12kimih/Qwen3.5-4B-MBT-R 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 "12kimih/Qwen3.5-4B-MBT-R" \ --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": "12kimih/Qwen3.5-4B-MBT-R", "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 "12kimih/Qwen3.5-4B-MBT-R" \ --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": "12kimih/Qwen3.5-4B-MBT-R", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use 12kimih/Qwen3.5-4B-MBT-R with Docker Model Runner:
docker model run hf.co/12kimih/Qwen3.5-4B-MBT-R
|
Download README.md from 12kimih/Qwen3.5-4B-MBT-R: direct link, hf CLI and curl.
- Browser
- Download file 2.94 kB
-
https://huggingface.co/12kimih/Qwen3.5-4B-MBT-R/resolve/main/README.md
- Command line
-
hf download hf://12kimih/Qwen3.5-4B-MBT-R/README.md
-
curl -L -o README.md https://huggingface.co/12kimih/Qwen3.5-4B-MBT-R/resolve/main/README.md
2.94 kB
| license: apache-2.0 | |
| base_model: Qwen/Qwen3.5-4B-Base | |
| base_model_relation: finetune | |
| datasets: | |
| - 12kimih/mbt-traces | |
| language: | |
| - en | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: | |
| - reasoning | |
| - math | |
| - metacognition | |
| - sft | |
| # Qwen3.5-4B-MBT-R | |
| [Qwen/Qwen3.5-4B-Base](https://huggingface.co/Qwen/Qwen3.5-4B-Base) fine-tuned on traces edited by MBT-R: the editor rewrites the whole trace in one call. | |
| It accompanies the paper **"Distilling Metacognitive Behaviors through Agentic Editing"**. | |
| | Model | Training data | | |
| |---|---| | |
| | [Qwen3.5-4B-Unedited-SFT](https://huggingface.co/12kimih/Qwen3.5-4B-Unedited-SFT) | Unedited teacher traces | | |
| | [Qwen3.5-4B-MBT-R](https://huggingface.co/12kimih/Qwen3.5-4B-MBT-R) | MBT-R (rewrite) | | |
| | [Qwen3.5-4B-MBT-I](https://huggingface.co/12kimih/Qwen3.5-4B-MBT-I) | MBT-I (insert) | | |
| | [Qwen3.5-4B-MBT-A](https://huggingface.co/12kimih/Qwen3.5-4B-MBT-A) | MBT-A (agentic) | | |
| Training data: built from the traces in | |
| [`12kimih/mbt-traces`](https://huggingface.co/datasets/12kimih/mbt-traces). | |
| Code and prompts: | |
| [GitHub](https://github.com/12kimih/metacognitive-behavioral-tuning). | |
| ## Usage | |
| The chat template that ships with the model opens a `<think>` block, so the generated text is the | |
| reasoning, then `</think>` and the answer. End the question with the instruction used in training: | |
| ```python | |
| from vllm import LLM, SamplingParams | |
| llm = LLM("12kimih/Qwen3.5-4B-MBT-R") | |
| question = "Find the remainder when 2^100 is divided by 7." | |
| prompt = question + "\n\nPlease reason step by step, and put your final answer within \\boxed{}." | |
| params = SamplingParams(temperature=1.0, top_p=0.95, max_tokens=122880) | |
| out = llm.chat([{"role": "user", "content": prompt}], params) | |
| print(out[0].outputs[0].text) | |
| ``` | |
| The weights are bf16. Long answers are common, so leave room for tens of thousands of tokens. | |
| ## Training | |
| | Setting | Value | | |
| |---|---| | |
| | Base model | Qwen/Qwen3.5-4B-Base | | |
| | Method | Full-parameter supervised fine-tuning, loss on assistant tokens only | | |
| | Epochs | 15 | | |
| | Optimizer | Muon (Megatron implementation), learning rate 1e-5, weight decay 0 | | |
| | Schedule | Constant with 40 warmup steps | | |
| | Global batch | 64 sequences (8 GPUs x 8 accumulation steps), padding-free packing | | |
| | Maximum length | 131,072 tokens | | |
| | Precision | bf16 autocast with fp32 master weights; released in bf16 | | |
| ## License | |
| Apache-2.0, following the base model. The training data is CC BY-SA 4.0; see the dataset card for | |
| upstream attribution. | |
| ## Citation | |
| ```bibtex | |
| @misc{kim2026distilling, | |
| title = {Distilling Metacognitive Behaviors through Agentic Editing}, | |
| author = {Kim, Ik-hwan and Han, Hyeongrok and Jung, Mingi and Yu, Sangwon and Hong, Jinseok and Kim, Sang Hun and Choi, Yoonyoung and Yoon, Sungroh}, | |
| year = {2026}, | |
| eprint = {2602.22508}, | |
| archivePrefix = {arXiv}, | |
| primaryClass = {cs.AI}, | |
| url = {https://arxiv.org/abs/2602.22508} | |
| } | |
| ``` | |