README.md

April 15, 2026 ยท View on GitHub

logo HERMES

[ACL 2026] KV Cache as Hierarchical Memory for Efficient Streaming Video Understanding

Project Page Paper HF Paper

๐Ÿ”ฅ News

  • [2026.04.06] HERMES is accepted to ACL 2026 Main ๐ŸŽ‰
  • [2026.03.23] Full code released!
  • [2025.01.23] HERMES reached #3 Paper of the day on Hugging Face Daily Papers!
  • [2025.01.21] HERMES is available on arXiv.

๐Ÿ› ๏ธ Installation

For LLaVA model inference:

conda create -n hermes-llava python=3.12 -y
conda activate hermes-llava
pip install -r requirements_llava.txt
pip install flash-attn --no-build-isolation

For Qwen2.5-VL model inference:

conda create -n hermes-qwen python=3.12 -y
conda activate hermes-qwen
pip install -r requirements_qwen.txt
pip install flash-attn --no-build-isolation

๐Ÿ“ฆ Preparation

Model Preparation

Create a models directory and download the model weights from HuggingFace:

mkdir models

We support the following models (choose one or more):

Model FamilyModelHuggingFace Link
LLaVA-OneVisionllava-onevision-qwen2-0.5b-ov-hfllava-hf/llava-onevision-qwen2-0.5b-ov-hf
LLaVA-OneVisionllava-onevision-qwen2-7b-ov-hfllava-hf/llava-onevision-qwen2-7b-ov-hf
LLaVA-OneVisionllava-onevision-qwen2-72b-ov-hfllava-hf/llava-onevision-qwen2-72b-ov-hf
Qwen2.5-VLQwen2.5-VL-3B-InstructQwen/Qwen2.5-VL-3B-Instruct
Qwen2.5-VLQwen2.5-VL-7B-InstructQwen/Qwen2.5-VL-7B-Instruct
Qwen2.5-VLQwen2.5-VL-32B-InstructQwen/Qwen2.5-VL-32B-Instruct

Data Preparation

Download the benchmark videos from their official sources and place them according to the paths specified in the annotation files:

Streaming Benchmarks:

BenchmarkVideo PathOfficial Source
StreamingBench/data/streamingbench/videos/๐Ÿค— StreamingBench
OVO-Bench/data/ovobench/videos/๐Ÿค— OVO-Bench
RVS-Ego/data/rvs/ego/videos/๐Ÿค— RVS
RVS-Movie/data/rvs/movie/videos/๐Ÿค— RVS

Offline Benchmarks:

BenchmarkVideo PathOfficial Source
VideoMME/data/videomme/videos/๐Ÿค— VideoMME
MVBench/data/mvbench/videos/๐Ÿค— MVBench
EgoSchema/data/egoschema/videos/๐Ÿค— EgoSchema

The annotation JSON files contain the same information as officially provided, with formatting adjustments to adapt to our codebase.

After preparation, the project structure should look like this:

HERMES/
โ”œโ”€โ”€ asset/
โ”‚   โ””โ”€โ”€ logo.png
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ egoschema/
โ”‚   โ”‚   โ”œโ”€โ”€ videos/
โ”‚   โ”‚   โ””โ”€โ”€ egoschema.json
โ”‚   โ”œโ”€โ”€ mvbench/
โ”‚   โ”‚   โ”œโ”€โ”€ videos/
โ”‚   โ”‚   โ””โ”€โ”€ mvbench.json
โ”‚   โ”œโ”€โ”€ ovobench/
โ”‚   โ”‚   โ”œโ”€โ”€ videos/
โ”‚   โ”‚   โ””โ”€โ”€ ovobench_realtime_backeward.json
โ”‚   โ”œโ”€โ”€ rvs/
โ”‚   โ”‚   โ”œโ”€โ”€ ego/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ videos/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ego4d_oe.json
โ”‚   โ”‚   โ””โ”€โ”€ movie/
โ”‚   โ”‚       โ”œโ”€โ”€ videos/
โ”‚   โ”‚       โ””โ”€โ”€ movienet_oe.json
โ”‚   โ”œโ”€โ”€ streamingbench/
โ”‚   โ”‚   โ”œโ”€โ”€ videos/
โ”‚   โ”‚   โ””โ”€โ”€ streamingbench_realtime.json
โ”‚   โ””โ”€โ”€ videomme/
โ”‚       โ”œโ”€โ”€ videos/
โ”‚       โ””โ”€โ”€ videomme.json
โ”œโ”€โ”€ eval/
โ”‚   โ”œโ”€โ”€ eval_multiple_choice.py
โ”‚   โ””โ”€โ”€ eval_open_ended.py
โ”œโ”€โ”€ inference/
โ”‚   โ”œโ”€โ”€ abstract_hermes.py
โ”‚   โ”œโ”€โ”€ llavaov_hermes.py
โ”‚   โ”œโ”€โ”€ qwenvl_hermes.py
โ”‚   โ”œโ”€โ”€ reindex_1d.py
โ”‚   โ””โ”€โ”€ reindex_3d.py
โ”œโ”€โ”€ models/
โ”‚   โ”œโ”€โ”€ llava-onevision-qwen2-0.5b-ov-hf/
โ”‚   โ”œโ”€โ”€ llava-onevision-qwen2-7b-ov-hf/
โ”‚   โ”œโ”€โ”€ llava-onevision-qwen2-72b-ov-hf/
โ”‚   โ”œโ”€โ”€ Qwen2.5-VL-3B-Instruct/
โ”‚   โ”œโ”€โ”€ Qwen2.5-VL-7B-Instruct/
โ”‚   โ””โ”€โ”€ Qwen2.5-VL-32B-Instruct/
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ run_infer.sh
โ”œโ”€โ”€ video_qa/
โ”‚   โ”œโ”€โ”€ base.py
โ”‚   โ”œโ”€โ”€ hermes_vqa.py
โ”‚   โ””โ”€โ”€ run_infer.py
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements_llava.txt
โ””โ”€โ”€ requirements_qwen.txt

๐Ÿš€ Inference

Simply run the inference script:

bash scripts/run_infer.sh

Here is the content of scripts/run_infer.sh:

export PYTHONPATH=$(cd "$(dirname "\$0")/.." && pwd):$PYTHONPATH

num_chunks=8
model=llava_ov_7b
dataset=streamingbench

python video_qa/run_infer.py \
    --num_chunks $num_chunks \
    --model ${model} \
    --dataset ${dataset} \
    --sample_fps 0.5 \
    --kv_size 6000

Arguments:

ArgumentDescription
modelModel to use. Options: llava_ov_0.5b, llava_ov_7b, llava_ov_72b, qwen2.5_vl_3b, qwen2.5_vl_7b, qwen2.5_vl_32b
datasetBenchmark dataset. Options: videomme, mvbench, egoschema, rvs_ego, rvs_movie, ovobench, streamingbench
num_chunksNumber of parallel processes for evaluation, typically set to the number of GPUs
sample_fpsFrame sampling rate (frames per second) from the video
kv_sizeMaximum KV cache size for HERMES hierarchical memory management
only_evalIf set, skip inference and only run evaluation on existing results

๐Ÿ“Š Evaluation

The evaluation scripts compute metrics on the inference results:

  • Multiple-choice benchmarks (VideoMME, MVBench, EgoSchema, OVBench, StreamingBench) are evaluated by eval/eval_multiple_choice.py, which takes a subcommand as its first argument:
SubcommandDescriptionUsed by
generalCompute overall accuracy, task-specific breakdown (auto-detects OVBench / StreamingBench), and prediction error analysisMVBench, OVBench, StreamingBench, VideoMME
videommeReport accuracy broken down by video duration (short / medium / long)VideoMME
egoschemaGenerate EgoSchema submission CSV fileEgoSchema
python eval/eval_multiple_choice.py general --results_path results/llava_ov_7b/streamingbench/fps0.5-kv6000/results.csv
  • Open-ended benchmarks (RVS-Ego, RVS-Movie) are evaluated by eval/eval_open_ended.py, which uses GPT for answer scoring:
python eval/eval_open_ended.py \
    --pred_path results/llava_ov_7b/rvs_ego/fps0.5-kv6000/results.csv \
    --output_dir results/llava_ov_7b/rvs_ego/fps0.5-kv6000/tmp \
    --output_json results/llava_ov_7b/rvs_ego/fps0.5-kv6000/results.json

๐Ÿ“ง Contact

For any questions regarding the paper or the technical implementation, please feel free to contact haowei.zhang123@gmail.com

๐Ÿ™ Acknowledgements

Our codebase is built upon ReKV. We gratefully acknowledge their contributions to the community.

๐Ÿ“ Citation

If you find our work useful for research, please cite our paper and give us a precious star ๐Ÿ˜„:

@misc{zhang2026hermeskvcachehierarchical,
      title={HERMES: KV Cache as Hierarchical Memory for Efficient Streaming Video Understanding}, 
      author={Haowei Zhang and Shudong Yang and Jinlan Fu and See-Kiong Ng and Xipeng Qiu},
      year={2026},
      eprint={2601.14724},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2601.14724}, 
}