NER Retriever: Recupero di Entità Nominate in Zero-Shot con Embedding Sensibili al Tipo
NER Retriever: Zero-Shot Named Entity Retrieval with Type-Aware Embeddings
September 4, 2025
Autori: Or Shachar, Uri Katz, Yoav Goldberg, Oren Glickman
cs.AI
Abstract
Presentiamo NER Retriever, un framework di recupero zero-shot per il Named Entity Retrieval ad-hoc, una variante del Named Entity Recognition (NER), in cui i tipi di interesse non sono forniti in anticipo e una descrizione del tipo definita dall'utente viene utilizzata per recuperare documenti che menzionano entità di quel tipo. Invece di affidarsi a schemi fissi o modelli fine-tuned, il nostro metodo si basa sulle rappresentazioni interne di grandi modelli linguistici (LLM) per incorporare sia le menzioni di entità che le descrizioni aperte dei tipi fornite dall'utente in uno spazio semantico condiviso. Dimostriamo che le rappresentazioni interne, in particolare i vettori di valore provenienti dai blocchi intermedi dei trasformatori, codificano informazioni sui tipi a grana fine in modo più efficace rispetto agli embedding comunemente utilizzati negli strati superiori. Per affinare queste rappresentazioni, addestriamo una rete di proiezione contrastiva leggera che allinea le entità compatibili con il tipo separando i tipi non correlati. Gli embedding risultanti delle entità sono compatti, consapevoli del tipo e ben adatti per la ricerca del vicino più prossimo. Valutato su tre benchmark, NER Retriever supera significativamente sia le baseline lessicali che quelle dense a livello di frase. I nostri risultati forniscono supporto empirico per la selezione delle rappresentazioni all'interno degli LLM e dimostrano una soluzione pratica per il recupero scalabile di entità senza schema. Il codice di NER Retriever è disponibile pubblicamente all'indirizzo https://github.com/ShacharOr100/ner_retriever.
English
We present NER Retriever, a zero-shot retrieval framework for ad-hoc Named
Entity Retrieval, a variant of Named Entity Recognition (NER), where the types
of interest are not provided in advance, and a user-defined type description is
used to retrieve documents mentioning entities of that type. Instead of relying
on fixed schemas or fine-tuned models, our method builds on internal
representations of large language models (LLMs) to embed both entity mentions
and user-provided open-ended type descriptions into a shared semantic space. We
show that internal representations, specifically the value vectors from
mid-layer transformer blocks, encode fine-grained type information more
effectively than commonly used top-layer embeddings. To refine these
representations, we train a lightweight contrastive projection network that
aligns type-compatible entities while separating unrelated types. The resulting
entity embeddings are compact, type-aware, and well-suited for nearest-neighbor
search. Evaluated on three benchmarks, NER Retriever significantly outperforms
both lexical and dense sentence-level retrieval baselines. Our findings provide
empirical support for representation selection within LLMs and demonstrate a
practical solution for scalable, schema-free entity retrieval. The NER
Retriever Codebase is publicly available at
https://github.com/ShacharOr100/ner_retriever