Instructions to use KidIkaros/qwen3.5-0.8b-loop-fix with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KidIkaros/qwen3.5-0.8b-loop-fix with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="KidIkaros/qwen3.5-0.8b-loop-fix") 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("KidIkaros/qwen3.5-0.8b-loop-fix") model = AutoModelForMultimodalLM.from_pretrained("KidIkaros/qwen3.5-0.8b-loop-fix", 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 KidIkaros/qwen3.5-0.8b-loop-fix with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KidIkaros/qwen3.5-0.8b-loop-fix" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KidIkaros/qwen3.5-0.8b-loop-fix", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/KidIkaros/qwen3.5-0.8b-loop-fix
- SGLang
How to use KidIkaros/qwen3.5-0.8b-loop-fix 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 "KidIkaros/qwen3.5-0.8b-loop-fix" \ --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": "KidIkaros/qwen3.5-0.8b-loop-fix", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "KidIkaros/qwen3.5-0.8b-loop-fix" \ --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": "KidIkaros/qwen3.5-0.8b-loop-fix", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use KidIkaros/qwen3.5-0.8b-loop-fix with Docker Model Runner:
docker model run hf.co/KidIkaros/qwen3.5-0.8b-loop-fix
Qwen3.5-0.8B โ loop-direction weight edit (independent diagnosis)
A weight-space edit of Qwen/Qwen3.5-0.8B that removes the thinking-loop failure of the base model. No training, no gradients: a single surgical change to 2 tensors, derived by an independent diagnosis (not copied from the source edit). Base model card (usage, vision, sampling): Qwen/Qwen3.5-0.8B.
Recreation of the Experiment 8 result in "Sparks of Weight-Space Programming" (Takehi, Teoh, Zhang, Khattab, Nov 2026). A bit-exact rebuild of their released edit is here (labelled reproduction).
The failure
With thinking enabled (temp 0.6, top-p 0.95, top-k 20, presence penalty 1.5), the base model loops semantically: it re-derives the same reasoning step in different words ("Wait, $30-6=24$. Wait, $30-6=24$. ...") with zero exact n-gram repetition, and burns its whole token budget. On 18 unseen train problems (16 GSM8K + 2 MATH, 16,384-token cap): only 2/18 (11%) closed their thinking. Presence penalty 1.5 vs 0 makes no difference โ the failure is in the weights.
The edit
For exactly 64 intermediate neurons per layer (the top-64 by |mean activation
difference| between looping and finished-thinking contexts), in
layers.15.mlp.down_proj and layers.19.mlp.down_proj:
W[:, j] <- W[:, j] - 6 * (W[:, j] . d_hat) * d_hat
where d is our diagnosed loop direction (mean MLP-output difference between looping
and productive contexts, mapped through down_proj and normalized; see diagnosis.json).
This over-corrects each chosen column to 6x past orthogonality with the direction โ the
same form as the source paper's edit, with a direction recovered independently
(cos 0.35 / 0.45 vs. theirs; the loop subspace is evidently robust to which direction
you pick at this strength). 131,072 weight values touched (0.016% of the model);
embeddings, output head and final norm untouched.
Measured effect (18 problems, 1 sample, fp16, HF generate)
| model | thinking closed | boxed answer | correct |
|---|---|---|---|
| base | 2/18 (11%) | 2/18 | โ |
| this edit | 15/18 (83%) | 14/18 | 12/18 (67%) |
| paper's edit (reproduction) | 17/18 (94%) | 14/18 | 12/18 (67%) |
13 of the 16 base-model loopers were rescued; no regressions. Small-n caveat: 18 problems, 1 sample each โ this is a mechanism replication, not a benchmark score.
Diagnosis details
Layer 15: cos(ours, paper's direction) = 0.350. Layer 19: 0.449. The paper's direction
is available in their logs repo (RikiyaT/lm_understand-logs, exp8_math). Full procedure
and logs: agent-driven recreation on Kaggle T4s; the edit was applied with the paper's
own apply_edit.py conventions (bf16 rounding).
Usage
Same as the base model; thinking mode is where the difference shows:
prompt = tok.apply_chat_template(messages, tokenize=False,
add_generation_prompt=True, enable_thinking=True)
Sampling: temperature 0.6, top_p 0.95, top_k 20, max 16384-32768 tokens.
- Downloads last month
- -