GitHub - PrithivirajDamodaran/SPLADERunner: Lite weight wrapper for the independent implementation of SPLADE++ models for search & retrieval pipelines. Models and Library created by Prithivi Da, For PRs and Collaboration checkout the readme. (original) (raw)

1. What is it?

Title is dedicated to the Original Blade Runners - Harrison Ford and the Author Philip K. Dick of "Do Androids Dream of Electric Sheep?"

A Ultra-lite & Super-fast Python wrapper for the independent implementation of SPLADE++ models for your search & retrieval pipelines. Based on the papers Naver's From Distillation to Hard Negative Sampling: Making Sparse Neural IR Models More Effective and Google's SparseEmbed

🚀 Installation:

Usage:

One-time only init

from spladerunner import Expander expander = Expander('Splade_PP_en_v1', 128) #pass model, max_seq_len

Sample passage expansion

sparse_rep = expander.expand("The Manhattan Project and its atomic bomb helped bring an end to World War II. Its legacy of peaceful uses of atomic energy continues to have an impact on history and science.")

For solr or elastic or vanilla lucene stores.

sparse_rep = expander.expand("The Manhattan Project and its atomic bomb helped bring an end to World War II. Its legacy of peaceful uses of atomic energy continues to have an impact on history and science.", outformat="lucene")

print(sparse_rep)

(Feel free to skip to 3 If you are expert in sparse and dense representations)

2. Why Sparse Representations?

Pros

✅ Efficient and Cheap.
✅ No need to fine-tune models.
✅️ Interpretable.
✅️ Exact Term Matches.

Cons

❌ Vocabulary mismatch (Need to remember exact terms)

Pros

✅ Search how humans innately think.
✅ When finetuned beats sparse by long way.
✅ Easily works with Multiple modals.

Cons

❌ Suffers token amnesia (misses term matching), 
❌ Resource intensive (both index & retreival), 
❌ Famously hard to interpret.
❌ Needs fine-tuning for OOD data.

2a. What the Models learn?

3. 💸 Why SPLADERunner?:

4. 🎯 Models:

4a. 💸 Where and How can you use?

4b. How (and what) to contribute?

5. Criticisms and Competitions to SPLADE and Learned Sparse representations: