Skip to main content

laghu-rs

The optional Rust core of laghu. laghu loads model2vec static embedding models with far less memory than model2vec and gives the same vectors. With laghu-rs installed, laghu runs normalization, pre-tokenization, the Unigram Viterbi search and mean pooling in Rust threads, over the same memory-mapped files. It also tokenizes BERT WordPiece models (a BertNormalizer, a BertPreTokenizer and a WordPiece model) in Rust, with a port of FastWordPiece from model2vec-rs, MIT, copyright (c) 2025 The Minish Lab (LICENSE-model2vec-rs).

pip install laghu-rs     # or: pip install 'laghu[rust]'

Nothing else changes: laghu finds laghu-rs and uses it for the models it supports. Output is identical, bit for bit, to laghu's pure-Python path and to model2vec 0.9.

500-character chunks on the 14 cores of an M3 Max, best of three runs of laghu.bench.speed, measured on 2026-10-24 at a load average of 6.5 to 9. potion-multilingual-128M (Unigram):

path chunks/s private memory
laghu with laghu-rs 42,385 72 MB
laghu, pure Python 1,940 67 MB
model2vec 0.9 21,105 1,369 MB

potion-base-8M (WordPiece):

path chunks/s private memory
laghu with laghu-rs 432,938 81 MB
laghu with tokenizers 55,514 93 MB
model2vec 0.9 55,600 140 MB

The figure laghu-rs 0.1.0 gave for model2vec, 5,276 chunks/s, was measured with tokenizers on one core.

laghu falls back to pure Python when laghu-rs is not installed or LAGHU_RUST=0 is set. It keeps Python's normalization and pre-tokenization when the tokenizers crate inside laghu-rs is not the same version as the installed Python tokenizers, or when the two disagree on a set of probe texts. It tokenizes a WordPiece model with tokenizers under the same two conditions, and for any pipeline the port does not reproduce.

laghu-rs needs Python 3.11 or later. Building it from source needs Rust and a C compiler.

Metadata

Release files for laghu-rs 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for laghu-rs 0.2.0
File Size Uploaded Provenance
laghu_rs-0.2.0.tar.gz 17.8 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for laghu-rs 0.2.0
File
laghu_rs-0.2.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
laghu_rs-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details
laghu_rs-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details
laghu_rs-0.2.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
laghu_rs-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 7.5 MB

Release files / laghu_rs-0.2.0.tar.gz

Download URL laghu_rs-0.2.0.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a34de11e4577aae19cf117cb75f51d811d054b3f954e2f86aa206dcdc63974b1
BLAKE2b-256 checksum
How to use checksums
bff5e565b781fa87b1c71dd97cec9d9a3defb85beb043029227e5326d30ee1a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / laghu_rs-0.2.0-cp311-abi3-win_amd64.whl

Download URL laghu_rs-0.2.0-cp311-abi3-win_amd64.whl
Size 1.4 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
7df92820d1c3fc6b3c8fdf09d3a147099df1bad6ada7e1682e9598fddd87d71a
BLAKE2b-256 checksum
How to use checksums
f87473fd27e9d1cb8d42e430750f07a78778373aeb9f96e4d7c9beb6ef6abdfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / laghu_rs-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL laghu_rs-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
240c8caa3e83a082ba5e8987be5fd499ca1462ddb4c992347c1089ba7c4de232
BLAKE2b-256 checksum
How to use checksums
fd421f07009831b87eb507a6bd8acfa7f1993926c41913fed5944cc6f4236280
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / laghu_rs-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL laghu_rs-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.5 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
53f97e9fef8ad15f22c7ae30375a664b837313620706b7cf9a42be82ce412c9e
BLAKE2b-256 checksum
How to use checksums
6cdc7ade43399f6169c31e64e3950d0aee0ba87864f331921b6a8b8b29030cc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / laghu_rs-0.2.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL laghu_rs-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
Size 1.4 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c7db60bf98ad4d3e0558fd2f81738485279696a240825038070998f3c4d354cb
BLAKE2b-256 checksum
How to use checksums
0fb49481124246688b8e1ac67e7fa2a9b954af92524504c30baa6eeb9ebd5694
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / laghu_rs-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL laghu_rs-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 1.5 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
46038afeff5a0c8c78854522bb3ce6b34a73ac3bc2afae91b9d6ee8155e60073
BLAKE2b-256 checksum
How to use checksums
606e8f4b2ef71990d9584f051def1951313c3ade44a987f834e8b0b7d3a6eda9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Security for laghu-rs 0.2.0

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

6 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page