Skip to main content

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.

  1. Ultra-lite & Superfast:

    • No Torch or Transformers needed. Runs on CPU.
    • Boasts the
      • tiniest document expander, ~8MB.
      • < 100ms inference time
  2. 💡 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.

  1. What the Models learn?:
  • The model learns to project it's learned dense representations over a MLM head to give a vocabulary distribution.
  1. 💸 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).
  2. 🎯 Models:

🚀 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.")
  1. 💸 Where and How can you use?:
  • [TBD]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SPLADERunner-0.0.3.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

SPLADERunner-0.0.3-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page