Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rerank Search Results by Default on GPU machines #668

Merged
merged 3 commits into from Mar 10, 2024

Conversation

debanjum
Copy link
Collaborator

@debanjum debanjum commented Mar 9, 2024

Trigger: SentenceTransformer Cross Encoder models now run fast on GPU enabled machines, including Mac ARM devices since UKPLab/sentence-transformers#2463

Details

  • Only call search API when pause in typing search query on web, desktop apps (44c8d09)
  • Use cross-encoder to rerank search results by default on GPU machines (1105d88) and when using an inference server (53d4024)

@debanjum debanjum requested a review from sabaimran March 9, 2024 22:12
@debanjum debanjum added the upgrade New feature or request label Mar 9, 2024
src/khoj/interface/web/search.html Outdated Show resolved Hide resolved
src/khoj/routers/api.py Outdated Show resolved Hide resolved
@debanjum debanjum force-pushed the rerank-search-results-by-default-on-gpu branch 2 times, most recently from 208b91a to adcc1ba Compare March 10, 2024 07:02
Latest sentence-transformer package uses GPU for cross-encoder. This
makes it fast enough to enable reranking on machines with GPU.

Enabling search reranking by default allows (at least) users with GPUs
to side-step learning the UI affordance to rerank results
(i.e hitting Cmd/Ctrl-Enter or ENTER).
…p apps

Wait for 300ms since stop typing before calling search API.

This smooths out UI jitter when rendering search results, especially
now that we're reranking for every search query on GPU enabled devices

Emacs already has 300ms debounce time. More convoluted to add
debounce time to Obsidian search modal, so not updating that yet
@debanjum debanjum force-pushed the rerank-search-results-by-default-on-gpu branch from adcc1ba to a9b7eab Compare March 10, 2024 09:13
If an inference server is being used, we can expect the cross encoder
to be running fast enough to rerank search results by default
@debanjum debanjum force-pushed the rerank-search-results-by-default-on-gpu branch from a9b7eab to 53d4024 Compare March 10, 2024 09:40
@debanjum debanjum merged commit 18fa3e2 into master Mar 10, 2024
8 of 9 checks passed
@debanjum debanjum deleted the rerank-search-results-by-default-on-gpu branch March 11, 2024 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upgrade New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants