How sithum02/vlm-token-budget works
This repository is a training-free visual-token reduction study for small vision-language models. The main workflow loads POPE, TextVQA, or MME examples, encodes each image, reduces its visual tokens with matched-budget strategies, generates answers, and scores the results. Separate analysis tools test paired significance, summarize results, visualize kept tokens, and benchmark runtime. The excerpts show the evaluation orchestration and several analysis relationships; benchmark internals and some model methods were not sampled, so those links are included only where documented by the README.
Main entry points: run_eval.py Experiment runner · visualize_tokens.py Token visualization · results Prediction results · data.py Task loaders
Components 17
Benchmark inputs
- Task loaders
tokenbudget/data.py
Model inference
- Experiment runner
run_eval.py - VLM adapter
tokenbudget/models.py - Image encoding
tokenbudget/models.py - Attention scoring
tokenbudget/models.py - Token reducers
tokenbudget/reducers.py - Answer generation
tokenbudget/models.py
Scoring and analysis
- Task metrics
tokenbudget/metrics.py - Compute estimates
tokenbudget/flops.py - Prediction results
results - Paired bootstrap
tools/significance.py - Result summaries
tools/summarize.py - Hardware benchmark
tools/benchmark.py
Study inspection
- Token visualization
tools/visualize_tokens.py
Other components
- Researcher
- Dataset Hub
- Local GPU
Connections 22
- Researcher → Experiment runner: runs study
README.md - Dataset Hub → Task loaders: provides datasets
tokenbudget/data.py - Task loaders → Experiment runner: yields examples
run_eval.py - Experiment runner → VLM adapter: loads model
run_eval.py - Experiment runner → Image encoding: encodes images
run_eval.py - Experiment runner → Attention scoring: requests scores
run_eval.py - Experiment runner → Token reducers: reduces tokens
run_eval.py - Experiment runner → Answer generation: requests answers
run_eval.py - Experiment runner → Task metrics: scores predictions
run_eval.py - Experiment runner → Compute estimates: estimates cost
run_eval.py - Experiment runner → Prediction results: writes results
run_eval.py - Prediction results → Paired bootstrap: resamples results
tools/significance.py - Paired bootstrap → Task metrics: uses scorers
tools/significance.py - Prediction results → Result summaries: collects scores
tools/summarize.py - Result summaries → Task metrics: uses task definitions
tools/summarize.py - Researcher → Hardware benchmark: benchmarks runtime
README.md - Researcher → Token visualization: inspects tokens
tools/visualize_tokens.py - Token visualization → VLM adapter: encodes and answers
tools/visualize_tokens.py - Token visualization → Token reducers: applies methods
tools/visualize_tokens.py - Token visualization → Task loaders: loads POPE sample
tools/visualize_tokens.py - Local GPU → VLM adapter: executes inference
- Local GPU → Hardware benchmark: measures runtime