Skip to main content

High-performance cosine similarity ranking for Retrieval-Augmented Generation (RAG) pipelines, vector search, and information retrieval, with a Python interface powered by a Rust backend.

Project description

logo-symrank

Similarity ranking for Retrieval-Augmented Generation

Meta       uv  Ruff  Powered by Rust  Analytics in Motion

✨ What is SymRank?

SymRank is a blazing-fast Python library for top-k cosine similarity ranking, designed for vector search, retrieval-augmented generation (RAG), and embedding-based matching.

Built with a Rust + SIMD backend, it offers the speed of native code with the ease of Python.


🚀 Why SymRank?

⚡ Fast: SIMD-accelerated cosine scoring with adaptive parallelism

🧠 Smart: Automatically selects serial or parallel mode based on workload

🔢 Top-K optimized: Efficient inlined heap selection (no full sort overhead)

🐍 Pythonic: Easy-to-use Python API

🦀 Powered by Rust: Safe, high-performance core engine


📦 Installation

You can install SymRank with 'uv' or alternatively using 'pip'.

Recommended (with uv):

uv pip install symrank

Using pip:

pip install symrank

🧪 Usage

Basic Example

import symrank as sr

query = [0.1, 0.2, 0.3, 0.4]  # or np.array([...], dtype=np.float32)
candidates = [
    ("doc_1", [0.1, 0.2, 0.3, 0.5]),
    ("doc_2", [0.9, 0.1, 0.2, 0.1]),
    ("doc_3", [0.0, 0.0, 0.0, 1.0]),
]

results = sr.compare(query, candidates, top_k=2, vector_size=4)
print(results)

Output

[{'id': 'doc_1', 'score': 0.9987}, {'id': 'doc_3', 'score': 0.8912}]

🧩 API: compare(...)

compare(
    query_vector,              # List[float] or np.ndarray
    candidate_vectors,         # List[Tuple[str, List[float] or np.ndarray]]
    method="cosine",           # Currently only "cosine" is supported
    top_k=5,                   # Number of top results to return
    vector_size=1536,          # Embedding dimension (default: OpenAI's)
    batch_size=None,           # Optional: split into batches for large sets
)

'compare(...)' Parameters

Parameter Type Default Description
query_vector List[float] or np.ndarray required Vector to search with
candidate_vectors List[Tuple[str, List[float] or np.ndarray]] required (id, vector) pairs to compare against
method str "cosine" Similarity method (E.g. "cosine")
top_k int 5 Number of results to return
vector_size int 1536 Dimensionality of all vectors
batch_size int or None None Optional batch size to reduce memory use

Returns

List of dictionaries with id and score (cosine similarity):

[{"id": "doc_42", "score": 0.8763}, {"id": "doc_17", "score": 0.8451}, ...]

📄 License

This project is licensed under the Apache License 2.0.

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

symrank-0.1.1.tar.gz (15.5 kB view details)

Uploaded Source

Built Distributions

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

symrank-0.1.1-cp313-cp313-win_amd64.whl (169.6 kB view details)

Uploaded CPython 3.13Windows x86-64

symrank-0.1.1-cp313-cp313-manylinux_2_34_x86_64.whl (298.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

symrank-0.1.1-cp313-cp313-macosx_11_0_arm64.whl (256.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

symrank-0.1.1-cp312-cp312-win_amd64.whl (169.6 kB view details)

Uploaded CPython 3.12Windows x86-64

symrank-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl (298.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

symrank-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (256.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

symrank-0.1.1-cp311-cp311-win_amd64.whl (169.0 kB view details)

Uploaded CPython 3.11Windows x86-64

symrank-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl (300.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

symrank-0.1.1-cp311-cp311-macosx_11_0_arm64.whl (259.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

symrank-0.1.1-cp310-cp310-win_amd64.whl (169.1 kB view details)

Uploaded CPython 3.10Windows x86-64

symrank-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl (301.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

symrank-0.1.1-cp310-cp310-macosx_11_0_arm64.whl (259.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file symrank-0.1.1.tar.gz.

File metadata

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

File hashes

Hashes for symrank-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5c4c612d8fa3c4497680b75e590d0e0220d715699906f20281b5ef9d6afc4b03
MD5 375b34092797c0b28f13a6b6fd495e73
BLAKE2b-256 a93f519dc26705f5b3c8053edf57ee8727cb8b645129579aeefd65b187a0b6ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1.tar.gz:

Publisher: CI.yml on analyticsinmotion/symrank

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

File details

Details for the file symrank-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: symrank-0.1.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 169.6 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for symrank-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 71c401ff07c207df2fa9f3d8911fb1c66e3d1d622809394ce93641ebb537a995
MD5 1bd0efd61a3dac8f3d51c367059667e4
BLAKE2b-256 2a6e028a27c00f77503b89d605685b06daff0d35e0bbb2ab483545c112d2b121

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1-cp313-cp313-win_amd64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

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

File details

Details for the file symrank-0.1.1-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symrank-0.1.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 12359570f9a5401360a125fa4900f361ca6a1971c71188a640a3185914bb5973
MD5 564c5d132813852767862c042eafe4da
BLAKE2b-256 a466166044b79b1d93bc971f22331e1add6a1d61b0d5787220989b0952026bf3

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

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

File details

Details for the file symrank-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symrank-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3af111116a88630f67919c4561610a87406e268ffe6108602bb239e353ca7e72
MD5 a3e578f48a987503709a8772fb14cc8d
BLAKE2b-256 389018917c7a2ab0ac78b825ed33dd47a81d514844ea36f0ef23cd86e087f10c

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

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

File details

Details for the file symrank-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: symrank-0.1.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 169.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for symrank-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f31c6904ed676be87d50f2d3fb0ab3b71a6bebf316679bd7caae1aa11c46c631
MD5 25c1e081d13de37c94b76b4f34c82831
BLAKE2b-256 2ac52fc75cf2c4a73bd999cdb2f2014b9839738b84fb8002695b3e32c25e8de1

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1-cp312-cp312-win_amd64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

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

File details

Details for the file symrank-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symrank-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a952a184eaeef8b94693a070b24089f54ebbcd3ac989425a22d58df9834df90f
MD5 1737223f6a2d5d1caeb347a92afefee7
BLAKE2b-256 40113d3bea773eee1490daa9311d7c6c6460b0c805ed81dc5dee8ce06ffbcb91

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

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

File details

Details for the file symrank-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symrank-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a97b444753db4ff78cdea7adbb10583511c2f5b5231fbce5ea08793b4b47c322
MD5 4316260b427c485a3c6288cd4dc8d3f6
BLAKE2b-256 2b1d4822a64045fecb91cc6b8a37f887f8932a806fe5f63f9bef10fad1102c71

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

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

File details

Details for the file symrank-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: symrank-0.1.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 169.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for symrank-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c08270068000837bf055059a2fa3d9808fdd555636de2f9d062b969286f39b8b
MD5 75decb941a27efd2b6646575404500f0
BLAKE2b-256 bf6082162cc7194f8af859c2226a0a60d6eb2326781c4e1565876be76494423c

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1-cp311-cp311-win_amd64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

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

File details

Details for the file symrank-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symrank-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ae11457728afe1af62fd15fd5b43c1636f1caec939f2bd9c7ab5cb1b52aec6b7
MD5 10e4fecc129d789310e2efc227156d46
BLAKE2b-256 bc95d1d2eddfd80bfae96c1c79fa5982c88f5f3177b29080a6be5e9818ba7389

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

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

File details

Details for the file symrank-0.1.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symrank-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f18da3fee189cd362ca9f475ab4103e3fde0fae6bf62d16b94c5ef80a207d9d5
MD5 1e0f6a5986faeaf92ff0f7757a625444
BLAKE2b-256 577a4d06ef46b086b00a8c049ae163d2502d069dfc7c912541205b4715823f9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

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

File details

Details for the file symrank-0.1.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: symrank-0.1.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 169.1 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for symrank-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dd343b0b964a363809161dc451378cd5bbe5b08e23f0b1f9f8164fc45fc69bbc
MD5 a73f06ba0908c059b02737454f58b6f9
BLAKE2b-256 380fbe8a6bb85c3a4638deca5bb531a44afe51c4239d3337304fb88b442e3a3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1-cp310-cp310-win_amd64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

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

File details

Details for the file symrank-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symrank-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ba5554b3ecfc574e6965fc444b345f7b2216e8011bb429896b219b6d0505e560
MD5 1260b5ffe3c4ef19b5175d248ab38b40
BLAKE2b-256 5680dc1f04680c1423021aefb6271b96671122f2bb54dfbf98ec791ba33b0505

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

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

File details

Details for the file symrank-0.1.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symrank-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82b4668d1dd69a084f0a6e55d3b4188530030d20eb6cf60458dc8fb3e6ae0f9a
MD5 89270c5ade808f92240f313c515f0e30
BLAKE2b-256 add02d48a30c2c5b9abf12cc84736304ea699e76ab8d11f01f99ec513f0fe59d

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.1-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

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