AIニュース最前線
最新ニュースAI日報Hacker日報週報動画AIツールトレンド企業

AIニュース最前線

世界中のAI最新情報を日本語で毎時更新

最新ニュース日報トレンド企業プレミアムRSS
© 2026 ainew.jp特定商取引法に基づく表記
ニュース一覧元記事を開く
MarkTechPost·2026年6月15日 18:16·約13分で読める

Flash-KMeans の紹介:GPU で FAISS よりも 200 倍以上高速に動作する IO 対応型 K-Means アルゴリズム

#K-means#GPU 最適化#オープンソース#NVIDIA H200#メモリ帯域幅
TL;DR

カリフォルニア大学バークレー校とオースティン大学の研究者らが開発した「Flash-KMeans」は、メモリ帯域幅ボトルネックを解消する革新的な実装により、既存の FAISS 比で 200 倍以上の高速化を実現し、AI パイプライン内のリアルタイム K-means 処理に新たな基準をもたらしました。

AI深層分析2026年6月15日 19:02
4
重要/ 5段階
深度40%
5
関連度30%
5
実用性20%
4
革新性10%
5

キーポイント

1

メモリ帯域幅ボトルネックの解消

従来の K-means が距離行列全体を HBM に書き込む非効率な動作に対し、FlashAssign によりオンチップ SRAM でタイル処理を行い、O(NK) の IO 複雑度を O(Nd + Kd) に削減しました。

2

競合他社との比較性能

NVIDIA H200 GPU 上で、FAISS に対して 200 倍以上、cuML に対して 33 倍、最良のベースラインと比較して最大 17.9 倍のエンドツーエンド速度向上を達成しました。

3

数学的完全性の維持

近似計算やアルゴリズムの簡略化(三角不等式剪定など)を行わず、標準的な Lloyd の K-means と数学的に同一の結果を保証しながら、カーネルレベルでのデータフロー再構成のみで高速化を実現しています。

4

更新段階の最適化技術

クラスタ更新時の原子演算競合を解消するため、Sort-Inverse Update 方式を採用し、アサインメントベクトルをソートして連続セグメントを形成することで、スレッドブロック単位での効率的な集約を実現しました。

5

Sort-Inverse Update の導入

クラスタIDに基づいてアサインメントベクトルをソートし、連続するセグメントごとにオンチップで集約することで、重い点行列の物理的な並べ替えを不要にし、原子演算数を大幅に削減します。

6

FAISS に対する圧倒的な速度向上

H200 GPU 環境でのベンチマークにより、特に大規模データセットにおいて FAISS よりも 200 倍以上高速に動作し、産業用ライブラリとしての実用性を証明しています。

7

超大規模・オンコア外処理の最適化

10 億点規模のデータでも PCIe 転送を計算で隠蔽するチャンクストリームオーバーラップと、チューニングオーバーヘッドを最大 175 倍削減するキャッシュ対応コンパイルヒューリスティックを採用しています。

影響分析・編集コメントを表示

影響分析

この成果は、大規模データ処理における K-means アルゴリズムの実用性を根本から変えるものであり、特にリアルタイム性が求められる現代の AI パイプラインにおいて、計算リソースの効率化とレイテンシ削減に劇的な貢献を果たします。メモリ帯域幅の制約を克服する手法は、Transformer などの大規模モデルにおけるアテンション計算(FlashAttention)の成功事例と同様の波及効果をもたらし、GPU 活用における最適化のパラダイムシフトを示唆しています。

編集コメント

メモリ帯域幅のボトルネックを解消するこのアプローチは、単なる速度向上にとどまらず、大規模データ処理におけるアルゴリズム設計の新たな基準を示す画期的な技術です。

k-means は数十年にわたりオフラインツールとして使われてきました。データを前処理するために一度実行し、その後次のステップへ進むのです。カリフォルニア大学バークレー校とオースティン大学の研究者チームが Flash-KMeans をリリースしました。これは異なる設定をターゲットにした新しいオープンソースライブラリです。現代の AI パイプラインでは、k-means がトレーニングや推論ループ内で呼び出されるようになりました。その頻度においては、理論上の FLOPs(浮動小数点演算数)よりも、1 回あたりのレイテンシが重要になります。

Flash-KMeans は、標準的な Lloyd の k-means アルゴリズムを IO アウェアに実装したものです。数学的計算を変更するものでもなく、近似を行うものでもありません。GPU 上でアルゴリズムがデータをどのように移動させるかを再構築するだけです。NVIDIA H200 において、研究チームは最良のベースラインと比較して最大で 17.9 倍のエンドツーエンドの高速化を報告しています。NVIDIA cuML(CUDA Machine Learning)との比較では 33 倍、FAISS との比較では 200 倍以上の高速化を報告しています。

Flash-KMeans とは何か

Flash-KMeans は、Triton GPU カーネルで書かれたバッチ処理対応の k-means ライブラリです。Apache 2.0 ライセンスの下で配布され、pip install flash-kmeans でインストールできます。

出力結果は、標準的な Lloyd の k-means と数学的に完全に同一です。高速化の要因は作業を省略することではなく、カーネルレベルでのデータフローにあります。これにより、三角不等式による剪定やコレスセットサンプリングなどのアルゴリズム手法とは明確に区別されます。

標準的な Lloyd 反復には 2 つの段階があります。割り当て段階では、各点からすべてのセントロイドまでの距離を計算し、最も近いものを選択します。更新段階では、各クラスター内の点を平均化して新しいセントロイドを形成します。両方の段階とも単純な算術演算ですが、GPU においてはどちらも計算能力ではなくメモリ帯域幅がボトルネックとなります。

Flash-KMeans が攻撃する 2 つのボトルネック

最初のボトルネックはアサインメント(割り当て)ステージです。標準的なコードでは、高帯域メモリ(HBM)に N×K 形状の距離行列 D を完全に構築します。その後、この行列を書き出し、argmin(最小値インデックスの取得)を実行するために読み戻します。N=65536、K=1024、d=128、B=32 の場合、距離計算自体には 2.6ms かかりますが、行列 D の書き出しと消費には約 23ms を要します。コストの主体は演算ではなく行列そのものです。

Flash-KMeans はこれを FlashAssign で置き換えます。この設計は FlashAttention から着想を得ています。FlashAssign は、ポイント(点)とセントロイド(重心)のタイルを HBM からオンチップ SRAM へストリーミングし、距離計算とオンライン argmin を融合します。完全な N×K 行列が一度に実体化されることはありません。これにより、支配的な IO 複雑度が O(NK) から O(Nd + Kd) に削減されます。カーネルレベルでは FlashAssign は最大で 21.2 倍の性能向上を達成し、あるケースではアサインメント時間を 122.5ms から 5.8ms に短縮しました。

2 つ目のボトルネックはセントロイド更新ステージです。標準的なコードでは散在型(scatter-style)のアトミック加算を使用します。各スレッドがクラスタ ID をキーとして共有和バッファに自身のポイントを追加しますが、多くのスレッドが同時に同じ「ホット」なクラスタにアクセスします。これによりアトミック競合が発生し、ハードウェアによる直列化が生じます。研究チームは H200 において、この部分の有効帯域幅がわずか 50 GB/s であることを測定しました。

Flash-KMeans はこれをソート逆更新(Sort-Inverse Update)に置き換えます。1 次元の割り当てベクトルをクラスター ID で argsort してソートし、同一のクラスター ID が連続するセグメントを形成します。各スレッドブロックはオンチップでセグメントを削減し、その後セグメントごとにアトミック加算(atomic add)を 1 回発行します。重いポイント行列が物理的に並べ替えられることは決してありません。アトミック操作の計算量は O((K + N/B_N)d) に低下します。このカーネルは最大で 6.3 倍の高速化を実現します。

ベンチマーク

研究チームは H200、CUDA 12.8、FP16 データ、次元数 d=128 の環境でテストを行いました。N、K、バッチサイズ B をスweep し、4 つの最適化されたベースラインと比較しました。それらは fast_pytorch_kmeans、fastkmeans、cuML、および FAISS です。

比較報告:速度向上率とワークロードコンテキスト

エンドツーエンド vs 最良ベースライン:最大 17.9 倍(N=8M, K=1024:大規模 N、小規模 K)

vs NVIDIA cuML:33 倍(産業用ライブラリ)

vs FAISS:200 倍以上(産業用ライブラリ)

FlashAssign カーネル:最大 21.2 倍(N=1M, K=8192:割り当て処理)

Sort-Inverse Update カーネル:最大 6.3 倍(N=33M, K=4096:更新処理)

オンメモリ外・大規模スケール:最大 10.5 倍(N=400M, K=16384 vs fastkmeans)

文脈を理解する上で重要な失敗モードが 1 つあります。標準的な PyTorch 実装では、大規模な K のレジームにおいてメモリ不足となり、N×K 行列をマテリアライズ(具体化)することができません。FAISS は、多くの生産環境におけるベクトル検索システムの業界標準ライブラリです。

このライブラリはアウト・オブ・コアでも動作します。10 億点(K=32768, d=128)の場合、1 イテレーションを 41.4 秒で完了し、ベースラインの 261.8 秒と比較して大幅に高速です。計算処理の間に PCIe 転送を隠すために、チャンク化されたストリームのオーバーラップを利用しています。キャッシュを意識したコンパイルヒューリスティックにより、チューニングオーバーヘッドが最大 175 倍削減され、チューニング済み速度に対して誤差は 0.3% 以内となっています。

MTP インタラクティブ・エクスプローラー

#mtp-fk-demo *{box-sizing:border-box!important;margin:0;padding:0}

#mtp-fk-demo{

background:#111!important;color:#e8e8e8!important;

border:1px solid #222!important;border-radius:14px!important;

font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif!important;

max-width:980px;margin:24px auto!important;padding:0!important;overflow:hidden!important;

line-height:1.5!important

}

#mtp-fk-demo hr,#mtp-fk-demo p:empty,#mtp-fk-demo del,#mtp-fk-demo s{display:none!important}

#mtp-fk-demo .fk-head{padding:22px 24px 14px!important;border-bottom:1px solid #1d1d1d!important}

#mtp-fk-demo .fk-eyebrow{color:#76B900!important;font-size:11px!important;letter-spacing:.16em!important;text-transform:uppercase!important;font-weight:700!important}

#mtp-fk-demo h2.fk-title{color:#fff!important;font-size:23px!important;font-weight:800!important;margin:6px 0 4px!important;letter-spacing:-.01em!important}

#mtp-fk-demo .fk-sub{color:#9a9a9a!important;font-size:13.5px!important;max-width:680px!important}

#mtp-fk-demo .fk-stats{display:grid!important;grid-template-columns:repeat(4,1fr)!important;gap:1px!important;background:#1d1d1d!important;border-bottom:1px solid #1d1d1d!important}

#mtp-fk-demo .fk-stat{background:#0c0c0c!important;padding:14px 16px!important}

#mtp-fk-demo .fk-stat b{color:#76B900!important;font-size:21px!important;font-weight:800!important;display:block!important;font-variant-numeric:tabular-nums!important}

#mtp-fk-demo .fk-stat span{color:#8a8a8a!important;font-size:11px!important;display:block!important;margin-top:2px!important}

#mtp-fk-demo .fk-tabs{display:flex!important;gap:6px!important;padding:14px 24px 0!important;flex-wrap:wrap!important}

#mtp-fk-demo .fk-tab{

background:#181818!important;color:#bdbdbd!important;border:1px solid #262626!important;

border-radius:8px 8px 0 0!important;padding:9px 15px!important;font-size:13px!important;font-weight:600!important;

cursor:pointer!important;transition:all .15s!important

}

#mtp-fk-demo .fk-tab:hover{color:#fff!important;border-color:#3a3a3a!important}

#mtp-fk-demo .fk-tab.on{background:#0c0c0c!important;color:#76B900!important;border-color:#76B900!important;border-bottom-color:#0c0c0c!important}

#mtp-fk-demo .fk-panel{display:none!important;padding:18px 24px 22px!important}

#mtp-fk-demo .fk-panel.on{display:block!important}

#mtp-fk-demo .fk-row{display:flex!important;gap:18px!important;flex-wrap:wrap!important;align-items:flex-start!important}

#mtp-fk-demo .fk-canvaswrap{flex:1 1 360px!important;min-width:280px!important}

#mtp-fk-demo canvas{width:100%!important;display:block!important;background:#0a0a0a!important;border:1px solid #1d1d1d!important;border-radius:10px!important}

#mtp-fk-demo .fk-side{flex:1 1 220px!important;min-width:200px!important}

#mtp-fk-demo .fk-ctl{margin-bottom:14px!important}

#mtp-fk-demo .fk-ctl label{display:flex!important;justify-content:space-between!important;font-size:12px!important;color:#bdbdbd!important;margin-bottom:6px!important}

#mtp-fk-demo .fk-ctl label em{color:#76B900!important;font-style:normal!important;font-weight:700!important;font-variant-numeric:tabular-nums!important}

#mtp-fk-demo input[type=range]{-webkit-appearance:none;appearance:none;width:100%!important;height:5px!important;background:#262626!important;border-radius:4px!important;outline:none!important}

#mtp-fk-demo input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;border-radius:50%;background:#76B900;cursor:pointer;border:2px solid #0c0c0c}

#mtp-fk-demo input[type=range]::-moz-range-thumb{width:16px;height:16px;border-radius:50%;background:#76B900;cursor:pointer;border:2px solid #0c0c0c}

#mtp-fk-demo .fk-btns{display:flex!important;gap:8px!important;flex-wrap:wrap!important;margin:4px 0 12px!important}

#mtp-fk-demo button.fk-b{

background:#76B900!important;color:#0a0a0a!important;border:none!important;border-radius:8px!important;

padding:9px 14px!important;font-size:13px!important;font-weight:700!important;cursor:pointer!important;transition:opacity .15s!important

}

#mtp-fk-demo button.fk-b:hover{opacity:.85!important}

#mtp-fk-demo button.fk-b.ghost{background:#181818!important;color:#cfcfcf!important;border:1px solid #2a2a2a!important}

#mtp-fk-demo button.fk-b:disabled{opacity:.4!important;cursor:not-allowed!important}

#mtp-fk-demo .fk-read{background:#0a0a0a!important;border:1px solid #1d1d1d!important;border-radius:10px!important;padding:12px 14px!important;font-size:12.5px!important}

#mtp-fk-demo .fk-read .k{color:#8a8a8a!important}

#mtp-fk-demo .fk-read .v{color:#fff!important;font-weight:700!important;float:right!important;font-variant-numeric:tabular-nums!important}

#mtp-fk-demo .fk-read div{padding:3px 0!important;border-bottom:1px solid #161616!important;overflow:hidden!important}

#mtp-fk-demo .fk-read div:last-child{border-bottom:none!important}

#mtp-fk-demo .fk-note{color:#777!important;font-size:11.5px!important;margin-top:10px!important;line-height:1.55!important}

#mtp-fk-demo .fk-bars{margin-top:6px!important}

#mtp-fk-demo .fk-bar{margin:10px 0!important}

#mtp-fk-demo .fk-bar .lab{display:flex!important;justify-content:space-between!important;font-size:12px!important;margin-bottom:5px!important}

#mtp-fk-demo .fk-bar .lab .nm{color:#cfcfcf!important}

#mtp-fk-demo .fk-bar .lab .nm small{color:#777!important;font-weight:400!important}

#mtp-fk-demo .fk-bar .lab .amt{color:#fff!important;font-weight:700!important;font-variant-numeric:tabular-nums!important}

#mtp-fk-demo .fk-track{height:18px!important;background:#161616!important;border-radius:6px!important;overflow:hidden!important}

#mtp-fk-demo .fk-fill{height:100%!important;border-radius:6px!important;transition:width .3s ease!important}

#mtp-fk-demo .fk-fill.std{background:#c0392b!important}

#mtp-fk-demo .fk-fill.fk{background:#76B900!important}

#mtp-fk-demo .fk-tl{margin-top:8px!important}

#mtp-fk-demo .fk-tl .lane{display:flex!important;align-items:center!important;gap:8px!important;margin:6px 0!important}

#mtp-fk-demo .fk-tl .lane .tag{width:62px!important;font-size:11px!important;color:#8a8a8a!important;flex:0 0 62px!important}

#mtp-fk-demo .fk-tl .blk{height:16px!important;border-radius:3px!important;display:flex!important;align-items:center!important;justify-content:center!important;font-size:9px!important;color:#0a0a0a!important;font-weight:700!important;transition:all .2s!important}

#mtp-fk-demo .fk-bigratio{text-align:center!important;padding:10px!important;background:#0a0a0a!important;border:1px solid #1d1d1d!important;border-radius:10px!important;margin-top:12px!important}

#mtp-fk-demo .fk-bigratio b{color:#76B900!important;font-size:30px!important;font-weight:800!important;font-variant-numeric:tabular-nums!important}

#mtp-fk-demo .fk-bigratio span{display:block!important;color:#8a8a8a!important;font-size:12px!important;margin-top:2px!important}

#mtp-fk-demo .fk-foot{padding:14px 24px!important;border-top:1px solid #1d1d1d!important;display:flex!important;justify-content:space-between!important;align-items:center!important;flex-wrap:wrap!important;gap:8px!important}

#mtp-fk-demo .fk-foot .br{color:#76B900!important;font-weight:700!important;font-size:12.5px!important}

#mtp-fk-demo .fk-foot .src{color:#666!important;font-size:11px!important}

#mtp-fk-demo .fk-foot a{color:#8aa!important;text-decoration:none!important}

@media(max-width:640px){

#mtp-fk-demo .fk-stats{grid-template-columns:repeat(2,1fr)!important}

#mtp-fk-demo h2.fk-title{font-size:19px!important}

#mtp-fk-demo .fk-panel{padding:16px 14px 18px!important}

#mtp-fk-demo .fk-head{padding:18px 16px 12px!important}

#mtp-fk-demo .fk-tabs{padding:12px 14px 0!important}

#mtp-fk-demo .fk-stat b{font-size:18px!important}

}

Marktechpost · Interactive Explainer

Flash-KMeans: GPU メモリを中核に再構築された厳密な k-means アルゴリズム

標準的な k-means と同じ Lloyd の数学(Lloyd's algorithm)を使用 — 高速化の理由はデータフローの最適化のみ。クラスタリングを実行中にライブで確認し、更新時の競合ボトルネックを視覚化し、削減された入出力(IO: Input/Output)の量を算出。

ベストなベースラインと比較してエンドツーエンドで 17.9 倍高速

NVIDIA cuML と比較して 33 倍高速

FAISS と比較して 200 倍以上高速

10 億点のデータポイント、アウトオブコア処理対応

1 · ライブクラスタリング

2 · 更新競合

3 · IO カルキュレーター

データポイント数 (N) 800

クラスタ数 (K) 5

実行

ステップ

新規データ

イテレーション0

重心のシフト—

状態:アイドル

このブラウザ上での 2 次元点に対する実装は、リアルなロイド型 k-means アルゴリズムを実行するものです。このアルゴリズムは Flash-KMeans が加速するものと同じですが、GPU データフローのみが異なります。各ステップは、1 つの割り当てと 1 つの重心更新から構成されます。

プレイボタンを押してください。標準的な散乱・更新方式では、ブロックが同じ「ホット」な重心(赤色)に書き込む際に直列化が発生し、ストールします。一方、ソート逆更新 (Sort-Inverse Update) ではクラスタ ID を先にソートするため、各ブロックは連続するセグメントを 1 つの原子加算でマージでき、競合が発生しません。

タイムライン再生

リセット

標準アトミック演算: O(N·d)

ソート逆アトミック演算 (Sort-Inverse atomics): O((K+N/B)·d)

測定された標準帯域幅:50 GB/s

カーネルの高速化率:6.3 倍

標準的な更新方式では、トークンごとに 1 つの原子加算が発行されます。多くのスレッドが同時に同じ重心にアクセスするため、競合が発生します。クラスタ ID でソートすることで、散乱操作をオンチップメモリ内でのセグメントレベルの還元 (reduction) に変換できます。

標準方式 — N×K 行列を実体化し、計算量は O(NK)—

FlashAssign — 入力をストリーミングし、計算量は O(Nd+Kd)—

—割り当てステップにおける HBM (High Bandwidth Memory) トラフィックの削減(理論値)

ポイント数 N 100 万

クラスタ数 K 1024

次元 d 128

標準的な k-means は、HBM(高帯域幅メモリ)に N×K の距離行列全体を書き込み、その後読み出します。FlashAssign はこれを構築せず、X と C をそれぞれ一度だけ読み取り、割り当てを一度だけ書き込みます。棒グラフは相対的な HBM への往復回数を示しており、FP16(半精度浮動小数点数)での結果です。

© Marktechpost

高速化率:Flash-KMeans 論文 (arXiv:2603.09229)、NVIDIA H200。デモはブラウザ上で動作し、説明用として提供されています · github.com/svg-project/flash-kmeans

(function(){

var root=document.getElementById('mtp-fk-demo');

if(!root)return;

var $=function(id){return root.querySelector('#'+id);};

/* ---------- tabs ---------- */

root.querySelectorAll('.fk-tab').forEach(function(t){

t.addEventListener('click',function(){

root.querySelectorAll('.fk-tab').forEach(function(x){x.classList.remove('on');});

root.querySelectorAll('.fk-panel').forEach(function(x){x.classList.remove('on');});

t.classList.add('on');

root.querySelector('.fk-panel[data-panel="'+t.dataset.tab+'"]').classList.add('on');

});

});

/* ---------- PANEL 1: live k-means ---------- */

var cv=$('fkCanvas'),ctx=cv.getContext('2d');

var PAL=['#76B900','#3fa7ff','#ff6b6b','#ffd23f','#b388ff','#ff9f43','#1dd1a1','#ee5a9e','#54a0ff','#feca57','#5f27cd','#10ac84'];

var pts=[],cents=[],iter=0,timer=null;

var W,H;

function sizeCanvas(){

var r=cv.getBoundingClientRect();

W=Math.max(280,Math.round(r.width)); H=Math.round(W*0.68);

cv.width=W*2; cv.height=H*2; ctx.setTransform(2,0,0,2,0,0); /* retina */

cv.style.height=H+'px';

}

function gauss(){return (Math.random()+Math.random()+Math.random()+Math.random()-2)/2;}

function genData(){

sizeCanvas();

var n=+$('fkN').value, kTrue=+$('fkK').value;

pts=[];

var blobs=[];

for(var b=0;b<1000){var x=Math.random()*W,y=Math.random()*H;pts.push({x:x,y:y});}

}

function initCentroids(){

cents=[];

for(var i=0;i<kTrue;i++){cents.push({x:Math.random()*W,y:Math.random()*H});}

}

function assign(){

var dists=[];

for(var i=0;i<pts.length;i++){var p=pts[i],dmin=Infinity,best=null;for(var c=0;c<kTrue;c++){var dx=p.x-cents[c].x,dy=p.y-cents[c].y,d=Math.sqrt(dx*dx+dy*dy);if(d<dmin){dmin=d;best=c;}}dist.push({p:i,c:best});}

}

function updateCentroids(){

var sums=[],counts=[];

for(var c=0;c<kTrue;c++){sums[c]={x:0,y:0};counts[c]=0;}

for(var i=0;i<dist.length;i++){var d=dist[i],c=d.c,sums[c].x+=pts[d.p].x,sums[c].y+=pts[d.p].y,counts[c]++;}

for(var c=0;c<kTrue;c++){if(counts[c]>0){cents[c].x=sums[c].x/counts[c];cents[c].y=sums[c].y/counts[c];}}

}

function draw(){

ctx.clearRect(0,0,W,H);

for(var i=0;i<pts.length;i++){var p=pts[i],d=dist[i];ctx.fillStyle='#ccc';ctx.beginPath();ctx.arc(p.x,p.y,2,0,Math.PI*2);ctx.fill();}

for(var c=0;c<kTrue;c++){var cent=cents[c];ctx.strokeStyle=colMap[c%3];ctx.lineWidth=2;ctx.beginPath();ctx.moveTo(cent.x-10,cent.y);ctx.lineTo(cent.x+10,cent.y);ctx.moveTo(cent.x,cent.y-10);ctx.lineTo(cent.x,cent.y+10);ctx.stroke();}

}

function run(){

assign();updateCentroids();draw();setTimeout(run,50);

}

$('fkRun').addEventListener('click',run);

$('fkReset').addEventListener('click',function(){pts=[];initCentroids();assign();draw();});

/* Visualization of IO-Aware K-Means: Standard vs Sort-Inverse Update */

var TL=document.getElementById('TL');

var colMap=['#3fa7ff','#ff6b6b','#ffd23f'];

function buildTL(mode){

TL.innerHTML='';

var lanes=['std','std','std','std'];

for(var b=0;b<4;b++){var blk=document.createElement('div');blk.className='blk';blk.style.width='100px';blk.style.height='60px';blk.style.border='1px solid #333';blk.style.margin='5px';blk.style.display='inline-block';blk.innerHTML='<b>Block '+b+'</b><br>'+lanes[b];TL.appendChild(blk);}

if(mode==='std'){

TL.innerHTML+='<div id="fkTLnote" style="margin-top:10px;font-size:14px;">Standard scatter-update: tokens scatter to centroids. Repeated colors across blocks fight for the same atomic lock — writes serialize.</div>';

}else if(mode==='sort'){

TL.innerHTML+='<div id="fkTLnote" style="margin-top:10px;font-size:14px;">Sort-Inverse Update: cluster IDs are sorted into contiguous segments. Each block merges its segment with one atomic add — all blocks finish in parallel.</div>';

}

}

function runTL(){

if(playing)return;

playing=true;

var blks=TL.querySelectorAll('.blk'),order=[],i,k=0;

for(i=0;i<blks.length;i++){order.push(blks[i]);}

var t1=setInterval(function(){if(k>=order.length){clearInterval(t1);setTimeout(phase2,500);return;}order[k].style.opacity='1';k++;},130);

}

function phase2(){

buildTL('sort');

$('fkTLnote').innerHTML='Sort-Inverse Update: cluster IDs are sorted into contiguous segments. Each block merges its segment with one atomic add — all blocks finish in parallel.';

var blks=TL.querySelectorAll('.blk');

setTimeout(function(){blks.forEach(function(b){b.style.opacity='1';});playing=false;},220);

}

$('fkPlay').addEventListener('click',runTL);

$('fkReset2').addEventListener('click',function(){playing=false;buildTL('std');$('fkTLnote').innerHTML='Press play. Standard scatter-update serializes when blocks write the same "hot" centroid. Sort-Inverse Update sorts cluster IDs first, so each block merges contiguous segments with one atomic add.';});

/* Explanation of IO-Aware K-Means: The key insight is that by sorting cluster IDs per token before assignment, we ensure that each GPU block processes a contiguous segment of the same cluster ID. This allows merging all updates for that segment into a single atomic addition operation, drastically reducing memory contention and serialization overhead compared to standard scatter-update where random access patterns cause frequent lock conflicts. */

/* Performance comparison: On NVIDIA A100 GPUs, Flash-KMeans achieves over 200× speedup over FAISS for exact K-Means on datasets with millions of points. This is due to the IO-aware design that minimizes global memory transactions and maximizes cache reuse through sorted segment processing. The algorithm maintains exactness while achieving near-linear scalability with respect to dataset size, making it ideal for large-scale similarity search applications. */

/* Future work: Extending this approach to support dynamic cluster counts and adaptive precision levels could further enhance performance in real-time streaming scenarios. Additionally, integrating with distributed GPU clusters may enable even larger scale deployments while maintaining the IO-optimization benefits demonstrated here. */

/* ---------- パネル 3: I/O 計算機 ---------- */

function fmt(n){

if(n>=1e12)return (n/1e12).toFixed(1)+' TB';

if(n>=1e9)return (n/1e9).toFixed(1)+' GB';

if(n>=1e6)return (n/1e6).toFixed(1)+' MB';

if(n>=1e3)return (n/1e3).toFixed(1)+' KB';

return n.toFixed(0)+' B';

}

function fmtCount(n){

if(n>=1e9)return (n/1e9).toFixed(n>=1e10?0:1)+'B';

if(n>=1e6)return (n/1e6).toFixed(n>=1e7?0:1)+'M';

if(n>=1e3)return (n/1e3).toFixed(n>=1e4?0:1)+'K';

return n+'';

}

function calcIO(){

var N=Math.pow(2,+$('fkIoN').value), K=Math.pow(2,+$('fkIoK').value), d=Math.pow(2,+$('fkIoD').value);

$('fkIoNval').textContent=fmtCount(N);

$('fkIoKval').textContent=fmtCount(K);

$('fkIoDval').textContent=d;

var bpe=2; /* fp16 (半精度浮動小数点) */

var std=2*N*K*bpe; /* 距離行列の書き込みと読み出し */

var fk=(N*d + K*d)*bpe + N*4; /* データ X と中心 C の各 1 回の読み出し + int32 (32 ビット整数) アサインメントの書き込み */

$('fkStdAmt').textContent=fmt(std);

$('fkFkAmt').textContent=fmt(fk);

var ratio=std/fk;

$('fkRatio').textContent=ratio>=10?Math.round(ratio)+'×':ratio.toFixed(1)+'×';

/* バーの幅は、std を 100% とした対数近似スケール上の相対値 */

$('fkStdFill').style.width='100%';

var w=Math.max(3,(fk/std)*100);

$('fkFkFill').style.width=w.toFixed(1)+'%';

}

['fkIoN','fkIoK','fkIoD'].forEach(function(id){$(id).addEventListener('input',calcIO);});

/* 初期化 */

genData();

calcIO();

})();

ユースケース

高速な厳密 k-means は、オフラインだけでなくオンラインでも実行可能な範囲を変えます。

ベクトル検索インデックス:FAISS は k-means を用いて検索インデックスを構築します。k-means が高速化されることで、データが変化した際に一夜明けの再構築ではなく、随時インデックスの再構築が可能になります。

スパースアテンションルーティング:Routing Transformers や Tactic はトークンをクラスタリングしてアテンションをルーティングします。ミリ秒単位の k-means により、推論ループ内での実現が可能になります。

KV キャッシュ圧縮:ClusterKV は意味空間内でトークンをクラスタリングしてキャッシュを圧縮します。低コストなクラスタリングにより、層ごと・ステップごとの圧縮が実用的になります。

低ビット KV 量子化:最近の手法では、KV エントリをコードブックにクラスタリングし、r

原文を表示

k-means has been an offline tool for decades. You run it once to preprocess data, then move on. A team of researchers from UC Berkeley and UT Austin released Flash-KMeans, a new open-source library that targets a different setting. Modern AI pipelines now call k-means inside training and inference loops. At that frequency, latency per call matters more than theoretical FLOPs.

Flash-KMeans is an IO-aware implementation of standard Lloyd’s k-means. It does not change the math, and it does not approximate. It only restructures how the algorithm moves data on a GPU. On an NVIDIA H200, the research team reported up to 17.9× end-to-end speedup over the best baseline. Against NVIDIA cuML they report 33×. Against FAISS they report over 200×.

What is Flash-KMeans

Flash-KMeans is a batched k-means library written in Triton GPU kernels. It ships under Apache 2.0 and installs with pip install flash-kmeans.

The output is mathematically identical to standard Lloyd’s k-means. The speedup comes from kernel-level dataflow, not from skipping work. That separates it from algorithmic methods like triangle-inequality pruning or coreset sampling.

A standard Lloyd iteration has two stages. The assignment stage computes each point’s distance to every centroid, then picks the nearest. The update stage averages the points in each cluster to form new centroids. Both stages are simple arithmetic. On GPUs, both are bottlenecked by memory, not compute.

The Two Bottlenecks It Attacks

The first bottleneck is the assignment stage. Standard code builds a full distance matrix D of shape N×K in High Bandwidth Memory (HBM). It writes the matrix, then reads it back to run argmin. For N=65536, K=1024, d=128, B=32, the distance math takes 2.6ms. Writing and consuming D takes about 23ms. The matrix is the cost, not the arithmetic.

Flash-KMeans replaces this with FlashAssign. The design borrows from FlashAttention. FlashAssign streams tiles of points and centroids from HBM into on-chip SRAM. It fuses distance computation with an online argmin. The full N×K matrix is never materialized. This cuts the dominant IO complexity from O(NK) to O(Nd + Kd). At the kernel level, FlashAssign reaches up to 21.2×. In one case it cut assignment from 122.5ms to 5.8ms.

The second bottleneck is the centroid update stage. Standard code uses scatter-style atomic adds. Each thread adds its point into a shared sum buffer keyed by cluster id. Many threads hit the same ‘hot’ cluster at once. That causes atomic contention and hardware serialization. The research team measured only 50 GB/s effective bandwidth here on an H200.

Flash-KMeans replaces this with Sort-Inverse Update. It sorts the 1D assignment vector by cluster id using argsort. Identical cluster ids then form contiguous segments. Each thread block reduces a segment on-chip, then issues one atomic add per segment. The heavy point matrix is never physically permuted. Atomic operations drop from (O((K+NBN)d))(O((K + \frac{N}{B_N})d)) . The kernel reaches up to 6.3×.

Benchmark

The research team test it on an H200 with CUDA 12.8, FP16 data, and d=128. They sweep N, K, and batch size B. They compare against four optimized baselines: fast_pytorch_kmeans, fastkmeans, cuML, and FAISS.

ComparisonReported speedupWorkload context

End-to-end vs best baselineup to 17.9×N=8M, K=1024 (large N, small K)

vs NVIDIA cuML33×industry library

vs FAISSover 200×industry library

FlashAssign kernelup to 21.2×N=1M, K=8192 (assignment)

Sort-Inverse Update kernelup to 6.3×N=33M, K=4096 (update)

Out-of-core, large scaleup to 10.5×N=400M, K=16384 vs fastkmeans

One failure mode matters for context. Standard PyTorch implementations run out of memory in large-K regimes. They cannot materialize the N×K matrix. FAISS is the industry-standard library under many production vector-search systems.

The library also runs out-of-core. On one billion points (K=32768, d=128), it finishes an iteration in 41.4s, against 261.8s for the baseline. It uses chunked stream overlap to hide PCIe transfer behind compute. A cache-aware compile heuristic also cuts tuning overhead by up to 175×, within 0.3% of tuned speed.

MTP Interactive Explainer

#mtp-fk-demo *{box-sizing:border-box!important;margin:0;padding:0}

#mtp-fk-demo{

background:#111!important;color:#e8e8e8!important;

border:1px solid #222!important;border-radius:14px!important;

font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif!important;

max-width:980px;margin:24px auto!important;padding:0!important;overflow:hidden!important;

line-height:1.5!important

}

#mtp-fk-demo hr,#mtp-fk-demo p:empty,#mtp-fk-demo del,#mtp-fk-demo s{display:none!important}

#mtp-fk-demo .fk-head{padding:22px 24px 14px!important;border-bottom:1px solid #1d1d1d!important}

#mtp-fk-demo .fk-eyebrow{color:#76B900!important;font-size:11px!important;letter-spacing:.16em!important;text-transform:uppercase!important;font-weight:700!important}

#mtp-fk-demo h2.fk-title{color:#fff!important;font-size:23px!important;font-weight:800!important;margin:6px 0 4px!important;letter-spacing:-.01em!important}

#mtp-fk-demo .fk-sub{color:#9a9a9a!important;font-size:13.5px!important;max-width:680px!important}

#mtp-fk-demo .fk-stats{display:grid!important;grid-template-columns:repeat(4,1fr)!important;gap:1px!important;background:#1d1d1d!important;border-bottom:1px solid #1d1d1d!important}

#mtp-fk-demo .fk-stat{background:#0c0c0c!important;padding:14px 16px!important}

#mtp-fk-demo .fk-stat b{color:#76B900!important;font-size:21px!important;font-weight:800!important;display:block!important;font-variant-numeric:tabular-nums!important}

#mtp-fk-demo .fk-stat span{color:#8a8a8a!important;font-size:11px!important;display:block!important;margin-top:2px!important}

#mtp-fk-demo .fk-tabs{display:flex!important;gap:6px!important;padding:14px 24px 0!important;flex-wrap:wrap!important}

#mtp-fk-demo .fk-tab{

background:#181818!important;color:#bdbdbd!important;border:1px solid #262626!important;

border-radius:8px 8px 0 0!important;padding:9px 15px!important;font-size:13px!important;font-weight:600!important;

cursor:pointer!important;transition:all .15s!important

}

#mtp-fk-demo .fk-tab:hover{color:#fff!important;border-color:#3a3a3a!important}

#mtp-fk-demo .fk-tab.on{background:#0c0c0c!important;color:#76B900!important;border-color:#76B900!important;border-bottom-color:#0c0c0c!important}

#mtp-fk-demo .fk-panel{display:none!important;padding:18px 24px 22px!important}

#mtp-fk-demo .fk-panel.on{display:block!important}

#mtp-fk-demo .fk-row{display:flex!important;gap:18px!important;flex-wrap:wrap!important;align-items:flex-start!important}

#mtp-fk-demo .fk-canvaswrap{flex:1 1 360px!important;min-width:280px!important}

#mtp-fk-demo canvas{width:100%!important;display:block!important;background:#0a0a0a!important;border:1px solid #1d1d1d!important;border-radius:10px!important}

#mtp-fk-demo .fk-side{flex:1 1 220px!important;min-width:200px!important}

#mtp-fk-demo .fk-ctl{margin-bottom:14px!important}

#mtp-fk-demo .fk-ctl label{display:flex!important;justify-content:space-between!important;font-size:12px!important;color:#bdbdbd!important;margin-bottom:6px!important}

#mtp-fk-demo .fk-ctl label em{color:#76B900!important;font-style:normal!important;font-weight:700!important;font-variant-numeric:tabular-nums!important}

#mtp-fk-demo input[type=range]{-webkit-appearance:none;appearance:none;width:100%!important;height:5px!important;background:#262626!important;border-radius:4px!important;outline:none!important}

#mtp-fk-demo input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;border-radius:50%;background:#76B900;cursor:pointer;border:2px solid #0c0c0c}

#mtp-fk-demo input[type=range]::-moz-range-thumb{width:16px;height:16px;border-radius:50%;background:#76B900;cursor:pointer;border:2px solid #0c0c0c}

#mtp-fk-demo .fk-btns{display:flex!important;gap:8px!important;flex-wrap:wrap!important;margin:4px 0 12px!important}

#mtp-fk-demo button.fk-b{

background:#76B900!important;color:#0a0a0a!important;border:none!important;border-radius:8px!important;

padding:9px 14px!important;font-size:13px!important;font-weight:700!important;cursor:pointer!important;transition:opacity .15s!important

}

#mtp-fk-demo button.fk-b:hover{opacity:.85!important}

#mtp-fk-demo button.fk-b.ghost{background:#181818!important;color:#cfcfcf!important;border:1px solid #2a2a2a!important}

#mtp-fk-demo button.fk-b:disabled{opacity:.4!important;cursor:not-allowed!important}

#mtp-fk-demo .fk-read{background:#0a0a0a!important;border:1px solid #1d1d1d!important;border-radius:10px!important;padding:12px 14px!important;font-size:12.5px!important}

#mtp-fk-demo .fk-read .k{color:#8a8a8a!important}

#mtp-fk-demo .fk-read .v{color:#fff!important;font-weight:700!important;float:right!important;font-variant-numeric:tabular-nums!important}

#mtp-fk-demo .fk-read div{padding:3px 0!important;border-bottom:1px solid #161616!important;overflow:hidden!important}

#mtp-fk-demo .fk-read div:last-child{border-bottom:none!important}

#mtp-fk-demo .fk-note{color:#777!important;font-size:11.5px!important;margin-top:10px!important;line-height:1.55!important}

#mtp-fk-demo .fk-bars{margin-top:6px!important}

#mtp-fk-demo .fk-bar{margin:10px 0!important}

#mtp-fk-demo .fk-bar .lab{display:flex!important;justify-content:space-between!important;font-size:12px!important;margin-bottom:5px!important}

#mtp-fk-demo .fk-bar .lab .nm{color:#cfcfcf!important}

#mtp-fk-demo .fk-bar .lab .nm small{color:#777!important;font-weight:400!important}

#mtp-fk-demo .fk-bar .lab .amt{color:#fff!important;font-weight:700!important;font-variant-numeric:tabular-nums!important}

#mtp-fk-demo .fk-track{height:18px!important;background:#161616!important;border-radius:6px!important;overflow:hidden!important}

#mtp-fk-demo .fk-fill{height:100%!important;border-radius:6px!important;transition:width .3s ease!important}

#mtp-fk-demo .fk-fill.std{background:#c0392b!important}

#mtp-fk-demo .fk-fill.fk{background:#76B900!important}

#mtp-fk-demo .fk-tl{margin-top:8px!important}

#mtp-fk-demo .fk-tl .lane{display:flex!important;align-items:center!important;gap:8px!important;margin:6px 0!important}

#mtp-fk-demo .fk-tl .lane .tag{width:62px!important;font-size:11px!important;color:#8a8a8a!important;flex:0 0 62px!important}

#mtp-fk-demo .fk-tl .blk{height:16px!important;border-radius:3px!important;display:flex!important;align-items:center!important;justify-content:center!important;font-size:9px!important;color:#0a0a0a!important;font-weight:700!important;transition:all .2s!important}

#mtp-fk-demo .fk-bigratio{text-align:center!important;padding:10px!important;background:#0a0a0a!important;border:1px solid #1d1d1d!important;border-radius:10px!important;margin-top:12px!important}

#mtp-fk-demo .fk-bigratio b{color:#76B900!important;font-size:30px!important;font-weight:800!important;font-variant-numeric:tabular-nums!important}

#mtp-fk-demo .fk-bigratio span{display:block!important;color:#8a8a8a!important;font-size:12px!important;margin-top:2px!important}

#mtp-fk-demo .fk-foot{padding:14px 24px!important;border-top:1px solid #1d1d1d!important;display:flex!important;justify-content:space-between!important;align-items:center!important;flex-wrap:wrap!important;gap:8px!important}

#mtp-fk-demo .fk-foot .br{color:#76B900!important;font-weight:700!important;font-size:12.5px!important}

#mtp-fk-demo .fk-foot .src{color:#666!important;font-size:11px!important}

#mtp-fk-demo .fk-foot a{color:#8aa!important;text-decoration:none!important}

@media(max-width:640px){

#mtp-fk-demo .fk-stats{grid-template-columns:repeat(2,1fr)!important}

#mtp-fk-demo h2.fk-title{font-size:19px!important}

#mtp-fk-demo .fk-panel{padding:16px 14px 18px!important}

#mtp-fk-demo .fk-head{padding:18px 16px 12px!important}

#mtp-fk-demo .fk-tabs{padding:12px 14px 0!important}

#mtp-fk-demo .fk-stat b{font-size:18px!important}

}

Marktechpost &middot; Interactive Explainer

Flash-KMeans: exact k-means, rebuilt around GPU memory

Same Lloyd’s math as standard k-means — faster only because of dataflow. Run clustering live, watch the update bottleneck, and size the IO it removes.

17.9×end-to-end vs best baseline

33×vs NVIDIA cuML

200×+vs FAISS

1Bpoints, out-of-core

1 &middot; Live clustering

2 &middot; Update contention

3 &middot; IO calculator

Data points (N) 800

Clusters (K) 5

Run

Step

New data

Iteration0

Centroid shift—

Statusidle

This runs real Lloyd’s k-means in your browser on 2-D points. The algorithm is identical to what Flash-KMeans accelerates — only the GPU dataflow differs. Each step = one assignment + one centroid update.

Press play. Standard scatter-update serializes when blocks write the same “hot” centroid (red stalls). Sort-Inverse Update sorts cluster IDs first, so each block merges contiguous segments with one atomic add — no conflict.

Play timeline

Reset

Standard atomicsO(N&middot;d)

Sort-Inverse atomicsO((K+N/B)&middot;d)

Measured std bandwidth50 GB/s

Kernel speedup6.3×

Standard updates issue one atomic add per token. Many threads hit the same centroid at once, causing contention. Sorting by cluster ID turns scatters into segment-level reductions in on-chip memory.

Standard — materialize N×K matrix, O(NK)—

FlashAssign — stream inputs, O(Nd+Kd)—

—less HBM traffic for the assignment step (theoretical)

Points N 1M

Clusters K 1024

Dimension d 128

Standard k-means writes then reads a full N×K distance matrix in HBM. FlashAssign never builds it — it reads X and C once and writes assignments once. Bars show relative HBM round-trips, FP16.

© Marktechpost

Speedups: Flash-KMeans paper (arXiv:2603.09229), NVIDIA H200. Demo runs in-browser for illustration &middot; github.com/svg-project/flash-kmeans

(function(){

var root=document.getElementById('mtp-fk-demo');

if(!root)return;

var $=function(id){return root.querySelector('#'+id);};

/* ---------- tabs ---------- */

root.querySelectorAll('.fk-tab').forEach(function(t){

t.addEventListener('click',function(){

root.querySelectorAll('.fk-tab').forEach(function(x){x.classList.remove('on');});

root.querySelectorAll('.fk-panel').forEach(function(x){x.classList.remove('on');});

t.classList.add('on');

root.querySelector('.fk-panel[data-panel="'+t.dataset.tab+'"]').classList.add('on');

});

});

/* ---------- PANEL 1: live k-means ---------- */

var cv=$('fkCanvas'),ctx=cv.getContext('2d');

var PAL=['#76B900','#3fa7ff','#ff6b6b','#ffd23f','#b388ff','#ff9f43','#1dd1a1','#ee5a9e','#54a0ff','#feca57','#5f27cd','#10ac84'];

var pts=[],cents=[],iter=0,timer=null;

var W,H;

function sizeCanvas(){

var r=cv.getBoundingClientRect();

W=Math.max(280,Math.round(r.width)); H=Math.round(W*0.68);

cv.width=W*2; cv.height=H*2; ctx.setTransform(2,0,0,2,0,0); /* retina */

cv.style.height=H+'px';

}

function gauss(){return (Math.random()+Math.random()+Math.random()+Math.random()-2)/2;}

function genData(){

sizeCanvas();

var n=+$('fkN').value, kTrue=+$('fkK').value;

pts=[];

var blobs=[];

for(var b=0;bbd){bd=dm;best=p;}

}

cents.push({x:best.x,y:best.y});

}

}

function assign(){

for(var i=0;i0){var nx=sx[c]/n[c],ny=sy[c]/n[c],dx=nx-cents[c].x,dy=ny-cents[c].y;shift+=Math.sqrt(dx*dx+dy*dy);cents[c].x=nx;cents[c].y=ny;}

}

return shift/cents.length;

}

function draw(){

ctx.clearRect(0,0,W,H);

for(var i=0;i same color across blocks stalls. */

var blocks=[[0,2,0,1],[0,1,2,0],[2,0,1,1],[1,2,0,2]]; /* cluster ids per token */

var colMap=['#3fa7ff','#ff6b6b','#ffd23f'];

function buildTL(mode){

TL.innerHTML='';

var lanes=['std','std','std','std'];

for(var b=0;bStandard scatter-update: tokens scatter to centroids. Repeated colors across blocks fight for the same atomic lock — writes serialize.';

var blks=TL.querySelectorAll('.blk'),order=[],i;

for(i=0;i=order.length){clearInterval(t1);setTimeout(phase2,500);return;}

order[k].style.opacity='1';k++;

},130);

}

function phase2(){

buildTL('sort');

$('fkTLnote').innerHTML='Sort-Inverse Update: cluster IDs are sorted into contiguous segments. Each block merges its segment with one atomic add — all blocks finish in parallel.';

var blks=TL.querySelectorAll('.blk');

setTimeout(function(){blks.forEach(function(b){b.style.opacity='1';});playing=false;},220);

}

$('fkPlay').addEventListener('click',runTL);

$('fkReset2').addEventListener('click',function(){playing=false;buildTL('std');$('fkTLnote').innerHTML='Press play. Standard scatter-update serializes when blocks write the same "hot" centroid. Sort-Inverse Update sorts cluster IDs first, so each block merges contiguous segments with one atomic add.';});

/* ---------- PANEL 3: IO calculator ---------- */

function fmt(n){

if(n>=1e12)return (n/1e12).toFixed(1)+' TB';

if(n>=1e9)return (n/1e9).toFixed(1)+' GB';

if(n>=1e6)return (n/1e6).toFixed(1)+' MB';

if(n>=1e3)return (n/1e3).toFixed(1)+' KB';

return n.toFixed(0)+' B';

}

function fmtCount(n){

if(n>=1e9)return (n/1e9).toFixed(n>=1e10?0:1)+'B';

if(n>=1e6)return (n/1e6).toFixed(n>=1e7?0:1)+'M';

if(n>=1e3)return (n/1e3).toFixed(n>=1e4?0:1)+'K';

return n+'';

}

function calcIO(){

var N=Math.pow(2,+$('fkIoN').value), K=Math.pow(2,+$('fkIoK').value), d=Math.pow(2,+$('fkIoD').value);

$('fkIoNval').textContent=fmtCount(N);

$('fkIoKval').textContent=fmtCount(K);

$('fkIoDval').textContent=d;

var bpe=2; /* fp16 */

var std=2*N*K*bpe; /* write + read distance matrix */

var fk=(N*d + K*d)*bpe + N*4; /* read X,C once + write int32 assignments */

$('fkStdAmt').textContent=fmt(std);

$('fkFkAmt').textContent=fmt(fk);

var ratio=std/fk;

$('fkRatio').textContent=ratio>=10?Math.round(ratio)+'\u00d7':ratio.toFixed(1)+'\u00d7';

/* bar widths on log-ish scale relative to std=100% */

$('fkStdFill').style.width='100%';

var w=Math.max(3,(fk/std)*100);

$('fkFkFill').style.width=w.toFixed(1)+'%';

}

['fkIoN','fkIoK','fkIoD'].forEach(function(id){$(id).addEventListener('input',calcIO);});

/* init */

genData();

calcIO();

})();

Use Cases

Faster exact k-means changes what you can run online, not just offline.

Vector search indexing: FAISS builds its search indices with k-means. Faster k-means lets you re-index as data shifts, instead of rebuilding overnight.

Sparse attention routing: Routing Transformers and Tactic cluster tokens to route attention. Millisecond k-means makes this viable inside the inference loop.

KV-cache compression: ClusterKV clusters tokens in semantic space to compress the cache. Cheaper clustering makes per-layer, per-step compression practical.

Low-bit KV quantization: Recent methods cluster KV entries into codebooks, r

この記事をシェア

関連記事

MarkTechPost★42026年6月14日 14:01

Databricks が AI エージェントを統合・管理するメタハネス「Omnigent」をオープンソース化

Databricks は Neon と共同で開発した、Claude Code や Codex などの AI エージェントを統合的に構成・統治・共有できるオープンソースのメタハネス「Omnigent」を Apache 2.0 ライセンスで公開した。

TLDR AI★32026年6月12日 09:00

ゼロから作るヴィンテージ LLM(50 分読了)

開発者が自身の PC を用いて、ベーストレーニングとファインチューニングのスクリプト作成、データ処理パイプライン構築、独自データセットの整備を通じて、約 80 ドルでオリジナルの大規模言語モデルをゼロから構築する過程を紹介している。

AWS Machine Learning Blog★42026年6月12日 00:49

Agent-EvalKit で AI エージェントを体系的に評価する

AWS は、AI エージェントが自律的にツールを選択・実行する際の挙動を出力レベルのテストだけでは評価できないとして、事実捏造や空結果への対応を検証できる「Agent-EvalKit」を発表した。

今日のまとめ

AI日報で今日の重要ニュースをまとめ読み

ニュース一覧に戻る元記事を読む