# Copyright (c) 2026 LlamaIndex, Inc. All rights reserved. # Licensed under the OCRia-1 Model and Code License (LICENSE at the root of this repository). # This is not open-source software: see the license for permitted uses. """Attention heads (layer, head) used for grounding, per model. Chosen on pages with exact PDF word boxes (none from any public benchmark): the heads whose top image token most often falls inside the word being written.""" import json from pathlib import Path _FILE = Path(__file__).with_name("heads.json") def heads_for(model: str) -> list[tuple[int, int]]: table = json.loads(_FILE.read_text()) if model not in table: raise KeyError(f"no grounding heads recorded for {model}; known: {sorted(table)}") return [tuple(h) for h in table[model]["heads"]]