Skip to content

feat(experimental): add table-backed GPU k-means and IVF-flat - #2949

Merged
ibgreen-openai merged 1 commit into
codex/luvs-command-graph-aliasingfrom
codex/luvs-kmeans-ivf
Aug 7, 2026
Merged

feat(experimental): add table-backed GPU k-means and IVF-flat#2949
ibgreen-openai merged 1 commit into
codex/luvs-command-graph-aliasingfrom
codex/luvs-kmeans-ivf

Conversation

@ibgreen-openai

@ibgreen-openai ibgreen-openai commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Goals

Add deterministic WebGPU k-means clustering and genuinely indexed IVF-flat approximate similarity search over borrowed, chunk-preserving fixed-size-list GPU table columns. Explain the abstractions, their purpose, ownership boundaries, and accuracy/performance tradeoffs directly in this PR.

Changes

  • Add a standalone 500-line luVS reference and experimental overview/navigation in the same PR as the algorithms.
  • Explain why vector similarity is useful in visualization, why embeddings remain ordinary GPU table columns, and why application-facing stable IDs must remain distinct from logical source rows.
  • Document exact-search versus indexed-search complexity, deterministic WebGPU k-means without Float32 atomics, convergence, empty clusters, and explicit graph execution.
  • Include a worked IVF inverted-list example showing centroid labels, counts, prefix offsets, stable source IDs, and sorted logical row references.
  • Explain probe count, recall@K, restrictive-filter fallback, persistent index memory requirements, binding limits, explicit rebuilds, and recovery after WebGPU device loss.
  • Implement bounded Lloyd iterations with deterministic seeding, preserved empty-cluster centroids, GPU labels/status, and segmented Float32 reductions.
  • Build IVF-flat centroids, counts, prefix offsets, persisted stable IDs, and independently stored logical source-row references inside caller-owned command graphs.
  • Binary-search sorted per-list row references and rerank only candidates selected by the probed inverted lists.
  • Preserve source identity when a prebuilt index is imported into another graph; validate direct graph descriptors and input/output alias boundaries before allocation.
  • Support configurable lists/probes, bounded query-output tiling, caller-owned masks, explicit restrictive-filter fallback, empty inputs, zero K, and every exact metric.
  • Keep index buffers caller-owned while borrowing standard GPUTable/GPUVector embedding storage.

Verification

  • nvm use (Node 22.22.1).
  • yarn install: the configured package registry returns HTTP 403 for required tarballs; verification reuses the existing isolated dependency tree and CI performs the normal immutable install.
  • Focused k-means and index-directed IVF Node and actual Chromium/WebGPU suites.
  • Both standalone documentation pages compile as MDX.
  • Documentation/attribution regressions verify conceptual explanations, IVF identity layout, ownership, and device-loss guidance.
  • yarn lint fix.
  • yarn build after the final implementation and formatting changes.
  • Full Node pre-commit suite: 1,131 passed, one skipped.
  • Previous full actual Chromium/WebGPU coverage for the complete stack.
  • yarn website:build.
  • (cd website && yarn build).

Risks

Reduced IVF probing is approximate by design; each persistent packed index array must fit one storage binding and oversized indexes fail before graph mutation. An unrelated existing Billion-Point Spatial Atlas visual smoke intermittently loses its SwiftShader device on both this branch and master; its failure happens before luVS coverage starts and is being investigated separately.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4d74873a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread modules/experimental/src/luvs/gpu-ivf-flat-index.ts Outdated
Comment thread modules/experimental/src/luvs/gpu-clustering-utils.ts
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-arrow-embeddings branch from 0441c32 to d0dc80f Compare August 5, 2026 01:50
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-kmeans-ivf branch 2 times, most recently from d57d449 to 0dafc94 Compare August 5, 2026 02:06
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-arrow-embeddings branch from 329955a to 113a79f Compare August 6, 2026 21:46
@ibgreen-openai ibgreen-openai changed the title feat(experimental): add index-directed IVF-flat and GPU k-means feat(experimental): add table-backed GPU k-means and IVF-flat Aug 6, 2026
@ibgreen-openai
ibgreen-openai changed the base branch from codex/luvs-arrow-embeddings to codex/luvs-foundation August 6, 2026 21:46
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-kmeans-ivf branch 2 times, most recently from 47134cd to 6013af0 Compare August 6, 2026 22:09
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-foundation branch from e7dfcdf to f9eb796 Compare August 6, 2026 22:09
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-kmeans-ivf branch from 6013af0 to 7c21fc6 Compare August 6, 2026 22:16
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-foundation branch from f9eb796 to 135f47a Compare August 6, 2026 22:16
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-kmeans-ivf branch from 7c21fc6 to b64cc11 Compare August 6, 2026 22:24
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-foundation branch from 135f47a to 4fa67be Compare August 6, 2026 22:24
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-kmeans-ivf branch from b64cc11 to ced560b Compare August 7, 2026 00:29
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-foundation branch 2 times, most recently from 3bdc79b to 9df7ffd Compare August 7, 2026 00:34
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-kmeans-ivf branch from ced560b to f084cfe Compare August 7, 2026 00:34
Base automatically changed from codex/luvs-foundation to codex/luvs-command-graph-aliasing August 7, 2026 00:35
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-kmeans-ivf branch 2 times, most recently from 34734c0 to 7a41644 Compare August 7, 2026 00:48
@ibgreen-openai
ibgreen-openai force-pushed the codex/luvs-kmeans-ivf branch from 7a41644 to 91c460e Compare August 7, 2026 00:52
@ibgreen-openai
ibgreen-openai merged commit 957b7c4 into codex/luvs-command-graph-aliasing Aug 7, 2026
6 checks passed
@ibgreen-openai
ibgreen-openai deleted the codex/luvs-kmeans-ivf branch August 7, 2026 01:04
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