慣性聚合 高效追讀感興趣之博客、新聞、科技資訊
閱原文 以慣性聚合開啟

推薦訂閱源

博客园 - 司徒正美
V
V2EX
T
Tailwind CSS Blog
有赞技术团队
有赞技术团队
aimingoo的专栏
aimingoo的专栏
Apple Machine Learning Research
Apple Machine Learning Research
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
A
About on SuperTechFans
月光博客
月光博客
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
V
Visual Studio Blog
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python)
何故混合搜索乃吾辈常荐之沉闷之常态也
SapotaCorp · 2026-05-24 · via DEV Community

吾与之共事者,尝困于诡谲之败,旬有二日矣。内AI助,虽见"GPT-4o定价"之辞显于三处之向量数据库,然竟无所得。询"OpenAI模型之费",则得正果。复询"GPT-4o定价",反得十八月前GPT-3之议。

此乃纯向量式 RAG 系统之常弊。团队方欲更易嵌入模型。其实之解,仅三行配置而已。

向量检索者,实能善何事

密集向量检索于语义相似尤善。"如何取消我的订阅"与题为"账户终止程序"之文相合,盖因嵌入模型已习得二者语义相近。同义语、释义、跨语言匹配,皆可生效,盖因模型已睹文辞甚夥,知其意同也。

密集之矢,不善精符匹配,谓词于嵌入模型未尝多见,或异境所遇。 "GPT-4o" 乃近出之名,或未及于模型训练之时。模型视之为子词序列,未尝有强识为单元之念。若 "GPT-4o pricing" 与 "GPT-3 cost" 之余弦距,或反小于 "GPT-4o pricing" 自身之距,若后者现于迥异之境,则尤然。

此诚然也:

  • 产品之名,尤以近出者(Claude 4, Llama 3.2, GPT-4o)为甚。
  • 内文缩略语及代号(X100,PRJ-2024-Q3)
  • 代码文档中函数与标识符之名
  • 错误码与堆栈踪迹片段
  • 幽微之技语,限域独用者

此等查询,BM25(Lucene与Elasticsearch二秩所恃之关键词评分算法)远胜向量化搜索之效.

所谓混合搜索者,何也?

混合检索之法,兼行二者,合其果。向量化检索者,依余弦相似度,得前k;BM25检索者,据词频重叠之绩,亦得前k。复有合并之术(多见互惠秩融),将并集重排,为序列一。

互易秩融合之选,实有其故。此法无参,无重数可调,无归一化之扰。每篇之得,乃诸检索器中其现之1 / (k + rank)之和,k为小常(常为六十)。文篇若于二器皆居上秩,则浮于前;若仅居一器之上秩,犹现于合列,然位稍降。

欲以权重调整向量与BM25者(如言"0.7向量加0.3关键词"),常费一周调权,终悟RRF之召回率已近2%,实无需调权耳。

吾等默认所运

每新启RAG之项目,Sapota所设默认检索配置,乃混合RRF,非独向量,非独BM25,二者融而用之。

施为直捷,于堪用之向量数据库也。

  • Qdrant(Qdrant)自1.10版本起,已原生支持混合检索。汝当于稠密向量场旁定义一稀疏向量场,于索引时填充二者,于检索时查询二者。
  • Weaviate(韦维亚特)已内置混成之索,一而即成hybrid查询参数。
  • Elasticsearch若不介意运行Elasticsearch,则其密集向量字段可实现此功能。

若团队已使用不支持混合搜索的向量数据库(如旧版Pinecone、Chroma、FAISS),则可借助轻量级库(Python之rank_bm25适用于百万文档以下)另建BM25索引,并在应用代码中合并。延迟开销约30%,值得。

纯粹之矢足矣

吾辈非恒荐混合。矢唯一足为当者:

  • 其文纯为自然语言之散文,无罕见之标识(常识内容、客户服务FAQ不提产品名、内部政策文书)。
  • 此查询分布实为释义繁重(用户以五十种不同方式询问同一事,而期系统知其意同)。
  • 此语料库甚小(不足一万份文书),故BM25之扰胜于其精准之益。

此皆实事。亦较诸队所想为稀。众制文语多含商号,兼有术语,更有罕而要之识名。混成之法,兼治此三者,未损密矢之语义强。

何者易其始创者乎

观其病,既见评估之失,十五分钟而得诊断。其治,三变而已。

  1. 于既有之Qdrant集合中增稀疏向量之域。
  2. 以既有嵌入模型暨BM25稀疏编码器(Qdrant支持Bm25为内置稀疏模型)复索引之。
  3. 更应用之搜索呼由单密查询转为RRF融合之混查询。

航行之时半日耳。不逮之问类,其召回率自三十以下跃至九十以上。已效之问,其召回率则平。迟滞自八十毫秒增至一百一十毫秒于p50处。

始创者问何以非为常制。答曰:凡向量数据库之教程及入门指南,多首倡纯密集向量检索,盖因其新而可喜也。BM25乃二十载旧术,非所欣羡。二者合之,不值供应商自署之博文,故多队未尝知此合实为生产所求。

谨记稀疏编码之注

超越傳統之BM25,有新式「學習稀疏」之編碼器(SPLADE、BGE-M3稀疏模式),藉變換器之模態產生稀疏向量。此等於多數基準測試中勝過BM25,堪為v2系統所考量。

v1之用,BM25已足。學習稀疏編碼之微進,不若增任何稀疏檢索之進步為大。

若汝之索求,失其当显

若汝之AI助者,不能寻得汝所证其在索引之内容,则其失,几乎恒在检索之层,非模型也。萨波塔提供一周之检索审计,成评估之集,辨其败之问类,并寄混合配置为可用之PR。

通过之人工智能工程之页 并寄三例生产中失灵之问。诊断通常一通电话足矣。