Skip to content

Return the hidden state vectors for the found spans (a new argument for inference API call) #381

Open

Description

@mazurkin

Please return the hidden state vectors for all found spans when requested

Use case

Reusing GLiNER span embeddings as features for a downstream model: run zero-shot extraction, then feed the embedding of each detected span into a separate classifier/retrieval model, instead of re-encoding the span text with another encoder. The embeddings are already contextual and already aligned with the label space, so this is cheap and natural — if they were reachable.

for entity in entities:
    label: str = entity['label']
    text: str = entity['text']
    score: float = entity['score']

    # vector!
    vector: np.ndarray = entity['vector']

Activity

  1. self-assigned this
    on Sep 4, 2026
  2. added
    enhancement
    on Sep 4, 2026
  3. Ingvarstep commented on Sep 5, 2026

    @Ingvarstep
    Collaborator

    It was implemented and will be available in the next release soon, here is the documentation: https://urchade.github.io/GLiNER/usage.html#returning-contextual-vectors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions