Back to directory

Thinking with Visual Primitives — PyTorch Implementation

An unofficial PyTorch reproduction of DeepSeek's method for teaching multimodal LLMs to reason with bounding boxes and points interleaved directly in their chain of thought.

Thinking with Visual Primitives — PyTorch Implementation

This project implements a multi-stage training pipeline that teaches multimodal LLMs to reason with bounding boxes and points as first-class "thought units," interleaving spatial coordinates within chain-of-thought text to close what the authors call the Reference Gap in visual reasoning.

Training runs in three stages: pretraining a base model to output the visual-primitive format, specialized supervised fine-tuning of separate box-grounding and point-grounding experts, and on-policy distillation of both experts into one unified model. Because of compute constraints, every stage in this reproduction uses LoRA fine-tuning rather than full-parameter training, so the results are presented as a feasibility check rather than a state-of-the-art claim.

Pretrained checkpoints for each stage, built on Qwen2VL-2B, are published on Hugging Face. It is written in Python with PyTorch and is MIT licensed.

More in Models

See all 405
  • mini-AGI

    github.com

    A continual learning language model that trains from scratch on a single 8 GB VRAM GPU, assembling its own architecture and adapting its size to the hardware and data available rather than shipping as a fixed pretrained model.

  • An open-source contrastive-embedding pipeline that maps technical CVE vulnerability descriptions to formal cybersecurity compliance controls in NIST SP 800-53 and CMMC, published with its model generation, fine-tuning and evaluation code.

  • peekaboolean

    github.com

    A small vision-language model, fine-tuned with LoRA on a 500-million-parameter backbone, that answers typed multiple-choice, ordinal-score and yes/no questions about an image with calibrated probabilities, in about 400 milliseconds on a laptop.