Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Binary and Scalar Embedding Quantization for Si...
Search
Shunsuke Kanda
May 17, 2024
Technology
2
400
Binary and Scalar Embedding Quantization for Significantly Faster & Cheaper Retrieval
https://huggingface.co/blog/embedding-quantization
Shunsuke Kanda
May 17, 2024
Tweet
Share
More Decks by Shunsuke Kanda
See All by Shunsuke Kanda
Leveraging LLMs for Unsupervised Dense Retriever Ranking (SIGIR 2024)
kampersanda
2
380
Lucene/Elasticsearch の Character Filter でユニコード正規化するとトークンのオフセットがズレるバグへの Workaround - Search Engineering Tech Talk 2024 Spring
kampersanda
0
1.4k
トライとダブル配列の基礎
kampersanda
1
1.2k
Binary search with modern processors
kampersanda
33
14k
AIP Open Seminar #6
kampersanda
0
230
ICDM2020
kampersanda
0
210
SIGSPATIAL20
kampersanda
0
200
EliasFano
kampersanda
1
240
Fast Succinct Trie
kampersanda
1
720
Other Decks in Technology
See All in Technology
「現場で活躍するAIエージェント」を実現するチームと開発プロセス
tkikuchi1002
6
950
"Découvrir le Liberland"
rlifchitz
0
130
自分がLinc’wellで提供しているプロダクトを理解するためにやったこと
murabayashi
1
150
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
3
18k
Shadow DOMとセキュリティ - 光と影の境界を探る / Shibuya.XSS techtalk #13
masatokinugawa
0
240
MCP とマネージド PaaS で実現する大規模 AI アプリケーションの高速開発
nahokoxxx
1
1.3k
AI Ready API ─ AI時代に求められるAPI設計とは?/ AI-Ready API - Designing MCP and APIs in the AI Era
yokawasa
20
5.6k
エンジニアリングマネージャー“お悩み相談”パネルセッション
ar_tama
1
570
RapidPen: AIエージェントによる高度なペネトレーションテスト自動化の研究開発
laysakura
1
370
DATA+AI SummitとSnowflake Summit: ユーザから見た共通点と相違点 / DATA+AI Summit and Snowflake Summit
nttcom
0
150
20250718_ITSurf_“Bet AI”を支える文化とコストマネジメント
helosshi
1
190
SREを知らずに SREマネージャーになった話 / How I Became an SRE Manager Without Knowing What SRE Is
moneyforward
0
250
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
54
13k
GraphQLとの向き合い方2022年版
quramy
49
14k
Thoughts on Productivity
jonyablonski
69
4.7k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Making Projects Easy
brettharned
116
6.3k
Embracing the Ebb and Flow
colly
86
4.8k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Six Lessons from altMBA
skipperchong
28
3.9k
Into the Great Unknown - MozCon
thekraken
40
1.9k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
54k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
108
19k
Agile that works and the tools we love
rasmusluckow
329
21k
Transcript
Binary and Scalar Embedding Quantization for Significantly Faster & Cheaper
Retrieval Aamir Shakir, Tom Aarsen, and SeanLee https://huggingface.co/blog/embedding-quantization 発表者:Kampersanda
Summary 文埋め込みの各値を量子化してコンパクトに持ってみる • Binary Quantization (1 bit) • Scalar Quantization
(8 bits) Efficiency & Effectiveness にどれくらい影響がある?
背景 埋め込み(Embeddings)の保存には結構なメモリとお金が必要 ※ $3.8 per GB/mo with x2gd instances on
AWS
省メモリ化の方法 1. 次元数削減 • PCA • マトリョーシカ法 • など 2.
要素圧縮 • Quantization (Binary & Scalar) • など あとは LSH や Product Quantization などなど 今日のテーマ
Binary Quantization 方法 • 値の符号によって各要素を 0 or 1 に変換 •
距離計算はハミング距離(異なるビットの数) 以上です
Binary Quantization – Sentence Transformersでは
Binary Quantization – Vector Databasesでは
Scalar (int8) Quantization 手順 1. Calibration Dataset から各次元 について min,
max を算出 2. その範囲で値を 256 等分に (バケット化) 注意点 • Calibration Dataset は量子化バ ケットを定義するため、性能に 影響する
Scalar (int8) Quantization – Sentence Transformersでは
Scalar (int8) Quantization – Vector Databasesでは
リランキングによる検索精度改善 [Yamada et al., ACL21] 前提 • データベースには量子化されたベクトルが格納されている 手順 1.
検索ステップ ◦ クエリ埋め込みを量子化し、量子化されたドキュメントのデータベース に対してベクトル検索 ◦ K件より多めに取ってくる 2. リランキング ◦ 量子化する前のクエリ埋め込みと、量子化されたドキュメントとで内積 を再計算しリランキング
TopK検索の実験結果 • BinaryはTop400をリランキング • Scalar (int8) はリランキング無し
リランキングの実験結果 Binary Quantization • リランキング無しでは 92.53% • リランキングすると 96.45%(検索での件数を100〜1000にしても変化なし)
リランキングの実験結果 Scalar (int8) Quantization 400件 1000件 リランキング無し
速度の実験結果(次元数1024) • Binary Quantization: Faiss (Version 1.8.0) • Scalar (int8)
Quantization: USearch (Version 2.9.2)
まとめ 話さなかったこと • Binary と Scalar (int8) のハイブリットな方法 See Section
“Combining Binary and Scalar Quantization”