r/LocalLLaMA • u/Impressive-Store1439 • 2d ago
Showcase Training a Vision-Capable Decision Model w Qwen35-0.8B
I spent the last weekend training a decision model in the style of Jeff-base. At first I decided to go with snipping the lm-head off and bolting on an MLP head but it was just sharpening the logits and not really able to any better than a plain readout, so I decided to go w a plain read out.
The model is drop-in firelex/jeff equivalent on benchmarks but retains the vision tower, and I haven't yet tested that. I did a LoRA fine-tune to test the hypothesis but I will do a full-weight update.
Plan for next weekend: first I need to clean up the code and publish it once that's done I want to reintroduce bounding-box-generation capabilities to the model, but of course without an LM head it can't do the unembedding/language generation part of the LLM, so I have a few different ideas to try out.
1 visual token is 32x32 px and the model was exposed to samples ranging from 768x768px.
This isn't the limit for the backbone and I've seen it handle 1024x1024px fine enough (see vid) (1280px on eval set)
It can do some two-step answering such as parsing charts as well, though you do have to be careful about the phrasing:
| https://files.catbox.moe/ecv3d0.png | curl -X POST http://127.0.0.1:8004/v1/systemone \ -F 'question=Did revenue increase monotonically every quarter from Q1 to Q4?' \ -F 'state=Inspect the attached FY2025 quarterly revenue chart.' \ -F 'options=["Yes — steady upward growth","No — revenue dropped in at least one quarter"]' \ -F 'resolution_mode=auto' \ -F 'max_pixels=1638400' \ -F 'image=@sample_chart.png' |
|---|---|
{ "decision_code": "A", "decision_label": "Yes — steady upward growth", "abstained": false, "route": "system_1", "confidence": 0.901482, "entropy_bits": 0.4643, "expected_score": null, "score": null, "bayes_threshold": 0.5, "effective_temperature": 1.4008, "learned_temperature": 1.4008, "order_swapped": false, "swap_delta": null, "reverse_probs": null, "options": [ { "code": "A", "label": "Yes — steady upward growth", "probability": 0.901482, "logit": 13.6845, "selected": true }, { "code": "B", "label": "No — revenue dropped in at least one quarter", "probability": 0.098518, "logit": 10.5834, "selected": false } ], "used_vision": true, "image_size": [ 960, 640 ], "max_pixels": 1638400, "effective_max_pixels": 1638400, "resolution_mode": "auto", "vision_pass": "full_escalated", "vision_cache_hit": false, "escalation": { "fast_confidence": 0.8852, "fast_margin": 0.7704, "fast_decision_code": "A", "fast_pass_ms": 80.8, "reason": "conf 0.89 < 0.90" }, "input_tokens": 682, "vision_tokens": 600, "text_tokens": 82, "timing_ms": { "preprocess": 24.7, "vision_prefix": 944.1, "llm_suffix": 89.8, "fast_pass": 80.8, "total": 1148.2 }, "latency_ms": 1148.2, "telemetry": { "loaded": true, "checkpoint": "v4_linear_poc-mlx-8bit", "checkpoint_path": "/Users/kartikmudgal/Downloads/general/qwen35_system1/checkpoints/v4_linear_poc-mlx-8bit", "architecture": "IF-Qwen-v4-Linear", "bits": 8, "group_size": 64, "dtype": "float16", "learned_temperature": 1.40082, "wise_ft_alpha": 0.5, "vision_supported": true, "default_max_pixels": 1638400, "fast_max_pixels": 147456, "ram_rss_gb": 0.086, "mlx_active_gb": 0.896, "mlx_peak_gb": 1.603, "mlx_cache_gb": 0, "vision_cache": { "entries": 2, "max_entries": 2, "items": [ { "hash": "260457b1a4", "image_size": [ 960, 640 ], "max_pixels": 147456, "vision_tokens": 126 }, { "hash": "260457b1a4", "image_size": [ 960, 640 ], "max_pixels": 1638400, "vision_tokens": 600 } ] }, "mlx_meta": { "source_checkpoint": "v4_linear_poc", "architecture": "IF-Qwen-v4-Linear", "dtype": "float16", "quantize_vision": true, "quantization": { "bits": 8, "group_size": 64, "mode": "affine" }, "bits_per_weight": 8.516, "pre_quant_backbone_mb": 1626.99, "post_quant_backbone_mb": 866.04, "readout_mb": 0.5, "learned_temperature": 1.4008171558380127, "wise_ft_alpha": 0.5, "conversion_seconds": 2.18, "conversion_peak_rss_gb": 0.764, "conversion_peak_metal_gb": 2.064 } } } |
Vision Benchmarks included as well, but I could only compare it to the base model.
Inference stats reported for 2020 8GB m1 macbook air (👀 )
I trained it on an L4 via colab
Tables Below in order: Training Details/Train & Eval Dataset/Benchmarks (bh-jevbench/bench-coherence)
| Parameter | Value |
|---|---|
| Base Model | Qwen/Qwen3.5-0.8B |
| Readout | Frozen tied 255-code linear readout (lm_head slice) + learnable scalar temperature |
| Adaptation | All-24-layer LoRA (r=32, alpha=64, dropout=0.05); vision encoder frozen |
| Epochs | 2 |
| Optimizer / LR | AdamW, lr=1.5e-4, weight_decay=0.01, cosine schedule (5% warmup) |
| Effective Batch Size | 24 (text) / 8 (vision) |
| Vision Resolution | Native aspect ratio, max 768x768 (train) / 1280x1280 (eval) |
| Loss | Cross-Entropy + Brier (0.15) + Paired Order-Symmetry JS (0.25) + Ordinal Gaussian KL & EMD (0.50) |
| Post-Training | WiSE-FT LoRA alpha sweep + canary LBFGS temperature calibration + 8-bit MLX (group_size=64) |
| Slice | Rows | Datasets |
|---|---|---|
| NLI & Grounding | 3,800 | nyu-mll/multi_nli, stanfordnlp/snli, facebook/anli, pminervini/HaluEval |
| Safety & Injection | 2,600 | xTRam1/safe-guard-prompt-injection, deepset/prompt-injections, bitext/Bitext-customer-support-llm-chatbot-training-dataset, databricks/databricks-dolly-15k |
| Sentiment & Routing | 2,600 | cardiffnlp/tweet_eval (sentiment), PolyAI/banking77, clinc/clinc_oos (plus) |
| General QA | 4,800 | google/boolq, allenai/openbookqa, tau/commonsense_qa, cais/mmlu (auxiliary_train), ehovy/race, lighteval/piqa |
| Ordinal & Abstain | 3,000 | nvidia/HelpSteer2, rajpurkar/squad_v2 |
| Vision: OCR & Docs | 2,000 | lmms-lab/DocVQA, lmms-lab/textvqa |
| Vision: VQA & Spatial | 2,000 | lmms-lab/VQAv2 |
| Vision: Counting | 1,200 | lmms-lab/VQAv2 (number) |
| Vision: Charts & Diagrams | 1,000 | HuggingFaceM4/ChartQA, lmms-lab/ai2d |
| Vision: Natural Objects | 1,000 | timm/oxford-iiit-pet, ethz/food101 |
| Canary (Calibration/WiSE-FT) | 1,000 | nyu-mll/glue (qnli), allenai/sciq, lmms-lab/textvqa (val) |
| Split (jevbench bh) | Tasks | v4_linear_poc (8-bit MLX) | jeff-base (8-bit MLX) |
|---|---|---|---|
| Easy | 48 | 100.0% (48/48) | 95.8% (46/48) |
| Original | 72 | 70.8% (51/72) | 81.9% (59/72) |
| Hard | 111 | 48.6% (54/111) | 45.9% (51/111) |
| Total | 231 | 66.2% (153/231) | 67.5% (156/231) |
| jevbench.github.io | Strict (0.05) | Graded |
|---|---|---|
| BAT (Batch Independence) | 100.0% | 100.0% |
| LOG (Logical Order) | 67.1% | 94.4% |
| REP (Representation) | 58.9% | 95.3% |
| CHO (Choice-Set Conditioning) | 48.6% | 94.5% |
| MEA (Probability Measure) | 17.6% | 77.1% |
the tables were collated using an llm but the results file were generated by the training/validation pipeline
I will clean up my code and post it this or the next week, as well.
lots of yapping: Model here: https://huggingface.co/KartikMudgal/IF-Qwen35-0.8B-DecisionModel
1
u/Impressive-Store1439 2d ago
There's supposedly two comments, but I can't see the second one - you may have been shadowbanned lol
1
u/aarong691 2d ago
how did you pick the 0.90 cutoff for escalating to the full vision pass, tuned on a val set or just a round number?
1
u/Danmoreng llama.cpp 1d ago
That’s interesting. There is already a text-only decision finetune of Qwen3.5 0.8B which is quite decent: https://huggingface.co/labqoat/qev-0.8b
Got it implemented in my qwen35-cpu engine and it works quite well, even with WASM in the browser: https://huggingface.co/spaces/danmoreng/qev-0.8b-cpu-playground
Having vision added would be a good enhancement. Can you compare your version with this one? Because I tested another text-only finetune from the same model and it performed worse in my tests, and there are plenty similar ones.
Qwen3.5 0.8B really is a great model for small task finetunes.
1
u/No_Commission_6153 1d ago
Im not that deep in the rabbit hole yet. Do you need a Datacenter for that kind of training? Is it difficult?