Seismic
Seismic is a fast and lightweight search engine for learned sparse embeddings, written in Rust with Python bindings. It indexes sparse vector collections and retrieves results in microseconds with near-exact accuracy.
Requirements
- Python >= 3.8
- Rust toolchain (only needed if installing from source for hardware-specific optimizations)
Installation
The easiest way to use Seismic is via its Python API, which can be installed in two different ways:
- the easiest way is via pip as follows:
pip install pyseismic-lsr
- via Rust compilation that allows deeper hardware optimizations as follows (requires a working Rust toolchain, installable via rustup):
RUSTFLAGS="-C target-cpu=native" pip install --no-binary :all: pyseismic-lsr
Check docs/PythonUsage.md for more details.
Quick Start
Given a collection as a jsonl file, you can quickly index it by running
from seismic import SeismicIndex
json_input_file = "" # Your data collection
index = SeismicIndex.build(json_input_file)
print("Number of documents:", index.len)
print("Avg number of non-zero components:", index.nnz / index.len)
print("Dimensionality of the vectors:", index.dim)
index.print_space_usage_byte()
and then exploit Seismic to retrieve your set of queries quickly
import numpy as np
from seismic import get_seismic_string
string_type = get_seismic_string() # 'U100': fixed-width dtype for token strings
query = {"a": 3.5, "certain": 3.5, "query": 0.4}
query_id = "0"
query_components = np.array(list(query.keys()), dtype=string_type)
query_values = np.array(list(query.values()), dtype=np.float32)
results = index.search(
query_id=query_id,
query_components=query_components,
query_values=query_values,
k=10,
query_cut=3,
heap_factor=0.8,
)
Each document in the jsonl file should be a JSON object with an id (integer), an optional content (string), and a vector (dictionary mapping tokens to scores, e.g., {"dog": 2.45}). See docs/RunExperiments.md for full format details.
Features
- Multiple index variants — Standard (
SeismicIndex), compressed (SeismicIndexDotVByte), and large vocabulary (SeismicIndexLV) for collections with >65K unique tokens - RAG-ready — Build the index with
load_content=Trueand retrieve document texts alongside scores (example) - Python & Rust APIs — Use from Python via
pyseismic-lsror integrate directly in Rust viacargo add seismic(docs) - Parallel batch search — Multi-threaded query processing via
batch_search
Examples
Interactive Jupyter notebooks are available in the examples/ folder:
- HandsOnSeismic.ipynb — Quick 2-minute overview of building and querying an index
- SeismicGuide.ipynb — Comprehensive guide covering all features: indexing, k-NN graphs, search, evaluation
- RAG.ipynb — Plug Seismic into a RAG pipeline with document content retrieval
- DotVByteIndex.ipynb — Memory-efficient compressed index variant
- LargeVocabulary.ipynb — Handling collections with large vocabularies (>65K tokens)
Comparison with the state-of-the-art
Comparison with Dynamic Superblock Pruning (DSP) using the splade-v3 encoding of the MS MARCO dataset.
| Index | MRR@10 | AQT (μs) | Memory (GB) |
|---|---|---|---|
| DSP | 40.28 | 745 | 24.0 |
| Seismic | 40.27 | 185 | 7.9 |
Experiments performed in single-threaded mode on an Intel Core Ultra 7265K CPU, equipped with 124 GB of RAM.
Best Results
Seismic is an approximate algorithm designed for high-performance retrieval over learned sparse representations. We provide pre-optimized configurations for several common datasets, e.g., MsMarco. Check the detailed documentation in docs/BestResults.md and the available optimized configurations in experiments/best_configs.
Resources
Check out our docs folder for detailed guides:
- PythonUsage.md - How to use the Seismic Python API.
- RustUsage.md - How to use Seismic directly in Rust.
- Guidelines.md - Step-by-step guide to build your Seismic index with hyperparameter tuning tips.
- BestResults.md - A detailed guide on how to replicate results with optimized configurations.
- RunExperiments.md - How to run custom experiments, download datasets, and data format details.
- TomlInstructions.md - TOML configuration reference.
Bibliography
Click to expand citations
- Sebastian Bruch, Franco Maria Nardini, Cosimo Rulli, and Rossano Venturini. "Efficient Inverted Indexes for Approximate Retrieval over Learned Sparse Representations." Proc. ACM SIGIR. 2024.
- Sebastian Bruch, Franco Maria Nardini, Cosimo Rulli, and Rossano Venturini. "Pairing Clustered Inverted Indexes with κ-NN Graphs for Fast Approximate Retrieval over Learned Sparse Representations." Proc. ACM CIKM. 2024.
- Sebastian Bruch, Franco Maria Nardini, Cosimo Rulli, Rossano Venturini, and Leonardo Venuta. "Investigating the Scalability of Approximate Sparse Retrieval Algorithms to Massive Datasets." Proc. ECIR. 2025.
- Bruch, Sebastian and Fontana, Martino and Nardini, Franco Maria and Rulli, Cosimo and Venturini, Rossano. "Forward Index Compression for Learned Sparse Retrieval", ECIR 2025 (to appear)
SIGIR 2024
@inproceedings{bruch2024seismic,
author = {Bruch, Sebastian and Nardini, Franco Maria and Rulli, Cosimo and Venturini, Rossano},
title = {Efficient Inverted Indexes for Approximate Retrieval over Learned Sparse Representations},
booktitle = {Proceedings of the 47th International {ACM} {SIGIR} {C}onference on Research and Development in Information Retrieval ({SIGIR})},
pages = {152--162},
publisher = {{ACM}},
year = {2024},
url = {https://doi.org/10.1145/3626772.3657769},
doi = {10.1145/3626772.3657769}
}
CIKM 2024
@inproceedings{bruch2024pairing,
author = {Bruch, Sebastian and Nardini, Franco Maria and Rulli, Cosimo and Venturini, Rossano},
title = {Pairing Clustered Inverted Indexes with $\kappa$-NN Graphs for Fast Approximate Retrieval over Learned Sparse Representations},
booktitle = {Proceedings of the 33rd International {ACM} {C}onference on {I}nformation and {K}nowledge {M}anagement ({CIKM})},
pages = {3642--3646},
publisher = {{ACM}},
year = {2024},
url = {https://doi.org/10.1145/3627673.3679977},
doi = {10.1145/3627673.3679977}
}
ECIR 2025
@inproceedings{bruch2025investigating,
author = {Bruch, Sebastian and Nardini, Franco Maria and Rulli, Cosimo and Venturini, Rossano and Venuta, Leonardo},
title = {Investigating the Scalability of Approximate Sparse Retrieval Algorithms to Massive Datasets},
booktitle = {Advances in Information Retrieval},
pages = {437--445},
publisher = {Springer Nature Switzerland},
year = {2025},
url = {https://doi.org/10.1007/978-3-031-88714-7_43},
doi = {10.1007/978-3-031-88714-7_43}
}
ECIR 2026 (Accepted, to appear)
@article{bruch2026forward,
title={Forward Index Compression for Learned Sparse Retrieval},
author={Bruch, Sebastian and Fontana, Martino and Nardini, Franco Maria and Rulli, Cosimo and Venturini, Rossano},
journal={European Conference on Information Retrieval 2026 (to appear)},
year={2026}
}
Journal of ACM (Under Review)
@article{bruch2025efficient,
title={Efficient Sketching and Nearest Neighbor Search Algorithms for Sparse Vector Sets},
author={Bruch, Sebastian and Nardini, Franco Maria and Rulli, Cosimo and Venturini, Rossano},
journal={arXiv preprint arXiv:2509.24815},
year={2025}
}
Citation License
The source code in this repository is subject to the following citation license:
By downloading and using this software, you agree to cite the papers listed in the Bibliography section above in any kind of material you produce where it was used to conduct a search or experimentation, whether be it a research paper, dissertation, article, poster, presentation, or documentation. By using this software, you have agreed to the citation license.
Metadata
Release files for pyseismic-lsr 0.5.4
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 | Actions |
|---|---|---|---|---|
| pyseismic_lsr-0.5.4.tar.gz | 383.7 kB | Without provenance | Details for pyseismic_lsr-0.5.4.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| pyseismic_lsr-0.5.4-cp311-cp311-manylinux_2_34_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.34+ x86-64 | Details for pyseismic_lsr-0.5.4-cp311-cp311-manylinux_2_34_x86_64.whl |
| pyseismic_lsr-0.5.4-cp310-cp310-manylinux_2_34_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.34+ x86-64 | Details for pyseismic_lsr-0.5.4-cp310-cp310-manylinux_2_34_x86_64.whl |
| pyseismic_lsr-0.5.4-cp39-cp39-manylinux_2_34_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.34+ x86-64 | Details for pyseismic_lsr-0.5.4-cp39-cp39-manylinux_2_34_x86_64.whl |
| pyseismic_lsr-0.5.4-cp37-cp37m-manylinux_2_34_x86_64.whl | CPython 3.7 | CPython 3.7 pymalloc | Linux glibc 2.34+ x86-64 | Details for pyseismic_lsr-0.5.4-cp37-cp37m-manylinux_2_34_x86_64.whl |
Total release size: 4.3 MB
Release files / pyseismic_lsr-0.5.4.tar.gz
| Download URL | pyseismic_lsr-0.5.4.tar.gz |
|---|---|
| Size | 383.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6db375235ddbcb6d50d96e877b062dbdb4137c7b7821a353c6e3fe1df1568225
|
|
BLAKE2b-256 checksum How to use checksums |
399cfdd1680a4af456700ebe4180e19172aee1a1c4d6ae4909297791634b02c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / pyseismic_lsr-0.5.4-cp311-cp311-manylinux_2_34_x86_64.whl
| Download URL | pyseismic_lsr-0.5.4-cp311-cp311-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 970.2 kB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
d3613d541a2745e12b8c13cd70d135b918130fe7d553be42caf2485e5590884d
|
|
BLAKE2b-256 checksum How to use checksums |
3bf10ffb6e3bff31fea501f7644a12f51bb52ce4898a0c5754dec97c3cdfe3f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / pyseismic_lsr-0.5.4-cp310-cp310-manylinux_2_34_x86_64.whl
| Download URL | pyseismic_lsr-0.5.4-cp310-cp310-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 971.7 kB |
| Tags | CPython 3.10 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
d79c38db9dbd4b1350f67391db75cfeedd73ddc657a569d4107b20bcad289a9c
|
|
BLAKE2b-256 checksum How to use checksums |
3c844119a6a4c3f861b937dec3a270e41d3bd61631eb74eb079e2ba3d0be88ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / pyseismic_lsr-0.5.4-cp39-cp39-manylinux_2_34_x86_64.whl
| Download URL | pyseismic_lsr-0.5.4-cp39-cp39-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 973.0 kB |
| Tags | CPython 3.9 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
808f54db6a43eb9b3dc5accc791bbc3eb6ff121d7a9ea122d776308e5b6aca81
|
|
BLAKE2b-256 checksum How to use checksums |
ca6596189aebb4e9f934de9feefff5be6d4e21eeefb867aac383ee80610bcb37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Release files / pyseismic_lsr-0.5.4-cp37-cp37m-manylinux_2_34_x86_64.whl
| Download URL | pyseismic_lsr-0.5.4-cp37-cp37m-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 972.8 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
c867f0f5a00a1b9c476bba07c101cb21322038974dee9fdd7f7ab3476e4ed77c
|
|
BLAKE2b-256 checksum How to use checksums |
4bd643a3e5614f18230032c7894b3f363b75bdbe4c414bb9a3c9afe08152f1a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.8.1
|
Security for pyseismic-lsr 0.5.4
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.