Skip to content

Repository files navigation

GramLoop: Training-Free Gram-Gated Replay for Robust Dense Prediction

Official implementation and evaluation code for:

GramLoop: Training-Free Gram-Gated Replay for Robust Dense Prediction

Yang Chen, Canyu Shen, Xinzhe Rao, Yuanyi Yan, Yunlu Chen, Meng Tang, Teng Long, and Vincent Tao Hu

Paper · PDF

This repository provides the GramLoop inference-time forward, the exact reported-result configuration, evaluation entry points for all reported datasets, regression tests, and a forward-equivalence checker.

The release is deliberately minimal. It contains no vendored DINOv3 source, pretrained weights, datasets, experiment outputs, caches, logs, or machine-specific paths.

Reported-result configuration

Quantity Released value
Replay window Blocks [21, 23]
Additional replays 2
Gate scale alpha 0.56
Numerical constant epsilon 1e-6

Block indices are zero-based. The fixed configuration is stored in src/gramloop/configs/gramloop.yaml; no alternative method variants are included.

Supported evaluation

Task Datasets
Semantic segmentation ADE20K, ADE20K-C, ADE20K-P
Object detection COCO, COCO-C, COCO-P, COCO-O

Layout

src/gramloop/                  Method package and evaluator
src/gramloop/configs/          Paper and dataset configurations
scripts/                       Forward-equivalence checker
tests/                         CPU regression tests
EVALUATION.md                  Evaluation guide
METHOD.md                      Paper method summary
FORWARD_EQUIVALENCE.md         Original-to-clean comparison

Quick start

Install the method package:

python -m pip install -e .

Apply GramLoop to a detector or segmentor containing one DINOv3 ViT:

from gramloop import install_gramloop

install_gramloop(model)

The model continues to use its original inference API. If model is the ViT backbone itself, keep the returned wrapper:

model = install_gramloop(model)

For evaluation, install the optional dependencies and select a dataset config:

python -m pip install -e ".[eval]"
gramloop-eval --config src/gramloop/configs/eval/coco_p.yaml

See EVALUATION.md for dataset setup. A lightweight check that loads no checkpoint or dataset is:

python -m pip install -e ".[test]"
python -m pytest -q

The cleaned forward is bitwise equivalent to the original research code under the tested CPU configuration. See FORWARD_EQUIVALENCE.md for the result and reproduction command.

Citation

If this work is useful in your research, please cite:

@misc{chen2026gramloop,
  title={GramLoop: Training-Free Gram-Gated Replay for Robust Dense Prediction},
  author={Chen, Yang and Shen, Canyu and Rao, Xinzhe and Yan, Yuanyi and Chen, Yunlu and Tang, Meng and Long, Teng and Hu, Vincent Tao},
  year={2026},
  eprint={2608.29113},
  archivePrefix={arXiv},
  primaryClass={cs.CV},
  url={https://arxiv.org/abs/2608.29113}
}

Machine-readable metadata is available in CITATION.cff.

License

See LICENSE.md.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages