Feature/sklearnex and remove faiss#33
Open
NetZissou wants to merge 3 commits into
Open
Conversation
The FAISS KMeans backend added meaningful installation weight and startup import noise for a marginal benefit. Removing it simplies the backend selection logic to two cases: - cuML if GPU available - else sklearn Changes - Drop `faiss-cpu` & `faiss-gpu-cu12` from main deps and `gpu-*` extras - Remove FAISS from backend scripts `resolve_brackend()`, `run_kmeans()` dispatch - Remove "faiss" from clustering backend dropdowns in the webUI - Update README & BACKEND_PIPELINE doc to reflect the changes
Add `scikit-learn-intelex` as default dependency and patch sklearn at import time in `shared/utils/clustering.py`. Accelerates the existing `sklearn` PCA / TSNE / KMeans calls on CPU. UMAP is unaffected as `umap-learn` is not part of the `sklearn` algorithm. Set Set EMB_EXPLORER_DISABLE_SKLEARNEX=1 to opt out for debugging vanilla sklearn behavior.
NetZissou
commented
Jun 3, 2026
NetZissou
commented
Jun 3, 2026
Co-authored-by: Net Zhang <48858129+NetZissou@users.noreply.github.com>
egrace479
reviewed
Jun 3, 2026
Comment on lines
+15
to
+19
| │ Backend: cuML (GPU) → sklearn (CPU, auto-accelerated by `sklearn-intelex` [^1]) | ||
| │ | ||
| ├─► Step 2: Dimensionality Reduction to 2D | ||
| │ Method: PCA / t-SNE / UMAP | ||
| │ Backend: cuML → sklearn | ||
| │ Backend: cuML (GPU) → sklearn (CPU, auto-accelerated by `sklearn-intelex` for PCA/TSNE [^1]) |
Member
There was a problem hiding this comment.
Suggested change
| │ Backend: cuML (GPU) → sklearn (CPU, auto-accelerated by `sklearn-intelex` [^1]) | |
| │ | |
| ├─► Step 2: Dimensionality Reduction to 2D | |
| │ Method: PCA / t-SNE / UMAP | |
| │ Backend: cuML → sklearn | |
| │ Backend: cuML (GPU) → sklearn (CPU, auto-accelerated by `sklearn-intelex` for PCA/TSNE [^1]) | |
| │ Backend: cuML (GPU) → sklearn (CPU, auto-accelerated by `sklearn-intelex`) | |
| │ | |
| ├─► Step 2: Dimensionality Reduction to 2D | |
| │ Method: PCA / t-SNE / UMAP | |
| │ Backend: cuML (GPU) → sklearn (CPU, auto-accelerated by `sklearn-intelex` for PCA/TSNE) |
Wrong spot for footnotes (they won't function in the codeblock)
| └─► Scatter Plot (Altair) | ||
| Color = cluster, position = 2D projection | ||
| ``` | ||
|
|
Member
There was a problem hiding this comment.
Suggested change
| Note that `sklearn-intelex` acceleration is used for CPU operations where available[^1]. | |
| | **cuML** | GPU available + >500 samples | GPU-accelerated KMeans via RAPIDS. Runs on CuPy arrays. Falls back to sklearn on any error. | | ||
| | **FAISS** | No GPU + >500 samples | Facebook's optimized CPU KMeans using L2 index. Fast for medium datasets. Falls back to sklearn on error. | | ||
| | **sklearn** | Small datasets or fallback | Standard scikit-learn KMeans. Always works, no special dependencies. | | ||
| | **sklearn** | CPU path (default on machines without a GPU) | Standard scikit-learn KMeans, auto-accelerated by [scikit-learn-intelex](https://github.com/uxlfoundation/scikit-learn-intelex) (Intel oneDAL) when installed — typically 10–17× faster than vanilla sklearn on CPU. Disable with `EMB_EXPLORER_DISABLE_SKLEARNEX=1`. | |
Member
There was a problem hiding this comment.
Suggested change
| | **sklearn** | CPU path (default on machines without a GPU) | Standard scikit-learn KMeans, auto-accelerated by [scikit-learn-intelex](https://github.com/uxlfoundation/scikit-learn-intelex) (Intel oneDAL) when installed — typically 10–17× faster than vanilla sklearn on CPU. Disable with `EMB_EXPLORER_DISABLE_SKLEARNEX=1`. | | |
| | **sklearn** | CPU path (default on machines without a GPU) | Standard scikit-learn KMeans, auto-accelerated by [scikit-learn-intelex](https://github.com/uxlfoundation/scikit-learn-intelex) (Intel oneDAL) when installed[^1] — typically 10–17× faster than vanilla sklearn on CPU. Disable with `EMB_EXPLORER_DISABLE_SKLEARNEX=1`. | |
| |-----------|-----------| | ||
| | KMeans | cuML if GPU + >500 samples, else FAISS if available + >500 samples, else sklearn | | ||
| | Dim. Reduction | cuML if GPU + >5000 samples, else sklearn | | ||
| | KMeans | cuML if GPU + >500 samples, else sklearn (auto-accelerated by `sklearn-intelex` when installed [^1]) | |
Member
There was a problem hiding this comment.
Suggested change
| | KMeans | cuML if GPU + >500 samples, else sklearn (auto-accelerated by `sklearn-intelex` when installed [^1]) | | |
| | KMeans | cuML if GPU + >500 samples, else sklearn (auto-accelerated by `sklearn-intelex` when installed[^1]) | |
| ``` | ||
|
|
||
| The app auto-detects GPU availability at runtime and falls back to CPU if anything goes wrong — no configuration needed. You can also manually select backends (cuML, FAISS, sklearn) in the sidebar. | ||
| The app auto-detects GPU availability at runtime and falls back to CPU if anything goes wrong — no configuration needed. The CPU sklearn path is auto-accelerated by [scikit-learn-intelex](https://github.com/uxlfoundation/scikit-learn-intelex) [^1]. You can also manually select backends (`cuML`, `sklearn`) in the sidebar. |
Member
There was a problem hiding this comment.
Suggested change
| The app auto-detects GPU availability at runtime and falls back to CPU if anything goes wrong — no configuration needed. The CPU sklearn path is auto-accelerated by [scikit-learn-intelex](https://github.com/uxlfoundation/scikit-learn-intelex) [^1]. You can also manually select backends (`cuML`, `sklearn`) in the sidebar. | |
| The app auto-detects GPU availability at runtime and falls back to CPU if anything goes wrong — no configuration needed. The CPU sklearn path is auto-accelerated by [scikit-learn-intelex](https://github.com/uxlfoundation/scikit-learn-intelex)[^1]. You can also manually select backends (`cuML`, `sklearn`) in the sidebar. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes issue #32
sklearnwithsklearnex.faissentirely from backend.About
sklearnexGood API stability:
sklearnexis powered by the oneDAL library that provides accelerations on x86_64 Linux and Windows machines, and silently fall back to vanillasklearnon unsupported architectures like Apple Silicon and ARM Linux. The package is under the UXL Foundation (a Linux Foundation project) so cross-vendor support is a stated goal.