Ultralight and Fast wrapper for the unofficial implementation of SPLADEv2 models for your search & retrieval pipelines. Models and Library created by Prithivi Da, For PRs and Collaboration to checkout the readme.
Project description
SPLADERunner
Ultra-lite & Super-fast Python wrapper for the unofficial implementation of SPLADEv2 (SParse Lexical And Expanion) models for your search & retrieval pipelines. Implementation is based on SPLADEv2 paper: https://arxiv.org/abs/2109.10086 with some minor tweaks.
-
⚡ Ultra-lite & Superfast:
- No Torch or Transformers needed. Runs on CPU.
- Boasts the
- tiniest document expander, ~8MB.
- Faster inference
-
💡 Why learn Sparse Representations?:
-
Lexical search with BOW models are strong baselines, but they famously suffer from vocabulary mismatch problem,as they can only do exact term matching. BoW representations are calculated and not learned.
-
Learned (neural) rankers / Dense retrievers with approximate nearest neighbors search has shown impressive results but they can
- Suffer from token amnesia (sometimes miss simple term matching),
- Can be resource intensive (both for storage and retreival),
- Are famously not interpretable and
- Scaling to newer domains needs data/finetuning.
-
Best of both worlds made sense and gave rise to interest in learning sparse representations for queries and documents with some interpretability. The sparse representations also double as implicit or explicit (latent, contextualized) expansion mechanisms for both query and documents.
- What the Models learn?:
- The model learns to project it's learned dense representations over a MLM head to give a vocabulary distribution.
-
💸 Why SPLADERunner?:
- $ Concious: Serverless deployments like Lambda are charged by memory & time per invocation*
- Smaller package size = shorter cold start times, quicker re-deployments for Serverless.
- Permissive License. (You can use it commercially with Source attribution).
-
🎯 Models:
- Below are the list of models supported as of now.
- prithivida/Tiny-SPLADE-Doc (default model)
- prithivida/Tiny-SPLADE-Query (Coming soon)
- Below are the list of models supported as of now.
🚀 Installation:
pip install spladerunner
Usage:
#One-time init
from spladerunner import Expander
# Default model is the document expander.
exapander = Expander()
#Sample Document expansion
sparse_rep = expander.expand("Chronic Obstructive Pulmonary Disease (COPD) presents a complex interplay of respiratory and cardiovascular comorbidities, necessitating multidisciplinary management.")
- 💸 Where and How can you use?:
- [TBD]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for SPLADERunner-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c51f2d4b68239773838704bc459b90f23f502ef9dfb5c447dcec238d6b57dec3 |
|
MD5 | 855283e80cc6f1c525264a52b1b19a01 |
|
BLAKE2b-256 | 69ba05b075b7d0313b659619cc6ab3fa751d4ad4089896cbc7dce90cd0ae9bf8 |