Expand description
GLiNER — zero-shot span NER on the engine’s DeBERTa backbone.
The backbone (disentangled attention) is the engine’s; everything here is the head that turns
its per-token states into typed entity spans. The path, taken from the real checkpoint
(urchade/gliner_small-v2.1) and gated against the gliner package layer by layer:
input: <<ENT>> type₁ <<ENT>> type₂ … <<SEP>> word₁ word₂ …
DeBERTa hidden states [T, 768]
→ projection Linear(768 → 512) [T, 512]
→ gather prompts at the <<ENT>> positions [C, 512]
words at each word's FIRST subtoken [W, 512] (subtoken_pooling = "first")
→ BiLSTM 1 layer, 256/dir, concat [W, 512]
→ SpanMarkerV0: start = project_start(words)
end = project_end(words)
span[L][k] = out_project(relu(start[L] ‖ end[L+k]))
[W, max_width, 512]
→ prompt_rep(prompts) [C, 512]
→ scores[L][k][c] = span[L][k] · prompt[c] [W, max_width, C]
→ sigmoid, threshold, flat greedy overlap resolution → entitiesEvery MLP is GLiNER’s create_projection_layer: Linear(d → 4·out) → ReLU → Dropout → Linear.
Dropout is inference-time identity, which is why only the .0. and .3. weights exist.
Span (L, k) means the word range [L, L+k] inclusive; it is scored only when L+k < W.
Structs§
- Entity
- One predicted entity: a WORD range
[start, end](inclusive) with its type and probability. - Gliner
- GLiNER: the engine’s DeBERTa backbone plus the span head.
- Text
Entity - One predicted entity over the ORIGINAL text: byte offsets, the surface string, and its type.
Enums§
- Gliner
Device - Which device GLiNER runs on — backbone AND head together (they share one adapter, so the hidden states never round-trip between devices).