HORnet: Task-Guided Frame Selection for Video Question Answering

April 19, 2026 ยท View on GitHub

arXiv Hugging Face Google Drive (Coming Soon)

HORnet is a reinforcement learning-based frame selection system for efficient video understanding. It uses GRPO (Group Relative Policy Optimization) to train a policy network that intelligently selects the most informative frames from videos, achieving up to 99% frame reduction and 93% faster processing with competitive accuracy on video question answering tasks.

Overview

HORnet learns to select a subset of frames from videos that maximize downstream task performance. The system consists of:

  • Frame Selector: A policy network trained with GRPO that outputs frame selection probabilities
  • Video Encoder: TimeSformer encoder for extracting spatio-temporal visual features
  • VLM Integration: Compatible with Qwen3-VL and other vision-language models

Installation

Prerequisites

# Create virtual environment
python -m venv env_hornet
source env_hornet/bin/activate

# Install dependencies
pip install torch torchvision transformers
pip install qwen-vl-utils
pip install trl tqdm loguru

For Evaluation with lmms-eval

Clone and install the lmms-eval library:

git clone https://github.com/EvolvingLMMs-Lab/lmms-eval.git
cd lmms-eval
pip install -e .

Model Weights

Pre-trained HORnet checkpoints are available on Hugging Face:

๐Ÿค— bishoygaloaa/HORnet

Download Checkpoints

# Install huggingface_hub
pip install huggingface_hub

# Download all checkpoints
huggingface-cli download bishoygaloaa/HORnet --local-dir ./checkpoints --repo-type model

# Or download specific checkpoints
huggingface-cli download bishoygaloaa/HORnet checkpoints/long/checkpoint-0.1500.pt --local-dir ./checkpoints --repo-type model

Available Checkpoints

CheckpointTraining SchemeUse CasePath
checkpoint-0.1500.ptLong videosMain model (used in lmms-eval)checkpoints/long/
checkpoint-0.250.ptLong videosMultiple-choice QA evaluationcheckpoints/long/
checkpoint-0.550.ptShort videosShort video QA (MSVD), VLM ablationcheckpoints/short/

Alternative: Checkpoints will also be available on Google Drive (Coming Soon)

Training

HORnet supports multiple training schemes and datasets:

Basic Training

python train.py \
  --num_frames 256 \
  --batch_size 8 \
  --save_eval_freq 500 \
  --num_epochs 1 \
  --n_samples 8 \
  --top_k 16 \
  --save_loc ./checkpoints \
  --scheme long

Training Schemes

  • Long videos: --scheme long (e.g., ActivityNet-QA)
  • Short videos: --scheme short (e.g., MSVD-QA)
  • SFT: Supervised fine-tuning with train_sft.py
  • PPO: Alternative RL training with train_ppo.py

SLURM Scripts

Pre-configured SLURM scripts are available in slurm/:

sbatch slurm/hornet_train.sh
sbatch slurm/hornet_train_sft.sh
sbatch slurm/hornet_train_ppo.sh

Evaluation

Using lmms-eval

  1. Add model files to your lmms-eval installation:

    • Copy lmms_eval_utils/hornet_q3vl.py โ†’ lmms-eval/lmms_eval/models/chat/
    • Copy lmms_eval_utils/qwen3_vl.py โ†’ lmms-eval/lmms_eval/models/chat/
    • Copy lmms_eval_utils/hornet.py โ†’ lmms-eval/lmms_eval/
  2. Update model registry in lmms-eval/lmms_eval/models/chat/__init__.py:

AVAILABLE_CHAT_TEMPLATE_MODELS = {
    "bagel_lmms_engine": "BagelLmmsEngine",
    "llava_hf": "LlavaHf",
    "qwen3_vl": "Qwen3_VL",
    "hornet_q3vl": "Hornet_Q3VL",  # Add this
    "qwen2_5_vl": "Qwen2_5_VL",
    # ... other models
}
  1. Run evaluation:
# Evaluate HORnet on ActivityNet-QA
python -m lmms_eval \
  --model hornet_q3vl \
  --tasks activitynetqa \
  --batch_size 1 \
  --output_path ./results/hornet_activitynetqa \
  --log_samples

# Evaluate baseline Qwen3-VL
python -m lmms_eval \
  --model qwen3_vl \
  --tasks activitynetqa \
  --batch_size 1 \
  --output_path ./results/qwen3_activitynetqa \
  --log_samples

Supported Benchmarks

  • ActivityNet-QA
  • MSVD-QA
  • MSRVTT-QA
  • NExT-QA
  • Video-MME

SLURM Evaluation Scripts

sbatch slurm/hornet_eval_vqa_act.sh  # ActivityNet-QA
sbatch slurm/hornet_eval_vqa_og.sh   # Other benchmarks
sbatch slurm/hornet_eval_ms.sh       # MSVD/MSRVTT

Results

Table 1: Research Gap

MethodLearned SelectionReward OptimizedFrozen VLMParam. Efficient
Uniform Samplingโœ—โœ—โœ“โœ“
SeViLAโœ“โœ—โœ—โœ—
Frame-Voyagerโœ“โœ—โœ—โœ—
F2Cโœ—โœ—โœ“โœ“
ReFoCUSโœ“โœ“โˆผโœ—
ViaRLโœ“โœ“โœ—โœ—
HORNet (Ours)โœ“โœ“โœ“โœ“

Table 2: Open-Ended QA Results

DatasetModelF1-Lev โ†‘Frame Sel. (s) โ†“Qwen Proc. (s) โ†“Avg. Frames โ†“
MSVDQwen3-VL-2B (Baseline)0.3483โ€“0.2811.65
MSVDHORNet+Qwen3-VL-2B (Ours)0.3543 (+1.7%)0.120.10 (โ†“64%)4.00 (โ†“66%)
MSRVTTQwen3-VL-2B (Baseline)0.3209โ€“0.5847.52
MSRVTTHORNet+Qwen3-VL-2B (Ours)0.3029 (-5.6%)0.090.09 (โ†“84%)4.00 (โ†“92%)
NextOEQwen3-VL-2B (Baseline)0.3045โ€“1.011157.88
NextOEHORNet+Qwen3-VL-2B (Ours)0.2738 (-10.1%)0.520.19 (โ†“81%)8.00 (โ†“99%)

Table 3: Multiple-Choice QA Results

DatasetModelAccuracy (%) โ†‘Frame Sel. (s) โ†“Qwen Proc. (s) โ†“Avg. Frames โ†“
VideoMMEQwen3-VL-2B (Baseline)68.30โ€“2.533066.73
VideoMMEHORNet+Qwen3-VL-2B (Ours)52.10 (-16.2%)1.510.18 (โ†“93%)8.00 (โ†“99%)
ActivityNetQAQwen3-VL-2B (Baseline)75.00โ€“2.373152.49
ActivityNetQAHORNet+Qwen3-VL-2B (Ours)68.80 (-6.2%)1.640.17 (โ†“93%)8.00 (โ†“99%)
NextQAQwen3-VL-2B (Baseline)76.80โ€“0.981157.88
NextQAHORNet+Qwen3-VL-2B (Ours)71.50 (-5.3%)0.530.25 (โ†“74%)8.00 (โ†“99%)

Table 4: Training Objective Ablation

TrainingMSVD (F1-Lev โ†‘)MSRVTT (F1-Lev โ†‘)
No training (baseline)0.34830.3209
SFT (weighted BCE)0.34950.2882
PPO (clipped surrogate)0.35850.2948
GRPO (Ours)0.35430.3029

Table 5: Frame Selection Strategy Ablation

StrategyMSVD (F1-Lev โ†‘)MSRVTT (F1-Lev โ†‘)NExT-QA (Acc. โ†‘)
Random0.35270.302765.88
Uniform0.34930.305864.24
HORNet0.35430.302971.50

Table 6: VLM Answerer Ablation on MSVD-QA

VLM AnswererSizeF1-Lev โ†‘
Qwen3-VL-Instruct (baseline)2B0.3483
Qwen3-VL-Instruct + HORNet2B0.3543
Qwen2.5-VL-Instruct + HORNet3B0.3846

Project Structure

hornet/
โ”œโ”€โ”€ model.py              # Core model architecture (VisionGRPOPolicy)
โ”œโ”€โ”€ train.py              # GRPO training script
โ”œโ”€โ”€ train_sft.py          # Supervised fine-tuning
โ”œโ”€โ”€ train_ppo.py          # PPO training
โ”œโ”€โ”€ reward.py             # Reward computation for RL
โ”œโ”€โ”€ dataset.py            # Dataset loaders
โ”œโ”€โ”€ evaluate.py           # Evaluation utilities
โ”œโ”€โ”€ vp.py                 # Video processing utilities
โ”œโ”€โ”€ util.py               # Helper functions
โ”œโ”€โ”€ slurm/                # SLURM job scripts
โ””โ”€โ”€ lmms_eval_utils/      # lmms-eval integration
    โ”œโ”€โ”€ hornet_q3vl.py    # HORnet + Qwen3-VL model
    โ”œโ”€โ”€ qwen3_vl.py       # Baseline Qwen3-VL
    โ””โ”€โ”€ hornet.py         # HORnet utilities

Key Features

  • Massive Efficiency Gains: Reduces frames by up to 99% (from 3000+ to 8 frames) with 74-93% faster VLM processing
  • Competitive Accuracy: Maintains or slightly improves accuracy on short videos (MSVD: +1.7%), with acceptable trade-offs on long videos
  • GRPO Training: Group-based policy optimization for stable RL training, outperforming SFT and competitive with PPO
  • TimeSformer Encoder: Lightweight spatio-temporal transformer for video feature extraction
  • Flexible Architecture: Compatible with various VLMs (Qwen3-VL, Qwen2.5-VL)
  • Benchmark Integration: Easy evaluation via lmms-eval library

Citation

If you use HORnet in your research, please cite:

@inproceedings{bai2026hornet,
  title     = {HORNet: Task-Guided Frame Selection for Video Question Answering with Vision-Language Models},
  author    = {Bai, Xiangyu and Galoaa, Bishoy and Ostadabbas, Sarah},
  booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW)},
  month={6},  
  year      = {2026}
}

License

See LICENSE file for details.

Acknowledgments

  • Built on top of lmms-eval
  • Uses TimeSformer architecture for efficient video encoding
  • Integrates with Qwen3-VL vision-language model