Knowledgator/GLiClass
Generalist and Lightweight Model for Text Classification
What it solves
GLiClass is designed to make zero-shot sequence classification more efficient. Traditional cross-encoder models often require multiple passes to classify text against various labels, which is computationally expensive. GLiClass performs classification in a single forward pass, making it approximately 10 times faster while maintaining comparable performance.
How it works
Inspired by the GLiNER framework, GLiClass uses a generalist architecture that can handle multiple classification tasks. It supports various architecture types, including uni-encoders (most efficient), bi-encoders, and encoder-decoder models. It employs flexible pooling strategies (such as average or max pooling) and scoring mechanisms (like dot product or MLP) to determine the match between text and labels.
Who it’s for
It is intended for developers and researchers who need high-performance, zero-shot text classification for tasks such as sentiment analysis, document categorization, news tagging, and search result re-ranking.
Highlights
- Zero-Shot Capabilities: Classifies text into labels that the model was not explicitly trained on.
- Hierarchical Labels: Supports complex label structures using dot notation (e.g.,
sentiment.positive). - Few-Shot & RAC: Improves accuracy using in-context examples or Retrieval-Augmented Classification (RAC).
- Longe Document Support: Includes a pipeline for automatic text chunking for very long documents.
- Streaming Classification: Supports incremental classification over a decoder-KV model with persistent KV caches per session.
- Production Ready: Integrates with Ray Serve for dynamic batching and memory-aware serving.
- Hardware Acceleration: Optional support for Flash Attention backends (FlashDeBERTa and TurboT5) for faster inference.
Related
- Project
- Project
- Project
- Project