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 Ranking
from fast_forward.index import OnDiskIndex, Mode
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.8.0.tar.gz (37.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fast_forward_indexes-0.8.0-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fast_forward_indexes-0.8.0.tar.gz
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fast_forward_indexes-0.8.0.tar.gz
Algorithm Hash digest
SHA256 4113275f4097be8ebd2c43be3ee77ebc5af2ced74a34c831f46066ec2eaa4a9f
MD5 fcc5925dfc5a667dfbd2cfc2c19d5a3f
BLAKE2b-256 164b111efbe1a2830909424dc2be89f477156747257fa69b6a47f54a0a258fe6

See more details on using hashes here.

Provenance

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

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for fast_forward_indexes-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0b3a739230d3311a24420728942dab5267ae9ef6bab4f7d443c1b2c88bf7401
MD5 011a7cc8ab2a0ba2a8d8937807f8804f
BLAKE2b-256 eb964455a3d43504dfbbb368469612f28a8761bdea18ba768e7f6b164532ad58

See more details on using hashes here.

Provenance

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

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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