# How we built our knowledge base
**作者**: Cerebras
**日期**: 2026-07-16T18:27:55.000Z
**来源**: [https://x.com/cerebras/status/2077822555159945507](https://x.com/cerebras/status/2077822555159945507)
---
Authors: @hi_im_isaac_, @learnwdaniel, @gaozenghao
note: the interactive version of full technical blog available: https://www.cerebras.ai/blog/how-we-built-our-knowledge-base
Employees ask our internal knowledge base more than 15,000 questions every day. It's become one of the most widely adopted internal tools at the company since launching 3 months ago. Used by humans, automations and agents.
At Cerebras, our teams work across data center operations, chip design, hardware, training, inference, cloud platform, and more. With hundreds of new employees joining every year, our communication channels were filling up with the same questions:
- “Where can I find X?”
- “Who is the expert in Y?”
- “What is Z?”
We built Cerebras Knowledge to help people connect people and systems to useful information.
# Meeting data where it lives
Finding information inside an organization is hard. The data is scattered across tools, and every quarter or so someone proposes the same brilliant fix: let’s record everything in one platform so that all information is in a single place. The dream of a single source of truth, of course, rarely works in practice.
Information is generated wherever it is convenient and ergonomic: suggested edits in a document, threads in Slack, code references in GitHub, and status metadata in Jira. These platforms are tailor-made for their specific domains, optimized through years of product engineering and analytics. Discussing a pull request in Google Docs would be a terrible experience.
So we set out to design a system that required minimal change to existing behavior. On the data collection side, this meant extracting data from each platform directly.
## Anatomy of a knowledge base
Our knowledge base provides three things:
- A platform for collecting and storing internal data.
- A platform for querying that data.
- A layer that enforces authentication and authorization, with auditing and analytics.
At the core is a single Postgres table that holds embeddings, raw summaries, and metadata from many sources. The system continually ingests data from across the company and maintains a query-ready datastore.
We wanted a data interface that was simple but could work with most forms of data. We also wanted other developers at Cerebras to be able to build custom connectors. The result is deliberately simple: every source, from Slack threads to netlists, lands in the same embeddings table, and anything in that table is immediately queryable through the same interface:
Each data source defines what the data is, how to connect to it, and how often it should be fetched. Each resulting embedding row follows the same interface regardless of whether it came from Slack, a code repository, a document system, or a custom database.
# How we process unstructured Slack conversations
Slack was the most important data source we needed to design for. It is where the most up-to-date engineering discussions happen across the company.
We initially tested whether simple embeddings over raw text performed well enough. We quickly realized that vector search alone was insufficient for matching all relevant data.
Slack messages present several challenges:
- Information density varies enormously: “hey yeah sure mike” and a detailed kernel explanation are both messages.
- Message lengths vary, and shorter messages frequently beat longer, more detailed messages in cosine similarity.
- The meaning of a message often depends on the surrounding conversation.
We needed a hybrid approach. We built Slack ingestion so every thread is retrievable through several search techniques at once, where each technique makes up for the weaknesses of the others:
- Full-text search catches the exact tokens that embeddings blur together: error strings, flag names, host names. When an engineer pastes a literal error message, an exact lexical match is almost always the best evidence, and no amount of semantic similarity should outrank it.
- Embedding search catches paraphrase. The person asking “restore hangs after manifest load” and the person who answered “checkpoint stalls on the NFS mount” may never share vocabulary. Vector similarity is what connects a question to an answer written in different words.(1)
- Inverse document frequency separates signal from filler. A short message built around rare tokens, such as an obscure config flag, deserves to rank. “sounds good, thanks!” sits close to many queries in embedding space but scores near zero once term rarity is taken into account.
- Age decay encodes that Slack answers expire. Two threads can answer the same question, and the one from six months ago may describe infrastructure that no longer exists. When relevance is otherwise equal, the newer thread wins.
No single scorer is trusted on its own. Each technique produces its own ranked view of the same corpus, and those views are fused at query time (see Reranking).
## Socket Mode
To collect data in real time, we installed a Slack bot into our workspace and ran it in Socket Mode. Slack pushes every message event to us over a persistent WebSocket, so we get real-time updates without polling the Web API and burning through its rate limits.
When an event arrives, we immediately acknowledge it, deduplicate it using the stable event ID, and mark the message for the ingest consumer.
The ingest consumer does not save a new message in isolation. It resolves the thread that the message belongs to and re-fetches the entire conversation, including the parent and every reply, from the Slack API. It then writes the whole thread back as one row. A reply to an existing thread therefore re-pulls the parent and all siblings, so the stored content, participant list, and last-activity timestamp always reflect the complete conversation.
Every Slack channel in our system has its own data source. This provides fine-grained tuning for data freshness. A team may choose to ingest a busy incident channel more frequently, for example.
## Threads and messages
Raw Slack text is keyword-searchable as soon as it lands because we maintain a Postgres full-text (GIN) index over the raw content. To enable useful vector search, however, we do some additional processing.(8)
During distillation, an LLM extracts structured data from the full thread:
- A one-line question that an engineer would actually search for.
- A short summary.
- The resolution.
- The systems and code references mentioned.
We embed these data points and write them into the shared embeddings table. The original transcript is not embedded directly. In our experiments, accuracy increased significantly when the thread was normalized into a consistent format.(7,9) The additional metadata also gives the semantic match more useful signal.
## Bursting
At this point Slack search was good, but we kept encountering the same problem: important messages inside long threads were not always represented in the thread-level summary.
To boost the signal from individual messages, we use bursting. A burst is a run of consecutive messages from the same author. We embed individual bursts with the thread topic prepended as context(2) because sometimes the answer lives in one tangent message whose vocabulary never makes it into the thread summary. Burst embeddings make that message findable on its own.
To prevent low-signal data from reaching the database, each burst is scored against a weighted combination of signals and must clear a threshold before it is embedded:
- It contains a relatively rare token across the corpus, with IDF of at least 4.0.
- The combined burst is at least 200 characters.
- One or more messages in the burst contain reactions, providing a social boost.
After distillation, qualifying bursts are embedded and stored in the embeddings table alongside the thread-level record.
# Code repositories
Initially we debated whether embedding code repositories was necessary. With the rise of Claude Code and other command-line tools, creating code embeddings felt counterintuitive when it seemed like “grep is all you need.” After talking with others in the industry and reading Cursor’s findings on semantic search in large codebases, we decided to try.
We have many internal repositories, some larger than 40 GB. Our main concern was how to keep them current efficiently.
## Using @cocoindex_io to maintain code embeddings
After several experiments, we landed on CocoIndex, an open-source document embedding framework that specializes in vectorizing codebases.
For each repository, we split the code using language-specific regex boundaries ordered from coarse to fine. The splitter tries higher-level boundaries, such as classes, first. If a resulting chunk is still too large, it falls back to method boundaries and then smaller blocks. We embed the resulting chunks and write the vectors to Postgres. A single file may generate multiple embeddings at different levels of specificity, such as file-level and function-level records.
CocoIndex tracks synchronization metadata in Postgres. On each commit, it re-embeds and re-exports only the changed code chunks instead of recomputing the whole repository. This worked especially well for us because the synchronization state and embedding store live in the same database.
As the number of codebases grew, we moved repository onboarding into configuration files that teams can submit themselves, including allowlists and denylists at the file-path level.
## Custom data sources
Some teams already had their own databases and did not want to move data into Slack or a document system just to participate in the knowledge base. They wanted the same query surface over their existing tables.
To support this, we treat custom sources as plugin scripts. A team opens a pull request with a small Python module that knows how to read from its system and emit rows shaped like our embeddings table, plus a matching data source entry.
As long as the script writes into the shared database using the same schema as every other embedding row, the rest of the stack works unchanged. The data becomes queryable alongside Slack, code, and documents, with no special handling elsewhere in the system.
## Planning and tool fan-out
For every query, we first run a short planning pass where an LLM decides which tools and data sources are likely to matter. The main tools:
- subsystem_index: per-file LLM summaries.
- search: the unified vector pipeline across Slack, wiki, code, and other indexed sources, merged and reranked internally.
- search_slack: direct Slack retrieval.
- search_code: ripgrep over source repositories.
- recent_prs: recent pull requests relevant to the question.
- who_knows: people with demonstrated expertise on a topic.
The planner works over a compact description of what we have indexed: which projects exist, which sources are available in each project, and what each source is good at answering. Given the user’s query and active scope, it emits tool selections that the executor fans out in parallel, normalizes into a common evidence format, and passes to a final synthesis LLM.(4)
## Reranking
A document can surface near the top simply because it shares vocabulary with the query while answering a different question. Before reranking, we combine the retrievers’ incompatible result lists with reciprocal rank fusion, or RRF. For every document, we add weight / (60 + rank) for each list in which it appears, with a default weight of 1.0 and a smoothing constant of 60.
The smoothing constant makes consensus matter more than a single strong vote: a document that shows up near the top across several retrievers can beat one that ranks first in only one of them. We then merge duplicate chunks back to one source, cap how many results each file can contribute, and end up with a more diverse top twenty.
We send the original query and those candidates to a small reranker model. It gives each document a score from zero to ten, and we keep the top ten.(6)
Once the ranking is final, we add context back to the winners. For example, if we match a wiki section we pull in the two neighboring sections so the heading, preconditions, and caveats that chunking split apart aren’t lost. This gives readers a complete snippet instead of a lonely paragraph that’s missing important context.
So the output of search is a rich packet of evidence: results fused from different retrievers, deduplicated at the source level, reranked against the actual question, and only then expanded with surrounding context.
## MCP
In the MCP integration, we expose retrieval building blocks as direct tools instead of hiding them behind one “answer this question” endpoint. These tools are intentionally simple and as LLM-free as possible so clients can query them quickly and cheaply.(5)
Each MCP tool corresponds to one underlying retrieval primitive, such as search_slack, search_code, search, or who_knows. Tool inputs and outputs are narrow, structured, and stable, making them easy to call from any client or agent without embedding additional orchestration logic inside the tool itself.
Most tools run one query pipeline, such as vector search, lexical search, or ripgrep, apply lightweight scoring heuristics, and return raw evidence rows.
Claude Code, or any MCP-compatible agent, becomes the orchestration engine. It decides which tools to call, in what order, and how to assemble the results into a final answer or code edit. The retrieval layer itself does not depend on those LLM decisions in order to serve requests.
## Web UI
In the web UI, the same tools exist, but they are connected to a complete query pipeline that runs end to end for every user question. The UI agent owns the planner and executor steps.
- Planner: A lightweight LLM pass inspects the query and active project, then chooses which retrieval tools to invoke, such as search, search_slack, and subsystem_index.
- Executor: The system fans those tool calls out in parallel, gathers the results, and normalizes them into a shared evidence schema with scores, recency, and source hints.
- Synthesis: A final LLM pass takes the typed evidence bundle and original question, then produces the answer shown in the UI, including citations, caveats, and cross-source synthesis.
From the user’s perspective, the web UI is simply “ask a question and get an answer.” Under the hood, it runs the same planner → executor → synthesizer pattern that MCP clients can recreate explicitly.
# Organization
As the corpus grew, “search everything everywhere” rapidly stopped being useful. Engineers on compiler teams did not want infrastructure runbooks in their results, and vice versa. Projects are how we make search relevant by default.
## Projects and scoped search
We introduced projects as the primary way to organize the workspace that a query runs over. A project is a named bundle of data sources: specific Slack channels, code repositories, internal databases, and document spaces relevant to a team or initiative.
Projects are intentionally lightweight. The same data source, such as a shared incidents channel or central platform repository, can be referenced by multiple projects instead of being duplicated.
## Onboarding and defaults
During onboarding, users are prompted to select or create a default project that matches how they work, such as ML training infrastructure, Compiler, or Data Center Operations.
That default project is stored on the user profile and scopes queries automatically. A new engineer gets high-signal answers without first having to learn which Slack channels, repositories, or document spaces matter.
# Final Thoughts
In the end, the knowledge base works because it meets people where the information already lives, instead of forcing everything into one rigid system. By combining various search techniques, we can surface evidence quickly. The result is a search experience that stays flexible enough for real company data, but structured enough to remain useful as Cerebras keeps growing.
If you read this far and this is interesting to you, the ai/growth team is hiring reach out if you are interested @learnwdaniel
# References
1. Malkov and Yashunin, Efficient and Robust Approximate Nearest Neighbor Search Using Hierarchical Navigable Small World Graphs, arXiv:1603.09320 / IEEE TPAMI 2018.
2. Anthropic, Introducing Contextual Retrieval, 2024.
3. Cormack, Clarke, and Büttcher, Reciprocal Rank Fusion Outperforms Condorcet and Individual Rank Learning Methods, SIGIR 2009.
4. Li et al., Search-o1: Agentic Search-Enhanced Large Reasoning Models, arXiv:2501.05366, 2025.
5. Anthropic, Code Execution with MCP, 2025.
6. Liu et al., Lost in the Middle: How Language Models Use Long Contexts, arXiv:2307.03172, 2023.
7. Anthropic, Use XML Tags.
8. Salesforce/Slack Engineering, How Slack AI Processes Billions of Messages.
9. Improving Agents, Best Nested Data Format.
10. Cursor, Improving Agent with Semantic Search, 2025.
## 相关链接
- [Cerebras](https://x.com/cerebras)
- [@cerebras](https://x.com/cerebras)
- [277K](https://x.com/cerebras/status/2077822555159945507/analytics)
- [@hi_im_isaac_](https://x.com/@hi_im_isaac_)
- [@learnwdaniel](https://x.com/@learnwdaniel)
- [@gaozenghao](https://x.com/@gaozenghao)
- [https://www.cerebras.ai/blog/how-we-built-our-knowledge-base](https://www.cerebras.ai/blog/how-we-built-our-knowledge-base)
- [@cocoindex_io](https://x.com/@cocoindex_io)
- [@learnwdaniel](https://x.com/@learnwdaniel)
- [Efficient and Robust Approximate Nearest Neighbor Search Using Hierarchical Navigable Small World Graphs](https://arxiv.org/abs/1603.09320)
- [Introducing Contextual Retrieval](https://www.anthropic.com/news/contextual-retrieval)
- [Reciprocal Rank Fusion Outperforms Condorcet and Individual Rank Learning Methods](https://dl.acm.org/doi/10.1145/1571941.1572114)
- [Search-o1: Agentic Search-Enhanced Large Reasoning Models](https://arxiv.org/abs/2501.05366)
- [Code Execution with MCP](https://www.anthropic.com/engineering/code-execution-with-mcp)
- [Lost in the Middle: How Language Models Use Long Contexts](https://arxiv.org/abs/2307.03172)
- [Use XML Tags](https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/use-xml-tags)
- [Improving Agent with Semantic Search](https://cursor.com/blog/semsearch)
- [Upgrade to Premium](https://x.com/i/premium_sign_up)
- [2:27 AM · Jul 17, 2026](https://x.com/cerebras/status/2077822555159945507)
- [277.2K Views](https://x.com/cerebras/status/2077822555159945507/analytics)
- [View quotes](https://x.com/cerebras/status/2077822555159945507/quotes)
---
*导出时间: 2026/7/17 11:25:37*
---
## 中文翻译
# 我们如何构建知识库
**作者**:Cerebras
**日期**:2026-07-16T18:27:55.000Z
**来源**:[https://x.com/cerebras/status/2077822555159945507](https://x.com/cerebras/status/2077822555159945507)
---
作者:@hi_im_isaac_, @learnwdaniel, @gaozenghao
注:完整技术博客的交互版可在此查看:https://www.cerebras.ai/blog/how-we-built-our-knowledge-base
员工每天向我们内部知识库提出超过 15,000 个问题。自三个月前上线以来,它已成为公司内使用最广泛的内部工具之一,被人类、自动化流程和智能体(agent)共同使用。
在 Cerebras,我们的团队分布在数据中心运营、芯片设计、硬件、训练、推理、云平台等多个领域。每年有数百名新员工加入,我们的沟通渠道里充斥着同样的问题:
- “我在哪里能找到 X?”
- “谁是 Y 方面的专家?”
- “Z 是什么?”
我们构建了 Cerebras Knowledge,帮助人们将人与系统连接到有用的信息。
# 在数据所在之处处理数据
在组织内部查找信息很难。数据分散在各种工具中,每隔一个季度左右就有人提出同样“绝妙”的解决方案:我们把所有东西都记录在同一个平台上,这样所有信息都集中在一处。当然,“单一事实来源”的梦想在实践中很少能实现。
信息总是在最方便、最符合使用习惯的地方产生:文档中的修改建议、Slack 中的对话串、GitHub 中的代码引用,以及 Jira 中的状态元数据。这些平台是为各自特定领域量身打造的,经过多年的产品工程和分析优化。在 Google Docs 中讨论一个 pull request 将会是一种糟糕的体验。
因此,我们着手设计一个对现有工作方式改动最小的系统。在数据采集方面,这意味着直接从各个平台提取数据。
## 知识库的构造
我们的知识库提供三样东西:
- 一个收集和存储内部数据的平台。
- 一个查询这些数据的平台。
- 一个实施身份验证和授权的层,并带有审计和分析功能。
核心是一张单独的 Postgres 表,存放来自众多来源的嵌入(embedding)、原始摘要和元数据。系统持续从公司各处摄取数据,并维护一个随时可查询的数据存储。
我们想要一个简单但能适用于大多数数据形式的数据接口。我们还希望 Cerebras 的其他开发者能够构建自定义连接器。最终结果刻意保持简单:每个来源——从 Slack 对话串到网表——都落入同一张嵌入表,表中的任何内容都可以立即通过同一个接口进行查询:
每个数据源定义了数据是什么、如何连接以及以什么频率抓取。每一条生成的嵌入记录都遵循相同的接口,无论它来自 Slack、代码仓库、文档系统还是自定义数据库。
# 我们如何处理非结构化的 Slack 对话
Slack 是我们设计时最重要的数据源。公司内最前沿的工程讨论都发生在这里。
我们最初测试了直接对原始文本做简单嵌入是否足够有效。我们很快意识到,仅靠向量搜索不足以匹配所有相关数据。
Slack 消息带来了几个挑战:
- 信息密度差异巨大:“hey yeah sure mike” 和一段详细的内核解释都是消息。
- 消息长度不一,较短的消息在余弦相似度上经常胜过更长、更详细的消息。
- 一条消息的含义往往取决于周围的对话。
我们需要一种混合方法。我们构建的 Slack 摄取系统能让每个对话串同时通过多种搜索技术被检索到,每种技术弥补其他技术的不足:
- 全文检索能捕捉到嵌入向量会混淆的精确词元:错误字符串、参数名、主机名。当工程师粘贴一条字面的错误信息时,精确的词法匹配几乎总是最好的证据,任何语义相似度都不应凌驾于其上。
- 嵌入检索捕捉的是换一种说法的表达。提问“restore 在 manifest 加载后挂起”的人与回答“checkpoint 在 NFS 挂载点停滞”的人可能从未使用过相同的词汇。向量相似度正是将问题与用不同措辞写成的答案连接起来的东西。(1)
- 逆文档频率将信号与噪音区分开。围绕罕见词元(例如一个冷门的配置参数)构成的短消息应当获得较高排名。“sounds good, thanks!” 在嵌入空间中与许多查询都很接近,但一旦考虑词元稀缺性,其得分就趋近于零。
- 时间衰减编码了 Slack 回答会过时这一事实。两个帖子可能回答了同一个问题,而六个月前的那个所描述的基础设施可能已不复存在。当相关性其他方面相当时,较新的帖子胜出。
没有任何单一评分器被单独信任。每种技术都会对同一语料库生成各自的排序视图,这些视图在查询时被融合(见 Reranking)。
## Socket Mode
为了实时收集数据,我们向工作区安装了一个 Slack 机器人,并以 Socket Mode 运行它。Slack 通过持久化的 WebSocket 将每条消息事件推送给我们,因此我们无需轮询 Web API、消耗其速率限制,就能获得实时更新。
事件到达时,我们会立即确认它,使用稳定的事件 ID 进行去重,并将该消息标记给摄取消费者处理。
摄取消费者不会孤立地保存一条新消息。它会解析该消息所属的帖子,并从 Slack API 重新获取完整的会话,包括父消息和所有回复,然后将整个帖子作为一行写回。因此,对已有帖子的一条回复会重新拉取父消息和所有同级回复,从而确保存储的内容、参与者列表和最后活跃时间戳始终反映完整的会话。
我们系统中的每个 Slack 频道都有自己的数据源。这为数据新鲜度提供了细粒度的调节。例如,团队可以选择更频繁地摄取一个繁忙的事故频道。
## 帖子与消息
原始 Slack 文本一落地即可进行关键词检索,因为我们对原始内容维护了 Postgres 全文(GIN)索引。然而,为了实现有用的向量检索,我们还需要一些额外的处理。(8)
在蒸馏过程中,LLM 会从完整帖子中提取结构化数据:
- 工程师实际会搜索的一句话问题。
- 一段简短摘要。
- 解决方案。
- 提及的系统和代码引用。
我们对这些数据点进行嵌入,并写入共享的嵌入表中。原始对话记录本身不会被直接嵌入。在我们的实验中,当帖子被规范化为一致的格式后,准确率显著提升。(7,9) 额外的元数据也为语义匹配提供了更有用的信号。
## 突发消息
到这里,Slack 搜索已经很好了,但我们不断遇到同一个问题:长帖子中的重要消息并不总是能体现在帖子级摘要中。
为了增强单条消息的信号,我们使用突发消息。一个突发是一段来自同一作者的连续消息。我们对单个突发进行嵌入时,会将帖子主题作为上下文前置(2),因为有时答案藏在一条离题的消息里,而它的词汇从未进入帖子摘要。突发嵌入让这条消息本身也能被找到。
为防止低信号数据进入数据库,每个突发会根据一组加权信号组合进行评分,必须超过阈值才会被嵌入:
- 它包含在整个语料库中相对罕见的词元,IDF 至少为 4.0。
- 该突发的合并内容至少有 200 个字符。
- 突发中有一条或多条消息带有表情回应,提供了社交层面的加成。
蒸馏之后,符合条件的突发会被嵌入,并与帖子级记录一起存储在嵌入表中。
# 代码仓库
起初我们争论过是否有必要对代码仓库进行嵌入。随着 Claude Code 和其他命令行工具的兴起,创建代码嵌入显得有些反直觉,毕竟看起来“有 grep 就够了”。在与业界同行交流并阅读了 Cursor 关于大型代码库语义搜索的研究之后,我们决定尝试一下。
我们有许多内部仓库,有些超过 40 GB。我们主要关心的是如何高效地保持它们的更新。
## 使用 @cocoindex_io 维护代码嵌入
经过多次实验,我们选择了 CocoIndex,这是一个专注于代码库向量化的开源文档嵌入框架。
对每个仓库,我们使用按从粗到细排序的语言特定正则边界来切分代码。切分器首先尝试更高级别的边界,例如类。如果得到的块仍然过大,则回退到方法边界,再退到更小的代码块。我们对得到的块进行嵌入,并将向量写入 Postgres。单个文件可能会生成多个不同粒度的嵌入,例如文件级和函数级记录。
CocoIndex 在 Postgres 中跟踪同步元数据。每次提交时,它只对发生变化的代码块进行重新嵌入和重新导出,而不是重新计算整个仓库。这对我们尤其有效,因为同步状态和嵌入存储位于同一个数据库中。
随着代码库数量的增长,我们将仓库接入流程迁移到了配置文件中,团队可以自行提交,包括文件路径级别的允许列表和拒绝列表。
## 自定义数据源
有些团队已经有了自己的数据库,不希望仅仅为了参与知识库就把数据迁移到 Slack 或某个文档系统中。他们希望在现有的数据表上获得同样的查询界面。
为了支持这一点,我们将自定义数据源视为插件脚本。一个团队通过提交 pull request,添加一个小的 Python 模块,该模块知道如何从其系统中读取数据,并输出与我们嵌入表结构相同的行,外加一个匹配的数据源条目。
只要脚本按照与其他所有嵌入行相同的模式写入共享数据库,技术栈的其余部分就无需任何改动即可正常工作。这些数据变得可以与 Slack、代码和文档一起查询,系统中其他地方无需任何特殊处理。
## 规划与工具扇出
对于每个查询,我们首先运行一个简短的规划步骤,由 LLM 判断哪些工具和数据源可能相关。主要工具包括:
- subsystem_index:按文件生成的 LLM 摘要。
- search:跨 Slack、维基、代码和其他已索引来源的统一向量管道,内部进行合并和重排。
- search_slack:直接检索 Slack。
- search_code:在源代码仓库上运行 ripgrep。
- recent_prs:与问题相关的近期 pull request。
- who_knows:在某个主题上具有可证明专长的人员。
规划器基于对我们已索引内容的紧凑描述进行工作:存在哪些项目、每个项目中有哪些可用数据源,以及每个数据源擅长回答什么问题。给定用户的查询和当前范围,它会输出工具选择,由执行器并行扇出这些调用,将其规范化为统一的证据格式,并传递给最终的综合 LLM。(4)
## 重排序
一份文档仅仅因为与查询共享词汇表,而实际回答的是另一个问题,也可能出现在靠前的位置。在重排序之前,我们使用倒数排名融合(reciprocal rank fusion,RRF)来合并各个检索器不兼容的结果列表。对于每份文档,我们在其出现的每个列表中加上权重 / (60 + 排名) 的分数,默认权重为 1.0,平滑常数为 60。
平滑常数使共识比单个强投票更重要:一份在多个检索器中都排名靠前的文档,可以胜过只在其中一个检索器中排名第一的文档。然后我们将重复的片段合并回同一来源,限制每个文件能贡献的结果数量,最终得到一个更多样化的前二十名。
我们将原始查询和这些候选结果发送给一个小型重排序模型。它为每份文档打出一个从零到十分的分数,我们保留前十名。(6)
排名确定后,我们会为胜出的结果补充上下文。例如,如果匹配到维基的一个小节,我们会把相邻的两个小节一并拉入,以免分块时被拆开的标题、前提条件和注意事项丢失。这样读者得到的是一个完整的片段,而不是缺少重要上下文的孤立段落。
因此,search 的输出是一个丰富的证据包:来自不同检索器的融合结果,在来源层面去重,针对实际问题重排序,最后才扩展周围上下文。
## MCP
在 MCP 集成中,我们将检索的基础构件作为直接工具暴露出来,而不是把它们隐藏在一个“回答这个问题”的端点背后。这些工具刻意保持简单,并尽可能不依赖 LLM,以便客户端可以快速、低成本地查询它们。(5)
每个 MCP 工具对应一个底层检索原语,例如 search_slack、search_code、search 或 who_knows。工具的输入和输出都狭窄、结构化且稳定,使得任何客户端或代理都能轻松调用,而无需在工具本身内部嵌入额外的编排逻辑。
大多数工具运行单个查询管道,例如向量搜索、词法搜索或 ripgrep,应用轻量级的评分启发式规则,然后返回原始证据行。
Claude Code 或任何兼容 MCP 的代理则成为编排引擎。它决定调用哪些工具、以什么顺序调用,以及如何将结果组装成最终答案或代码修改。检索层本身在服务请求时不依赖这些 LLM 决策。
## Web UI
在 Web UI 中,同样的工具也存在,但它们连接到一个为每个用户问题端到端运行的完整查询管道。UI 代理负责规划器和执行器步骤。
- 规划器:一个轻量级的 LLM 步骤检查查询和当前项目,然后选择调用哪些检索工具,例如 search、search_slack 和 subsystem_index。
- 执行器:系统并行扇出这些工具调用,收集结果,并将其规范化为包含分数、新鲜度和来源提示的共享证据模式。
- 综合:最后的 LLM 步骤接收类型化的证据包和原始问题,然后生成显示在 UI 中的答案,包括引用、注意事项和跨来源的综合。
从用户的角度来看,Web UI 只是“提问并获得答案”。在底层,它运行着与 MCP 客户端可以显式重建的相同的规划器 → 执行器 → 综合器模式。
# 组织结构
随着语料库的增长,“搜索所有地方的一切”很快就变得不再实用。编译器团队的工程师不希望在结果中看到基础设施运维手册,反之亦然。项目是我们让搜索默认就具有相关性的方式。
## 项目与范围化搜索
我们引入了项目作为组织查询运行范围的主要方式。项目是一个命名的数据源集合:特定团队或计划相关的 Slack 频道、代码仓库、内部数据库和文档空间。
项目刻意保持轻量。同一个数据源,例如共享的事故频道或中央平台仓库,可以被多个项目引用,而不必重复创建。
## 上手引导与默认设置
在引导过程中,系统会提示用户选择或创建一个符合其工作方式的默认项目,例如 ML 训练基础设施、Compiler 或数据中心运营。
这个默认项目存储在用户配置中,并自动限定查询范围。新入职的工程师无需先了解哪些 Slack 频道、代码仓库或文档空间重要,就能获得高价值信息。
# 结语
归根结底,这个知识库之所以有效,是因为它直接在信息已经存在的地方满足人们的需求,而不是强迫所有内容都纳入一个僵化的系统。通过结合多种搜索技术,我们可以快速呈现相关证据。其结果是打造了一个既足够灵活以适应真实的公司数据、又足够结构化以便在 Cerebras 持续发展过程中保持实用性的搜索体验。
如果你读到了这里并对此感兴趣,ai/growth 团队正在招聘,感兴趣的话请联系 @learnwdaniel
# 参考文献
1. Malkov 和 Yashunin,《使用分层可导航小世界图进行高效且鲁棒的近似最近邻搜索》,arXiv:1603.09320 / IEEE TPAMI 2018。
2. Anthropic,《介绍上下文检索》,2024 年。
3. Cormack、Clarke 和 Büttcher,《倒数排序融合优于 Condorcet 及个体排序学习方法》,SIGIR 2009。
4. Li 等人,《Search-o1:智能体搜索增强的大型推理模型》,arXiv:2501.05366,2025 年。
5. Anthropic,《使用 MCP 进行代码执行》,2025 年。
6. Liu 等人,《迷失在中间:语言模型如何使用长上下文》,arXiv:2307.03172,2023 年。
7. Anthropic,《使用 XML 标签》。
8. Salesforce/Slack 工程团队,《Slack AI 如何处理数十亿条消息》。
9. Improving Agents,《最佳嵌套数据格式》。
10. Cursor,《通过语义搜索改进智能体》,2025 年。
## 相关链接
- [Cerebras](https://x.com/cerebras)
- [@cerebras](https://x.com/cerebras)
- [277K](https://x.com/cerebras/status/2077822555159945507/analytics)
- [@hi_im_isaac_](https://x.com/@hi_im_isaac_)
- [@learnwdaniel](https://x.com/@learnwdaniel)
- [@gaozenghao](https://x.com/@gaozenghao)
- [https://www.cerebras.ai/blog/how-we-built-our-knowledge-base](https://www.cerebras.ai/blog/how-we-built-our-knowledge-base)
- [@cocoindex_io](https://x.com/@cocoindex_io)
- [@learnwdaniel](https://x.com/@learnwdaniel)
- [基于分层可导航小世界图的高效且鲁棒的近似最近邻搜索](https://arxiv.org/abs/1603.09320)
- [推出上下文检索(Contextual Retrieval)](https://www.anthropic.com/news/contextual-retrieval)
- [倒数排名融合优于 Condorcet 及单个排名学习方法](https://dl.acm.org/doi/10.1145/1571941.1572114)
- [Search-o1:智能体搜索增强的大型推理模型](https://arxiv.org/abs/2501.05366)
- [通过 MCP 执行代码](https://www.anthropic.com/engineering/code-execution-with-mcp)
- [迷失在中间:语言模型如何使用长上下文](https://arxiv.org/abs/2307.03172)
- [使用 XML 标签](https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/use-xml-tags)
- [通过语义搜索改进智能体](https://cursor.com/blog/semsearch)
- [升级至高级版](https://x.com/i/premium_sign_up)
- [2026年7月17日 凌晨2:27](https://x.com/cerebras/status/2077822555159945507)
- [27.72万次浏览](https://x.com/cerebras/status/2077822555159945507/analytics)
- [查看引用](https://x.com/cerebras/status/2077822555159945507/quotes)
*导出时间: 2026/7/17 11:25:37*