Implementation of See-Think-Learn (STL) Self-Training Framework for Multimodal Large Language Models
To setup the environment, follow these steps:
This STL framework builds on top of the LLaVA codebase. First, clone the official LLaVA repo:
git clone https://github.com/haotian-liu/LLaVA.git
cd LLaVAPlace the following folders into the cloned LLaVA directory:
stl/— contains the STL training logic and scripts.playground/data/folder/— contains the data files (questions,answers, etc.).scripts/— contains bash scripts for training and inference
Make sure to add the images from the M3CoT to the playground/data/m3cot/images/ folder inside your cloned LLaVA directory.
To run this project, begin by following the environment setup instructions provided in the official LLaVA repository. This includes installing required dependencies and setting up the training environment.
We provide a helper script to set up your Conda environment, project path, and CUDA paths.
Open scripts/start.sh and configure the following:
# Activate Conda environment
source /your/conda/path/bin/activate
conda activate lava
# Navigate to the LLaVA project directory
cd /your/path/to/LLaVA
# CUDA path configuration (modify as per your installation)
export PATH=/your/cuda/path/bin:$PATH
export LD_LIBRARY_PATH=/your/cuda/path/lib64:$LD_LIBRARY_PATH
# (Optional) Weights & Biases API Key
# export WANDB_API_KEY=your_wandb_api_key_hereRun the script
bash scripts/start.shAll experiments were conducted on a single NVIDIA A6000 GPU (48GB VRAM) using CUDA 12.4. Further, xformers implementation is used for Lora finetuning instead of flash-attention.
Download the LLaVA-v1.5-7B .zip file from the provided Google Drive link. 👉 Download from Google Drive
Once downloaded, extract the content and place it inside the models/ folder within the LLaVA directory:
LLaVA/
├── models/
│ └── llava-v1.5-7bThis guide describes how to run the See-Think-Learn (STL) self-training pipeline on various domains of the M3CoT dataset using the ours.sh script.
We have conducted experiments on the following four domains from the M3CoT dataset:
commonsensescience_naturalscience_socialscience_language
To perform training and evaluation with the STL framework, execute the script scripts/ours.sh with the desired domain and maximum number of iterations.
The ours.sh script automates the full STL process for each iteration. Internally, it sequentially runs:
ours-part1.sh: Positive sample generationours-neg.sh: Negative sample generationours-part2.sh: Model training and evaluation
bash scripts/ours.sh <domain> <max_iteration><domain>: One of the supported domains (commonsense,science_natural,science_social,science_language)<max_iteration>: Total number of STL iterations to perform (e.g.,5)
To train on the commonsense domain for 5 STL iterations:
bash scripts/ours.sh commonsense 5This will run all STL phases for 5 iterations on the specified domain.