Lateness - Modern ColBERT for Late Interaction
A Python package for Modern ColBERT (late interaction) embeddings with native multi-vector support for efficient retrieval using Qdrant vector database.
Features
- Dual Backend Architecture: ONNX for fast retrieval, PyTorch for GPU indexing
- Native Multi-Vector Support: Optimized for Qdrant's MaxSim comparator
- Smart Installation: Lightweight retrieval or heavy indexing based on your needs
- Production Ready: Separate deployment targets for different workloads
Quick Start
Installation
# Lightweight retrieval (ONNX + Qdrant)
pip install lateness
# Heavy indexing (PyTorch + Transformers + ONNX + Qdrant)
pip install lateness[index]
Backend Selection
Basic Usage
Default Installation (ONNX Backend):
# pip install lateness
from lateness import ModernColBERT
colbert = ModernColBERT("prithivida/modern_colbert_base_en_v1")
# Output:
# 🚀 Using ONNX backend Using ONNX backend (default, for GPU accelerated indexing, install lateness[index] and set LATENESS_USE_TORCH=true)
# 🔄 Downloading model: prithivida/modern_colbert_base_en_v1
# ✅ ONNX ColBERT loaded with providers: ['CPUExecutionProvider']
# Query max length: 256, Document max length: 300
Index Installation (PyTorch Backend):
# pip install lateness[index]
import os
os.environ['LATENESS_USE_TORCH'] = 'true'
from lateness import ModernColBERT
colbert = ModernColBERT("prithivida/modern_colbert_base_en_v1")
# Output:
# 🚀 Using PyTorch backend (LATENESS_USE_TORCH=true)
# 🔄 Downloading model: prithivida/modern_colbert_base_en_v1
# Loading model from: /root/.cache/huggingface/hub/models--prithivida--modern_colbert_base_en_v1/...
# ✅ PyTorch ColBERT loaded on cuda
# Query max length: 256, Document max length: 300
Complete Example with Qdrant:
For a complete working example with Qdrant integration, environment setup, and testing instructions, see the examples/qdrant folder.
The examples include:
- Environment setup and testing
- Local Qdrant server management
- Complete indexing and retrieval workflows
- Both ONNX and PyTorch backend examples
Architecture
Two Deployment Models
Retrieval Service (Lightweight)
pip install lateness
- ONNX backend (fast CPU inference)
- Qdrant integration
- ~50MB total dependencies
- Perfect for user-facing search APIs
Indexing Service (Heavy)
pip install lateness[index]
- PyTorch backend (GPU acceleration)
- Full Transformers support
- ~2GB+ dependencies
- Perfect for batch document processing
Backend Selection
The package uses environment variables for backend control:
- Default behavior → ONNX backend (CPU retrieval)
LATENESS_USE_TORCH=true→ PyTorch backend (GPU indexing)
Note: PyTorch backend requires pip install lateness[index] to install PyTorch dependencies.
API Reference
ModernColBERT
from lateness import ModernColBERT
# Initialize
colbert = ModernColBERT("prithivida/modern_colbert_base_en_v1")
# Encode queries
query_embeddings = colbert.encode_queries(["What is AI?"])
# Encode documents
doc_embeddings = colbert.encode_documents(["AI is artificial intelligence"])
# Compute similarity
scores = ModernColBERT.compute_similarity(query_embeddings, doc_embeddings)
Qdrant Integration
from lateness import QdrantIndexer, QdrantRetriever
from qdrant_client import QdrantClient
client = QdrantClient("localhost", port=6333)
# Indexing
indexer = QdrantIndexer(client, "documents")
indexer.create_collection()
indexer.index_documents_simple(documents)
# Retrieval
retriever = QdrantRetriever(client, "documents")
results = retriever.search_simple("query", top_k=10)
License
Apache License 2.0
Contributing
Contributions welcome! Please check our contributing guidelines.
Metadata
Release files for lateness 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lateness-0.1.0.tar.gz | 17.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lateness-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.2 kB
Release files / lateness-0.1.0.tar.gz
| Download URL | lateness-0.1.0.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe807e2e8cd6757f4acf78eb15dcfbdef21e6aa917bf5964143ae6703b5e18e7
|
|
BLAKE2b-256 checksum How to use checksums |
bdfd352f8bd8c48526cc37f7dc8614ec899cdd1624bf40b818856d5037767622
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Release files / lateness-0.1.0-py3-none-any.whl
| Download URL | lateness-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a36d2ac44be6b48ba06a2e9c8bd643318f947ba56cee24347cdcada034b6a580
|
|
BLAKE2b-256 checksum How to use checksums |
0e1402351c6bdf42d9880e999ab5234bbd10f6b99b99b8674cd68b8e40b4b26f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Security for lateness 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.