Skip to main content

Efficient interpolation-based ranking on CPUs

Project description

Fast-Forward Indexes

This is the implementation of Fast-Forward indexes.

[!IMPORTANT] As this library is still in its early stages, the API is subject to change!

Installation

Install the package via pip:

pip install fast-forward-indexes

Getting Started

Using a Fast-Forward index is as simple as providing a TREC run with retrieval scores:

from pathlib import Path
from fast_forward import OnDiskIndex, Mode, Ranking
from fast_forward.encoder import TCTColBERTQueryEncoder

# choose a pre-trained query encoder
encoder = TCTColBERTQueryEncoder("castorini/tct_colbert-msmarco")

# load an index on disk
ff_index = OnDiskIndex.load(Path("/path/to/index.h5"), encoder, mode=Mode.MAXP)

# load a run (TREC format) and attach all required queries
first_stage_ranking = (
    Ranking.from_file(Path("/path/to/input/run.tsv"))
    .attach_queries(
        {
            "q1": "query 1",
            "q2": "query 2",
            # ...
            "qn": "query n",
        }
    )
    .cut(5000)
)

# compute the corresponding semantic scores
out = ff_index(first_stage_ranking)

# interpolate scores and create a new TREC runfile
first_stage_ranking.interpolate(out, 0.1).save(Path("/path/to/output/run.tsv"))

Documentation

A more detailed documentation is available here.

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

fast_forward_indexes-0.5.1.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

fast_forward_indexes-0.5.1-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file fast_forward_indexes-0.5.1.tar.gz.

File metadata

  • Download URL: fast_forward_indexes-0.5.1.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for fast_forward_indexes-0.5.1.tar.gz
Algorithm Hash digest
SHA256 1c38a217e202af042e18a3769d529f2abc2a46a802b75ee0575a8a858ed0b535
MD5 fa1bce8e034589813175ad32badda645
BLAKE2b-256 2dc921912668629a9eb0e440d78b2e2288f006054c44533194b1d8a815e2633c

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_forward_indexes-0.5.1.tar.gz:

Publisher: publish_pypi.yml on mrjleo/fast-forward-indexes

Attestations:

File details

Details for the file fast_forward_indexes-0.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fast_forward_indexes-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4fbc31c198f3c80b26b0421510060ab92d83b16b7f0e44ee84c238eeac7bb0b
MD5 2073ce6fc4d990cf738b1e442a0297e6
BLAKE2b-256 fb2e15f0096b5b9f17092d5608d1ad5df5b5bf77bae7907ebefa9952a14eec69

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_forward_indexes-0.5.1-py3-none-any.whl:

Publisher: publish_pypi.yml on mrjleo/fast-forward-indexes

Attestations:

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