Skip to content

feat: add faster pooling - #59

Merged
stephantul merged 5 commits into
mainfrom
add-faster-pooling
Oct 27, 2026
Merged

stephantul merged 5 commits into
mainfrom
add-faster-pooling

Conversation

@stephantul

Copy link
Copy Markdown
Contributor

This PR adds faster pooling. Each text is now truncated, tokenized and pooled in one parallel pass. FastWordPiece encodes into a per-thread buffer that is reused across texts. encode_single pools directly instead of building a one-element batch. Pooling uses fixed-size loops for 64/128/256/384/512/768/1024 dims, and a general loop otherwise.

Measured against main on an Apple M3 Pro, default build:

Model (dim) Batched queries Batched docs encode_single queries
potion-base-8M (256) 1.23x 1.31x 1.37–1.43x
potion-retrieval-32M (512) 1.35x 1.24x 1.21–
static-retrieval-mrl-en-v1 (1024) 1.23x 1.19x 1.17–1.18x

@stephantul
stephantul requested a review from Pringled October 27, 2026 05:53
@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The PR changes the shared text-to-embedding path and adds local comparison tools.

The PR appears safe to merge, with non-blocking improvements needed for Unigram efficiency and benchmark reliability.

Reviews (1) · Last reviewed commit: "merge" · Reviewed by Greptile

Comment thread src/model.rs Resolved
Comment thread scripts/bench_compare.py Resolved

@Pringled Pringled left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gogogo

@stephantul
stephantul merged commit f26e886 into main Oct 27, 2026
5 checks passed
@stephantul
stephantul deleted the add-faster-pooling branch October 27, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants