jingyaogong/minimind-v

👀 Train a 65M-parameter VLM from scratch in just 2h!

What it solves

MiniMind-V provides a lightweight, accessible way to build and train a Vision Language Model (VLM). It solves the high barrier to entry for VLM development by offering a minimal implementation that can be trained on a single consumer GPU (like an NVIDIA 3090) in a very short time and at a very low cost.

How it works

MiniMind-V extends a small language model (MiniMind) by adding a Visual Encoder and a projection module.

  • Visual Encoder: It uses the SigLIP2 model to extract image features, converting an image into a set of visual tokens.
  • Projection Module: An MLP (Multi-Layer Perceptron) projector translates these visual features into the semantic space of the language model, effectively acting as a "dictionary" that translates images into a language the LLM understands.
  • Training: The process involves two stages: an optional Pretrain stage to align visual tokens with language tokens (training only the projector) and a mandatory SFT (Supervised Fine-Tuning) stage to refine the model's ability to follow instructions and describe images (training the projector and the first/last layers of the LLM).

Who it’s for

  • AI Learners: Those wanting a clear, jargon-light tutorial on how VLMs are structured and trained.
  • Individual Developers: People with limited hardware who want to experiment with multimodal models on personal GPUs.
  • Researchers: Those looking for a minimal, baseline implementation of the VLM paradigm.

Highlights

  • Extremely Lightweight: The smallest version has only 65M parameters, making it significantly smaller than GPT-3.
  • Low Cost: Can be trained for approximately 3 RMB (roughly $0.40) in 2 hours on a single RTX 3090.
  • Comprehensive Pipeline: Includes full code for dataset cleaning, pretraining, and SFT.
  • Flexible Architecture: Supports both dense and Mixture-of-Experts (MoE) modes.
  • Efficient Data Handling: Uses Parquet format for integrated image-text storage to speed up loading.

Related

  • Project
  • Dispatch
  • Dispatch
  • Dispatch
  • Project