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
Rust製ベクトル検索エンジンQdrant / qdrant-rust-vector-search
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Junichi Sato
January 24, 2022
Programming
810
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rust製ベクトル検索エンジンQdrant / qdrant-rust-vector-search
Junichi Sato
January 24, 2022
More Decks by Junichi Sato
See All by Junichi Sato
React Nativeを使ったリアルタイム配信サービスの開発 / React-Native-Matsuri-2021-BAKOON-Development
sat0b
0
1.5k
React NativeとFirebaseを使ったアプリ開発 / App Development using React Native and Firebase
sat0b
1
1.1k
React Nativeで新規事業開発に挑戦した話 / Challenging New Business Development with React Native
sat0b
0
970
Other Decks in Programming
See All in Programming
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
400
ALB ログから Trace を気合で繋げる技術
fohte
7
780
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
590
「つくるAI」だけではバグは見つからない ~テストに必要な「見つけるAI」を分離させる戦略~
mfunaki
0
200
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
5
550
私のClaude Code活用法 (個人開発編) - PHPerKaigi mini #4(2026/08/24)
panda_program
1
190
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
240
引き算の組織 ― アウトカムとAIに全振りするために辞めたこと ― / Organization by Subtraction
hirokiyamamoto14
PRO
0
320
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
120
仕様駆動開発の消費期限
watany
20
9.1k
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
450
Featured
See All Featured
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
660
Technical Leadership for Architectural Decision Making
baasie
3
540
The Pragmatic Product Professional
lauravandoore
37
7.4k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
670
Designing Powerful Visuals for Engaging Learning
tmiket
1
520
Everyday Curiosity
cassininazir
0
300
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
540
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
290
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.1k
Transcript
Rust製ベクトル検索エンジン Qdrantの紹介 Junichi Sato
発表の概要 • ベクトル検索エンジンとは ◦ ベクトル検索技術 • Qdrantについて ◦ 機能の紹介 •
Qdrantコードを読んでみて ◦ Rust初心者の視点で良いと思ったところ
自己紹介 • 佐藤純一 ◦ note: https://note.com/sat0b3ee • 類似画像検索に興味あり ◦ 先週、類似画像検索の本が
技術の泉シリーズで販売されました • Rustは入門したばかり ※ Qdrantの直接の関係者ではないです
ベクトル検索エンジンとは何か • 近似最近傍探索(ANN)の技術を利用して、 大規模なベクトルデータの中から近似ベクトルを探す • 活用例 ◦ 類似画像検索 ◦ セマンティックテキスト検索
• 代表的なベクトル検索エンジン(サービス) ◦ Milvus (Go) ◦ Vald (Go) ◦ Elasticsearch KNN (Java) ◦ Qdrant (Rust) 参考) https://github.com/currentsapi/awesome-vector-search
類似画像検索での活用例 ANN インデックス 数百万 ~ 数十億スケール 画像 Deep Learning 画像のベクトル化
[0.0232, -0.832, …, ]
ベクトル検索エンジンの課題 • 一般的なベクトル検索では「絞り込み」が利用できないことが多い ◦ 全文検索エンジンではよく使う機能 (Apache SolrやElasticsearchなど) ▪ 機能要件的によくある ◦
ECサイトでの商品の類似画像検索の例: 「ストアAに絞り込んで類似画像を検索したい」 • 対処法 ◦ 検索を多めに引いて、後段でフィルタする ▪ ただし、ごっそり後段のフィルタで消えてしまう可能性がある ◦ フィルタ条件ごとにインデックスを分割する ▪ ただし、構築が大変、柔軟性がない
Qdrantについて • Rust製のベクトル検索エンジン ◦ フィルタ条件による絞り込み検索が可能 ◦ 高い信頼性と高いパフォーマンス • GitHubリポジトリ ◦
https://github.com/qdrant/qdrant • 公式のデモ ◦ https://demo.qdrant.tech/#/ ◦ セマンティック検索のデモ(クエリの意味を把握して結果を返す) 余談)現在、Rustの開発者を募集しているらしいです。(LinkedIn) https://github.com/qdrant/qdrant より
Qdrantの詳細 • APIを持つサービスとして起動 ◦ REST API or gRPC API •
フィルタ検索 ◦ HNSWを元にした条件付き検索 ▪ 文字列、数値、Geo、... ◦ should / must / must_not • 分散システム(シャーディングなど)はTodo ◦ https://qdrant.tech/documentation/distributed_deployment/
フィルタ付き検索 POST /collections/{collection_name}/points/search { “filter”: { “must”: [ { “key”:
“city”, “match”: { “keyword”: “London” } } ] }, “params”: { “hnsw_ef”: 128 }, “vector”: [0.2, 0.1, 0.9, 0.7], “top”: 3 } • HNSWアルゴリズムをベース としてフィルター可能に変更 例 • キーcityがLondon のエンティティのみを検索
Qdrantのコード (Rust) を読んでみて 良いなと思ったところ 1. 列挙型とパターンマッチ 2. 排他制御
列挙型とパターンマッチ • RustではEnumでさまざまな型のデータを持てる • 例: インデックスへのUpsertとDelete ◦ それぞれ異なる型のデータを統一的に処理 pub enum
PointOperations { /// Insert or update points UpsertPoints(PointInsertOperations), /// Delete point if exists DeletePoints { ids: Vec<PointIdType> }, } pub(crate) fn process_point_operation(...) -> CollectionResult<usize> { match point_operation { PointOperations::DeletePoints { ids, .. } => delete_points(&segments.read(), op_num, &ids), PointOperations::UpsertPoints(operation) => { let (ids, vectors, payloads) = match operation { ... コードの引用: https://github.com/qdrant/qdrant/blob/bf3d8c25753188b4ca5e69a13c7f26e3c383f05b/lib/collection/src/collection_manager/segments_updater.rs#L234-L265
排他制御 • マルチスレッドでインデックスにアクセスする場合は排他制御が必要 ◦ 読み込みは同時アクセス OK、書き込みは一度に一つだけ • Arc<RwLock<Segment>> ◦ 所有権システムにより、
データ競合を起こせない 、明示的にアンロック不要 ▪ (デッドロックは起きうるので注意は必要 ) • 該当部分抜粋 ◦ read()でリードロック ◦ write()でライトロック コードの引用: https://github.com/qdrant/qdrant/blob/0f91c9a5e29ef9065c79a20e0ace25be898beff8/lib/collection/src/collection_manager/holders/segment_holder.rs // read let read_segment = segment_arc.read(); f(point, &read_segment); // write let mut write_segment = segment_arc.write(); f(point_id, *idx, &mut write_segment)?
おわりに • Qdrantはきれいに書かれていて色々勉強になる