Skip to content

Pari 0.3.0 alpha

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 18 Nov 04:27
· 46 commits to main since this release
v0.3.0
7ed3f8f

Pari 0.3.0 alpha

Pari 0.3.0 alpha makes saving large persistent indexes 2.5 times faster with
30% less peak memory, adds similarity scores to the in-memory and read-only
lazy indexes, and adds a getting-started tutorial.

Installation

python -m pip install "pari-similarity==0.3.0"
cargo add pari-core@0.3.0 pari-index@0.3.0 pari-store@0.3.0

Python imports remain import pari. Keep all four public Rust crates on the
same release version. CLI archives, checksums, and the dependency SBOM are
attached to this release with GitHub build provenance attestations.

Faster, lighter persistent commits

Persistent commits now stream the snapshot to disk one section at a time
instead of assembling the whole file in memory, and sort bucket memberships in
parallel. This affects PersistentIndex32, PersistentIndex64, Index,
Index64, DedupeIndex(backend="local"), and pari index. Snapshot bytes are
unchanged, so files written by 0.3.0 and 0.2.x are interchangeable.

Measured on the same dedicated 12-vCPU, 130 GiB host as the 0.2.2 evidence:

10M items 0.2.2 0.3.0
Persistent construction 345.97 s 136.78 s
Peak RSS during persistent construction 36.16 GiB 25.37 GiB
DedupeIndex(backend="local") close 315.2 s 147.2 s
DedupeIndex(backend="local") peak RSS 37.08 GiB 26.72 GiB

Both 10M and 1M bundles passed scalar/batch, persistent/lazy, and persistent
mutation candidate parity before their timings were accepted.

Scored queries everywhere

  • In-memory LshIndex32/LshIndex64 built with with_signature_storage()
    answer query_scored and query_scored_many, returning each candidate with
    its estimated Jaccard similarity, filtered by ScoreFilter.
  • Read-only LazyIndex32/LazyIndex64 answer the same scored queries from
    files written with stored signatures, reading only the signature rows of the
    candidates they score.

Tutorial

The new tutorial deduplicates a CSV of product titles and
searches the kept rows by similarity in about five minutes. It walks through
the runnable examples/quickstart.py, which a test executes on every change.

Upgrading from 0.2

Python code needs no changes. Rust code may need these:

  • ScoreFilter and ScoredCandidate now live in pari-index. They are still
    re-exported from pari-store, so existing imports keep working.
  • ScoreFilter::validate returns Result<(), ScoreFilterError> instead of
    Result<(), StoreError>. ? inside a function returning StoreError still
    works through the new From<ScoreFilterError> conversion; code that matched
    on the returned StoreError should match on ScoreFilterError::reason().
  • LshError gains SignaturesUnavailable and InvalidScoreFilter, and
    LazyStoreError gains Signature, SignaturesUnavailable, and
    InvalidScoreFilter. Exhaustive match statements over these enums need
    new arms or a wildcard.

Compatibility

.pari format version 1, the affine32/affine64 signature identities, and CLI
machine-output revision 1 retain their contracts. Public crates retain Rust
1.81; the Python extension retains Rust 1.83 and CPython 3.10+ abi3 wheels.

This is an alpha release. See the
compatibility policy.