Skip to content

Add GLiNER 2.5 entity extraction and serving - #467

Open
hfiguera wants to merge 1 commit into
elixir-nx:mainfrom
hfiguera:gliner-entity-extraction
Open

hfiguera wants to merge 1 commit into
elixir-nx:mainfrom
hfiguera:gliner-entity-extraction

Conversation

@hfiguera

@hfiguera hfiguera commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Add entity extraction for fastino/gliner2.5-base-v1, with entity labels supplied per document. This includes the DeBERTa encoder adapter, boundary and span-scoring stages, candidate selection, Unicode preprocessing/decoding, checkpoint loading, and single-document Nx.Serving integration.

{:ok, model} =
  Bumblebee.Text.load_entity_extraction({:hf, "fastino/gliner2.5-base-v1"},
    defn_options: [compiler: EXLA]
  )

serving = Bumblebee.Text.entity_extraction(model, include_spans: true)
Nx.Serving.run(serving, %{text: "Tim Cook works at Apple.", labels: ["person", "company"]})

Spans use Unicode codepoint offsets into the original input. The decoder supports confidence thresholds, abstention, and flat overlap resolution. Synthetic terminal punctuation is removed from returned spans before overlap selection and deduplication. The supported scope is the boundary/shared-pool NER configuration; document batching and other GLiNER tasks are outside this contribution.

Depends on #466. Validation also uses elixir-nx/nx#1842 and elixir-nx/axon#681.

Validation on CPU:

  • Six model-stage/configuration tests and 14 decoding, preprocessing, and real-checkpoint serving tests passed on both macOS ARM64 and Linux x86_64.
  • The macOS audit passed 7,579 of 7,580 portable comparisons against Python, including all 1,265 public holdout cases. That case passes on Linux. The full audit was run on macOS.
  • Stage fixtures and their Python generator are included, along with real-checkpoint reference examples.

AI disclosure: most of this implementation was generated with an AI coding agent.

@hfiguera
hfiguera force-pushed the gliner-entity-extraction branch from 17b7d92 to f47126e Compare September 29, 2026 21:52
@hfiguera
hfiguera force-pushed the gliner-entity-extraction branch from f47126e to 14983f0 Compare October 1, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant