How jytmelon/g-prune works
G-Prune is a training-free visual-token pruning framework integrated into LLaVA-NeXT. The main evaluation path loads a multimodal model, prepares a question and image input, and invokes generation; within the model, visual features are encoded, resampled/projected, and combined with language-model processing. The README describes graph-based visual-token pruning and evaluation, while the tree also shows interleave and video evaluation areas. Some of those paths were not sampled, so their internal call relationships are not asserted here.
Main entry points: model_vqa.py VQA evaluation · multimodal_resampler/builder.py Resampler selection · llava_arch.py Multimodal architecture · multimodal_encoder/builder.py Vision encoder selection
Components 21
Evaluation and prompts
- VQA evaluation
LLaVA-NeXT/llava/eval/model_vqa.py - Interleave evaluation
LLaVA-NeXT/llava/eval/evaluate_interleave.py - Conversation formatting
LLaVA-NeXT/llava/conversation.py - Image preparation
LLaVA-NeXT/llava/mm_utils.py - Answer output
Model loading
- Model loader
LLaVA-NeXT/llava/model/builder.py
Visual processing
- Vision encoder selection
LLaVA-NeXT/llava/model/multimodal_encoder/builder.py - CLIP encoder
LLaVA-NeXT/llava/model/multimodal_encoder/clip_encoder.py - SigLIP encoder
LLaVA-NeXT/llava/model/multimodal_encoder/siglip_encoder.py - Resampler selection
LLaVA-NeXT/llava/model/multimodal_resampler/builder.py - Masked drop
LLaVA-NeXT/llava/model/multimodal_resampler/masked_drop.py - Perceiver resampler
LLaVA-NeXT/llava/model/multimodal_resampler/perceiver.py - Q-Former resampler
LLaVA-NeXT/llava/model/multimodal_resampler/qformer.py - Spatial pooling
LLaVA-NeXT/llava/model/multimodal_resampler/spatial_pool.py - Vision projector
LLaVA-NeXT/llava/model/multimodal_projector/builder.py - Pooler projector
LLaVA-NeXT/llava/model/multimodal_projector/pooler_projector.py
Multimodal inference
- Language model variants
LLaVA-NeXT/llava/model/language_model - Llama model core
LLaVA-NeXT/llava/model/language_model/modeling_llama.py - Multimodal architecture
LLaVA-NeXT/llava/model/llava_arch.py - Graph token pruning
LLaVA-NeXT/llava/model/llava_arch.py
Other components
- Evaluation input
Connections 20
- Evaluation input → VQA evaluation: provides questions
LLaVA-NeXT/llava/eval/model_vqa.py - VQA evaluation → Model loader: loads model
LLaVA-NeXT/llava/eval/model_vqa.py - VQA evaluation → Conversation formatting: formats prompt
LLaVA-NeXT/llava/eval/model_vqa.py - VQA evaluation → Image preparation: prepares images
LLaVA-NeXT/llava/eval/model_vqa.py - VQA evaluation → Answer output: writes answers
LLaVA-NeXT/llava/eval/model_vqa.py - Model loader → Language model variants: selects model
LLaVA-NeXT/llava/model/builder.py - Language model variants → Multimodal architecture: extends architecture
LLaVA-NeXT/llava/model/language_model/llava_llama.py - Language model variants → Llama model core: uses core
LLaVA-NeXT/llava/model/language_model/llava_llama.py - Multimodal architecture → Vision encoder selection: builds encoder
LLaVA-NeXT/llava/model/llava_arch.py - Multimodal architecture → Resampler selection: builds resampler
LLaVA-NeXT/llava/model/llava_arch.py - Multimodal architecture → Vision projector: builds projector
LLaVA-NeXT/llava/model/llava_arch.py - Vision encoder selection → CLIP encoder: selects encoder
LLaVA-NeXT/llava/model/multimodal_encoder/builder.py - Vision encoder selection → SigLIP encoder: selects encoder
LLaVA-NeXT/llava/model/multimodal_encoder/builder.py - Resampler selection → Masked drop: selects resampler
LLaVA-NeXT/llava/model/multimodal_resampler/builder.py - Resampler selection → Perceiver resampler: selects resampler
LLaVA-NeXT/llava/model/multimodal_resampler/builder.py - Resampler selection → Q-Former resampler: selects resampler
LLaVA-NeXT/llava/model/multimodal_resampler/builder.py - Resampler selection → Spatial pooling: selects resampler
LLaVA-NeXT/llava/model/multimodal_resampler/builder.py - Vision projector → Pooler projector: uses pooler
LLaVA-NeXT/llava/model/multimodal_projector/builder.py - Multimodal architecture → Graph token pruning: prunes visual tokens
README.md - Evaluation input → Interleave evaluation: submits evaluation