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
370
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
330
Lucene/Elasticsearch の Character Filter でユニコード正規化するとトークンのオフセットがズレるバグへの Workaround - Search Engineering Tech Talk 2024 Spring
kampersanda
0
1.3k
トライとダブル配列の基礎
kampersanda
0
1.1k
Binary search with modern processors
kampersanda
30
13k
AIP Open Seminar #6
kampersanda
0
220
ICDM2020
kampersanda
0
190
SIGSPATIAL20
kampersanda
0
180
EliasFano
kampersanda
1
220
Fast Succinct Trie
kampersanda
1
680
Other Decks in Technology
See All in Technology
ドキュメント管理の理想と現実
kazuhe
1
200
4/17/25 - CIJUG - Java Meets AI: Build LLM-Powered Apps with LangChain4j (part 2)
edeandrea
PRO
0
120
Notion x ポストモーテムで広げる組織の学び / Notion x Postmortem
isaoshimizu
1
120
新卒エンジニアがCICDをモダナイズしてみた話
akashi_sn
2
250
ブラウザのレガシー・独自機能を愛でる-Firefoxの脆弱性4選- / Browser Crash Club #1
masatokinugawa
1
490
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
120
より良い開発者体験を実現するために~開発初心者が感じた生成AIの可能性~
masakiokuda
0
200
AWSのマルチアカウント管理 ベストプラクティス最新版 2025 / Multi-Account management on AWS best practice 2025
ohmura
4
310
持続可能なドキュメント運用のリアル: 1年間の成果とこれから
akitok_
1
190
Dynamic Reteaming And Self Organization
miholovesq
3
550
ガバクラのAWS長期継続割引 ~次の4/1に慌てないために~
hamijay_cloud
1
260
白金鉱業Meetup_Vol.18_AIエージェント時代のUI/UX設計
brainpadpr
1
130
Featured
See All Featured
Faster Mobile Websites
deanohume
306
31k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.5k
Facilitating Awesome Meetings
lara
54
6.3k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
13
680
Site-Speed That Sticks
csswizardry
5
500
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
5
550
Bash Introduction
62gerente
611
210k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2k
Making Projects Easy
brettharned
116
6.1k
For a Future-Friendly Web
brad_frost
176
9.7k
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”