CCAR-P and Databricks GenAI Study Notebook — Day 1, Part 1
This notebook connects two tracks that are actually one skill: the CCAR-P architecture judgment Peter has been drilling, and the Databricks GenAI platform he is now learning hands-on, both aimed at the same target — building FM Insight, the AI/ML/RPA layer on Advana supporting DoW's audit remediation toward a 2028 clean opinion.
本笔记把两条学习线连成一条技能线:Peter 一直在打磨的 CCAR-P 架构判断力,和他现在正在上手的 Databricks GenAI 平台课程,两者最终服务同一个目标——在 Advana 上建设 FM Insight,支撑国防部审计整改、迈向 2028 年"清洁审计意见"。
01 Big Picture and Overview
One sentence first: Databricks is the factory floor, CCAR-P is the blueprint-reading skill, and FM Insight is the building going up. Everything in this notebook exists to connect those three — so a course demo on Tuesday turns into a defensible design decision at work on Wednesday.
先说一句话:Databricks 是车间(生产平台),CCAR-P 是读懂蓝图的能力,FM Insight 是正在建的那栋楼。本笔记的全部内容,都是为了把这三者连起来——这样周二课堂上的一个演示,到周三就能变成工作中一个站得住脚的架构决定。
Why this notebook exists instead of staying in chat: course material disappears into scroll-back the moment you learn it. CCAR-P already proved the fix — a study log that survives across sessions, organized so you can find "what did I already learn about this" in ten seconds. This is that same discipline applied to Databricks, built as one living document rather than a transcript.
为什么要做成笔记而不是停留在聊天记录里:课程内容一学完就会淹没在滚动记录里。CCAR-P 的学习日志已经证明了解决办法——一份能跨会话保留、十秒内就能查到"这个我是不是学过"的学习日志。这份笔记把同样的纪律搬到 Databricks 上,做成一份持续生长的文档,而不是一份对话记录。
Each study session adds to Section 5 (and later sections for Day 2+): one subsection per course file, in the order covered. Sections 1-4 are revised in place as the big picture sharpens — they are the notebook's spine, not a session log.
每次学习都会在第 5 节(以及后续 Day 2+ 的新节)里新增内容:按学习顺序,每个课程文件一个小节。第 1-4 节会随着大图景越来越清晰而原地修订——它们是笔记的骨架,不是会话流水账。
02 How CCAR-P Helps
CCAR-P is not a side credential sitting next to the Databricks course. It is the lens Peter already built for exactly this kind of problem: given a new AI platform and a real business requirement, where does judgment go first? CCAR-P trained that judgment on a vendor-agnostic model (the 5-decision checklist, the enforcement ladder, the 7 primitives). Databricks is the first concrete platform to run that judgment against.
CCAR-P 不是摆在 Databricks 课程旁边的一个附加证书。它就是 Peter 已经为这类问题打磨好的那副"眼镜":给定一个新的 AI 平台和一个真实的业务需求,判断力应该先落在哪里?CCAR-P 用一套不依赖具体厂商的模型(五步决策清单、强制执行阶梯、七种基础组件)训练了这种判断力。Databricks 是第一个真正拿这副眼镜去套用的具体平台。
2.1 The 5-decision checklist, run against Databricks
| CCAR-P decision | Databricks answer so far |
|---|---|
| Entry point | Genie Agent (declarative, Content Search) for the unstructured-PDF case in File 2; a custom code-first agent when the pipeline needs control CCAR-P would flag as non-negotiable. |
| Pattern | RAG, 4-stage pipeline (Index → Retrieve → Generate → Feedback), with Lakebase hybrid search (vector + BM25, fused by RRF) as the retrieval engine. |
| Claude/system/human split | Not yet covered in the material read so far — this is the open question Folder 2 (agents/MCP/governance) should answer. |
| Model + context strategy | Prompt → Context → Harness nesting (Section B of File 1) maps directly onto CCAR-P's own context-engineering domain. |
| HITL placement | Not yet covered — expected in the evaluation/deployment folders (3 and 4). |
上表把 CCAR-P 的五步决策清单直接套用在目前学到的 Databricks 材料上:哪些问题已经有答案(入口点、架构模式、模型与上下文策略),哪些还是空的(人机分工、人工介入点)——空的部分正好对应还没学到的 Folder 2-4。
2.2 Where CCAR-P's weak spots and Databricks material line up
Peter's own CCAR-P study log flags multi-agent failure modes and enforcement-ladder reasoning as areas with repeated misses. Folder 2 (Building Agentic Applications: multi-agent orchestration, Supervisor + handoffs) and Folder 3 (Agent Evaluation: MLflow judges, offline/online eval) are the exact hands-on terrain to close that gap — reading them with the weak-spot list open turns a course demo into deliberate practice.
Peter 自己的 CCAR-P 学习日志标出了两个反复出错的弱点:多智能体失败模式、强制执行阶梯的推理。Folder 2(构建智能体应用:多智能体编排、Supervisor + handoff 模式)和 Folder 3(智能体评估:MLflow judge、离线/在线评估)正是补齐这两个弱点的实操场地——带着弱点清单去读这些课程材料,就把一次课程演示变成了一次刻意练习。
03 Databricks Platform Structure
Read the stack from the ground up: storage format, then governance over it, then three ways to move and use the data, then the AI layer that sits on top of all of them and calls back down through governance.
这套技术栈要自下而上地理解:先是存储格式,再是覆盖其上的治理层,然后是三条处理数据的通路,最后是坐在最上层、并通过治理层向下调用的 AI 层。
The single idea underneath all of it: one copy of data, in Delta Lake, governed once by Unity Catalog, then reused by every layer above — warehouse queries, operational apps, and AI agents all read the same governed data instead of each keeping their own silo. That is the literal meaning of "Lakehouse": lake-scale storage with warehouse-grade guarantees, fused.
贯穿整个技术栈的核心思想只有一个:数据只存一份,存在 Delta Lake 里,由 Unity Catalog 统一治理一次,然后被上面每一层复用——数据仓库查询、业务应用、AI 智能体读的都是同一份受治理的数据,而不是各自维护一个数据孤岛。这正是"Lakehouse(湖仓一体)"这个词的字面含义:把数据湖的规模和数据仓库级别的保证融合在一起。
The four sections below unpack each layer of that diagram on its own terms — this is the part that actually resolves the "why are there five different Genie things" confusion.
下面四个小节把上面那张图里的每一层单独拆开讲——"为什么有五个不同的 Genie"这个困惑,就是在这里被解决的。
3.1 The AI layer: every "Genie" and "Agent" thing, separated
Nine names live in this one layer, split across two UI sections (SQL, and AI/ML) because they sit at different points on the same managed-to-custom spectrum. Read the table by that spectrum, not by name.
这一层里挤了九个名字,分散在两个界面分区(SQL 和 AI/ML)里,因为它们在"全托管到完全自定义"这条光谱上处于不同的位置。读这张表时,按这条光谱来理解,而不是按名字记忆。
| Name | Lives under | What it is | Purpose |
|---|---|---|---|
| Genie Agent | SQL | One curated, managed NL-to-SQL/volume agent (what you built in File 2) | Self-service Q&A, zero pipeline code |
| Genie One | Product switcher (top) | Workspace-wide conversational router over every agent/dashboard/doc | One question, no need to pick which agent answers it |
| Genie Code | Everywhere (sidebar) | The renamed Databricks Assistant — in-editor coding help | Write/fix/explain code; unrelated to retrieval |
| Agents | AI/ML | Agent Framework — build, trace, deploy custom, code-first agents | Full control: your own chunking, embedding model, index type |
| Playground | AI/ML | Interactive chat UI to test a model or prompt directly | Quick experimentation, no deployment |
| AI Gateway | AI/ML | Governance on a serving endpoint: rate limits, guardrails, usage tracking, fallback (legacy) | Control and audit who calls which model, how much |
| Unity Gateway | (successor to AI Gateway) | Enterprise control plane for LLM endpoints and coding agents, generally available | Same job as AI Gateway, broader scope, replacing it |
| Experiments / Models / Serving | AI/ML | MLflow's three-stage lifecycle: track runs, register versions, deploy as an endpoint | How a custom agent goes from code to a live, callable API |
A Genie Agent and a custom Agent are two different front doors into the identical back-end machinery: Unity Catalog governance, a Serving endpoint, MLflow tracking underneath both. Genie Agent does every step for you and hides the knobs. Building in "Agents" means you do each step yourself, in the open — which is exactly where the chunk size, embedding model, and index-type settings actually live.
Genie Agent 和自定义 Agent 是通向同一套后端机制的两扇不同的门:Unity Catalog 治理、Serving 端点、MLflow 追踪,两者底层完全一样。Genie Agent 替你把每一步都做了,也把所有旋钮都藏了起来;在"Agents"里自己搭建,意味着每一步都自己动手、完全可见——而 chunk size、embedding model、索引类型这些设置,正是住在这里。
A screenshot of the actual left-nav "Compute" page settles something this notebook had left implicit: an AI Search endpoint (vs_all_demo in Files 6-7) is not an AI/ML object or a Catalog object. It's a provisioned compute resource, listed on the same "Compute" page as Serverless, All-purpose compute, Job compute, SQL warehouses, Pools, Policies, Apps, and — notably — Lakebase itself, as its own tab. This is the same split File 6/File 7's governance diagram already drew in different words: the index (catalog.schema.house_rules_index, a named object with columns and rows) is a Catalog/Unity Catalog object, governed by UC privileges; the endpoint that actually serves queries against it is compute, governed separately by endpoint ACLs and found under Compute → AI Search, with its own Status column and startup/online state — exactly what File 7's polling loop (client.get_endpoint(VS_ENDPOINT) until "ONLINE") is waiting on. The same split applies to SQL Warehouses (compute, under Compute) vs. the tables they query (Catalog), and now explicitly to Lakebase: it shows up as a compute resource you provision, not a schema you merely reference.
实际工作区左侧导航"Compute"页面的截图,把这份笔记之前一直没明说的一件事确认清楚了:AI Search 端点(File 6-7 里的 vs_all_demo)既不是 AI/ML 对象,也不是 Catalog 对象。它是一个被预置的计算资源,和 Serverless、All-purpose compute、Job compute、SQL warehouses、Pools、Policies、Apps 列在同一个"Compute"页面上——值得注意的是,Lakebase 本身也作为独立标签页出现在那里。这正是 File 6/File 7 治理示意图已经用不同措辞画过的那同一条分界线:索引(catalog.schema.house_rules_index,一个有列有行的命名对象)是 Catalog/Unity Catalog 对象,由 UC 权限治理;真正负责执行查询的端点是计算资源,单独由 Endpoint ACL 治理,在 Compute → AI Search 下能找到,有自己的 Status 列和启动/上线状态——这正是 File 7 的轮询循环(client.get_endpoint(VS_ENDPOINT) 等到 "ONLINE")在等待的那个东西。同样的分界线也适用于 SQL Warehouses(计算资源,在 Compute 下)和它们查询的表(Catalog);现在也明确适用于 Lakebase:它是一个你要预置的计算资源,不是一个你只是引用的 schema。
A screenshot of AI/ML → Agents → Create Agent shows a gallery of starting-point templates: Supervisor Agent (Legacy), Knowledge Assistant (Legacy), Code your own agent, and a row of AI-Function-shaped templates — Information Extraction (ai_extract), Document Parsing (ai_parse_document), Text Classification (almost certainly ai_classify, just scrolled below the fold). These are Databricks' own built-in scaffolds, shipped in every workspace, visible the moment anyone opens that dialog — not something created by running File 5's SQL. File 5's CREATE OR REPLACE TABLE did exactly one thing: wrote a Delta table (airbnb_structured_listings) into the catalog. It did not register, modify, or add a card to this gallery, and running it again wouldn't change what shows here either. The gallery exists independent of anyone's query history; it is the UI's menu of pre-wired starting points for the four AI Functions and two legacy agent types already named in this notebook (3.1's table, File 1's three-way retrieval table), not a log of what's been run.
一张 AI/ML → Agents → Create Agent 的截图,展示了一个模板画廊:Supervisor Agent (Legacy)、Knowledge Assistant (Legacy)、Code your own agent,还有一排按 AI 函数形状设计的模板——Information Extraction(对应 ai_extract)、Document Parsing(对应 ai_parse_document)、Text Classification(几乎可以确定对应 ai_classify,只是被滚动条挡在下面没截到)。这些是 Databricks 自带的内置脚手架,每个工作区都有,只要打开这个对话框就能看到——不是跑了 File 5 的 SQL 之后才出现的东西。File 5 的 CREATE OR REPLACE TABLE 只做了一件事:往 catalog 里写了一张 Delta 表(airbnb_structured_listings)。它没有注册、修改任何东西,也没有往这个画廊里添加任何卡片,再跑一遍这个脚本也不会改变画廊里显示的内容。这个画廊的存在和任何人的查询历史无关;它是界面给四个 AI 函数和两种 legacy 智能体类型(3.1 的表、File 1 的三选一检索方式表里都提过)预先准备好的起点菜单,不是一份"谁跑过什么"的记录。
Two things worth noting precisely because they confirm earlier sections rather than add new facts: "(Legacy)" is now visibly printed on Supervisor Agent and Knowledge Assistant in the actual UI, matching File 1's table calling Knowledge Assistants a "legacy pattern." And "Code your own agent" (OSS libraries + Agent Framework) is the literal UI entry point for the right-hand, code-first door in 3.1's "two doors, same machinery" diagram above — the same choice, now visible as a clickable card rather than a concept.
有两点值得专门点出来,因为它们是对前面内容的确认,而不是新信息:"(Legacy)" 这个标签现在实实在在印在 Supervisor Agent 和 Knowledge Assistant 的卡片上了,和 File 1 表格里把 Knowledge Assistant 称为"legacy 模式"完全对得上。而"Code your own agent"(OSS 库 + Agent Framework)正是上面 3.1 节"两扇门,同一套机制"示意图里右边那扇代码优先之门,在界面上的真实入口——同一个选择,现在变成了一张可以点击的卡片,而不只是一个概念。
3.2 Unity Catalog: the one layer everything else answers to
Unity Catalog is not one more layer in the stack. It is the governance plane every other layer must check against before it does anything. One namespace, three levels deep: catalog.schema.object. "Object" covers tables, views, volumes (the PDFs in File 2), ML models, UC functions, and now agents and MCP tools — everything gets the same permission model, the same lineage tracking, the same discovery surface.
Unity Catalog 不是技术栈里"又一层",而是其他每一层在做任何事之前都必须先核对的治理平面。一个命名空间,三级结构:catalog.schema.object。"object"涵盖表、视图、volume(File 2 里的那些 PDF)、机器学习模型、UC 函数,现在也包括智能体和 MCP 工具——所有这些都用同一套权限模型、同一套血缘追踪、同一个发现入口。
Three jobs, concretely: permissions (GRANT/REVOKE at catalog, schema, or object level — this is what let you see or not see the Lakebase index table in File 2's admin step), lineage (which table fed which Delta Live Table fed which agent's answer — traceable end to end), and discovery (search and browse what exists, instead of asking around). Unity Gateway, from 3.1, is this same governance idea extended specifically to LLM calls and agent traffic.
具体做三件事:权限管理(在 catalog、schema 或 object 层级 GRANT/REVOKE——这正是 File 2 管理员步骤里,你能不能看到 Lakebase 索引表的决定因素)、血缘追踪(哪张表喂给了哪条 Delta Live Table,又喂给了哪个智能体的回答——端到端可追溯)、以及发现(搜索和浏览已有资产,而不是靠口口相传)。3.1 里提到的 Unity Gateway,就是这同一套治理思想,专门延伸到了 LLM 调用和智能体流量上。
3.3 Lakehouse family: where data actually lives and moves
Three names, one lineage. Delta Lake is the open table format — the file-level guarantee (ACID transactions, versioning, time travel) that everything else builds on. Lakehouse is the architecture that results from putting warehouse-style analytics directly on top of Delta Lake tables, instead of copying data out to a separate warehouse product. Lakeflow is the family of tools that get data into and through that Lakehouse: ingestion and streaming (100+ connectors), Lakeflow Designer (the nav item you saw as "Visual Data Prep" — a no-code drag-and-drop transform canvas, itself AI-authored by Genie Code), and Lakeflow Jobs (orchestration — the "Runs" nav item is this layer's execution history).
三个名字,一条血脉。Delta Lake 是开放表格式——文件级别的保证(ACID 事务、版本管理、时间回溯),其他一切都建立在它之上。Lakehouse 是把仓库式分析直接架在 Delta Lake 表之上、而不是把数据另外复制到一个单独仓库产品里所形成的架构。Lakeflow 是让数据进入并流经这个 Lakehouse 的一整套工具:数据接入和流处理(100 多个连接器)、Lakeflow Designer(导航里显示为"Visual Data Prep"——一个无代码拖拽式转换画布,由 Genie Code 提供 AI 辅助编写),以及 Lakeflow Jobs(编排调度——导航里的"Runs"就是这一层的执行历史)。
3.4 Lakebase and SQL: the operational and query-facing layer
Lakebase is the odd one out in the family on purpose: a managed serverless Postgres for operational workloads, not analytics. It syncs with the Lakehouse so the same governed data is reachable from both sides. Two jobs specifically: agent state/memory, and the hybrid search index tables from File 1/File 2 (the pgvector + tsvector columns). SQL Warehouses is the compute that actually runs SQL — including the queries a Genie Agent issues behind the scenes. Query History and Alerts, also in the SQL nav section, are monitoring tools on top of that same compute: a log of what ran, and threshold notifications on what a query returns.
Lakebase 故意是这个家族里的"异类":一个面向业务型工作负载、而不是分析型工作负载的托管无服务器 Postgres。它和 Lakehouse 保持同步,使同一份受治理的数据两边都能访问。具体做两件事:智能体的状态/记忆,以及 File 1/File 2 里讲的混合检索索引表(pgvector + tsvector 那两列)。SQL Warehouses 是真正运行 SQL 的计算资源——包括 Genie Agent 在后台发出的查询。Query History 和 Alerts(同样在 SQL 导航分区里),是架在这同一份计算资源之上的监控工具:一个是"跑过什么"的日志,一个是对查询结果设阈值告警。
Confirmed from the real workspace nav: Lakebase itself is a tab on the Compute page, next to Serverless, SQL warehouses, AI Search, and Apps — not somewhere under Catalog. That placement is consistent, not incidental: Lakebase is something you provision and start, the same category as a SQL warehouse or an AI Search endpoint, not a namespace you merely browse.
已从实际工作区导航确认:Lakebase 本身是 Compute 页面上的一个标签页,和 Serverless、SQL warehouses、AI Search、Apps 排在一起——不在 Catalog 底下。这个位置是一致的,不是偶然的:Lakebase 是你要预置、启动的东西,和 SQL warehouse 或 AI Search 端点属于同一类,不是一个你只是浏览的命名空间。
3.5 Declarative Automation Bundles (DAB): deploying everything above as code
DAB is the layer that turns everything in 3.1-3.4 from a notebook you clicked through into a version-controlled, repeatably deployed project. Formerly named Databricks Asset Bundles (same abbreviation, renamed), it is not the same thing as Databricks Apps (the separate app-hosting console in the product switcher) — a mix-up worth flagging because the names collide easily.
DAB 这一层,把 3.1-3.4 里的所有东西,从一个靠点击操作的 notebook,变成一个纳入版本控制、可重复部署的项目。它原名 Databricks Asset Bundles(缩写不变,改了名字),和产品切换器里那个单独的应用托管控制台 Databricks Apps 不是同一个东西——这两个名字容易混,值得专门提醒一下。
Mechanically: one declarative YAML file, databricks.yml, defines the whole project — resources it can describe include Lakeflow Jobs, Lakeflow pipelines, dashboards, Model Serving endpoints, MLflow Experiments, and registered Models (everything from 3.1 and 3.3 at once). The CLI lifecycle is init (scaffold from a template) → edit databricks.yml → validate → deploy to a target workspace → run. This is what makes a bundle deployable identically to dev, staging, and prod, and what plugs into a GitHub CI/CD workflow instead of a person clicking through a UI each time.
具体机制:一个声明式的 YAML 文件 databricks.yml 定义整个项目——它能描述的资源包括 Lakeflow Jobs、Lakeflow pipeline、仪表盘、Model Serving 端点、MLflow 实验、以及已注册的模型(等于一次性覆盖了 3.1 和 3.3 的内容)。命令行的生命周期是 init(从模板搭建脚手架)→ 编辑 databricks.yml → validate → 部署到目标工作区 deploy → run。这正是让同一个 bundle 能原样部署到开发、预发布、生产环境的原因,也是能接入 GitHub CI/CD 流程、而不必每次都靠人工点界面的原因。
Folder 4's appendix (Agent Bricks CLI) is this same idea applied specifically to agents: an agent.toml file instead of databricks.yml, but the same three-command shape (define, deploy, run). DAB is the general-purpose version of that pattern.
Folder 4 附录里的 Agent Bricks CLI,就是把同一个思路专门用在智能体上:用 agent.toml 代替 databricks.yml,但同样是"定义、部署、运行"三段式。DAB 是这个模式的通用版本。
This is the architecture question FM Insight has to answer at platform scale: are USSGL-normalized transactions, reconciliation evidence, and agent-generated audit artifacts one governed copy of data under one catalog, or silos that drift? The Lakehouse-plus-Unity-Catalog pattern is the concrete reference answer, independent of whether Advana runs on Databricks specifically — and the managed-vs-custom split in 3.1 is the same enforcement-ladder question CCAR-P already trained: which controls can live behind a Genie-style default, and which ones are non-negotiable enough to demand the custom-agent path.
这正是 FM Insight 在平台层面必须回答的架构问题:USSGL 标准化交易、对账证据、以及智能体生成的审计证物,是在同一个 catalog 下受治理的一份数据,还是会逐渐偏离的孤岛?Lakehouse 加 Unity Catalog 这套模式提供了一个具体的参考答案,不论 Advana 底层是否真的用 Databricks——而 3.1 里"托管 vs 自定义"的划分,正是 CCAR-P 已经训练过的那个强制执行阶梯问题:哪些控制可以交给 Genie 式的默认值,哪些控制不能商量、必须走自定义智能体这条路。
04 Key Terminology
| Term | What it is | Why it matters |
|---|---|---|
| Delta Lake | Open table format on cloud storage. ACID transactions, versioning, time travel. | The "one copy of data" guarantee everything else depends on. |
| Unity Catalog (UC) | Cross-platform governance: permissions, lineage, discovery for tables, views, volumes, models, functions, agents. | Every object in the stack — including an AI agent — is a governed, discoverable asset, not a one-off script. |
| Lakehouse | Architecture fusing data lake + data warehouse over the same Delta Lake data. | Removes the ETL-to-a-separate-warehouse step and the drift it causes. |
| Lakeflow | Ingestion/ETL/streaming layer. 100+ connectors, Zerobus for event streams. | How source-system data (feeder systems, SAP, Oracle) actually lands in the Lakehouse. |
| Lakebase | Managed serverless Postgres. OLTP, agent state/memory, syncs with the Lakehouse. | Where an agent's working memory and hybrid search index live — operational, not analytical. |
| Serverless compute | No cluster management; compute scales to the query/job automatically. | Removes a whole class of infra-ops work that used to gate every pipeline change. |
| Databricks Apps | Separate hosting console for small web apps built on Databricks (Streamlit/Flask-style). | Deploying an app, not an agent or a pipeline — easy to confuse with DAB by name alone. |
| DAB (Declarative Automation Bundles) | Formerly "Databricks Asset Bundles." One YAML file (databricks.yml) defines jobs, pipelines, dashboards, serving endpoints, experiments, and models as code. | How a demo notebook becomes a version-controlled, CI/CD-deployable project. See Section 3.5. |
| Genie Agents | Managed, declarative agent type. Zero pipeline code; Content Search (beta) over attached volumes. | The "fast path" entry point — compare against Custom Agents on the control tradeoff, per CCAR-P's decision checklist. |
| AI Search | Standalone managed search service built on UC Delta tables/volumes (formerly Mosaic AI Vector Search / "Vector Search"). No Lakebase dependency. See 4.1 for the full disambiguation. | The backend behind every "Vector Search index parameters" reference in Files 4 and 6, and the correct Advana Phase 2 target — unlike Content Search, it doesn't need Lakebase. |
| Unity Gateway | AI-specific governance layer: model routing, fallback, audit boundary for LLM calls. | Where "who called which model, with what, and was it allowed" gets answered — the audit hook. |
| MLflow | Experiment tracking, GenAI tracing, evaluation (judges, scorers). | How "did this agent actually get better" becomes a measured claim instead of a feeling. |
术语表按技术栈层级组织:存储格式(Delta Lake)→ 治理(Unity Catalog)→ 三条数据通路(Lakeflow / Lakehouse / Lakebase)→ 计算与部署(Serverless、DABs)→ AI 层(Genie Agents、Unity Gateway、MLflow)。每个术语不仅给出定义,也说明它为什么重要,便于直接对照工作中的 FM Insight 场景使用。
4.1 Why there seem to be five search terms, when there are really two backends
By File 6, this notebook has used AI Search, Mosaic AI Vector Search, Vector Search, Lakebase Search, Lakebase hybrid search, and Content Search — and every one of them is doing real work describing something, but they collapse onto exactly two underlying backends. The confusion is fair; Databricks' own naming has not been stable here. This is the one place in the notebook to check when a name stops making sense.
到 File 6 为止,这份笔记已经用过 AI Search、Mosaic AI Vector Search、Vector Search、Lakebase Search、Lakebase hybrid search、Content Search 这几个词——每一个都在描述真实存在的东西,但它们最终只落在两个底层后端上。会觉得混乱是合理的,Databricks 自己的命名在这块也不稳定。这是整份笔记里,一个名字开始让人看不懂时,应该回来查的那个地方。
| Term you'll see | Backend | What it actually is |
|---|---|---|
| AI Search | 1 — UC-based | Current product name for the standalone managed search service |
| Mosaic AI Vector Search / "Vector Search" | 1 — UC-based | Earlier name for the same product (File 4's "Vector Search index parameters" are AI Search's parameters) |
| Knowledge Assistants | 1 — UC-based | Legacy agent pattern: bring your own already-built AI Search index |
| Lakebase Search | 2 — Lakebase-based | The pair of Postgres extensions, named as a product in File 6's comparison table |
| lakebase_vector / lakebase_text | 2 — Lakebase-based | The two specific extensions that make up Lakebase Search — ANN and BM25 respectively (File 1, File 3) |
| Lakebase hybrid search | 2 — Lakebase-based | Same thing as Lakebase Search, named for its behavior (fuses both extensions via RRF) instead of the product |
| Content Search | 2 — Lakebase-based | A Genie Agent button/feature, not a backend of its own — confirmed (File 2, admin inspection) to provision and run on Lakebase Search underneath |
This is the single fact that makes Section 7's plan correct and worth restating plainly: Genie Agent's Content Search needs Lakebase, confirmed absent in Advana, so it will not work there. A Custom Agent built on AI Search needs no Lakebase at all, so it will. The two "search" features in the Databricks UI that look like peers (a checkbox in Genie Agent setup vs. a standalone index) sit on genuinely different infrastructure, and only one of them survives Advana's actual constraints.
这是让 Section 7 的方案成立、值得再直白说一遍的那个关键事实:Genie Agent 的 Content Search 需要 Lakebase,而 Advana 已确认没有 Lakebase,所以它在那边用不了。建在 AI Search 上的自定义智能体完全不需要 Lakebase,所以能用。Databricks 界面上看起来像一对平级功能的两个"搜索"(Genie Agent 设置里的一个勾选框,和一个独立的索引),其实建在完全不同的基础设施上,而在 Advana 的实际约束下,只有一个能活下来。
05 Day 1
File 1 Lecture — Retrieval Agents and Lakebase Search on Databricks
Big picture first: this lecture answers one question — once you have documents and a question, what is the actual mechanism that finds the right passage and hands it to the model? Everything in the file (RAG pipeline, prompt/context/harness nesting, Genie vs. Knowledge Assistant vs. Custom Agent, Lakebase's two search extensions, hybrid fusion) is one continuous answer to that question, at increasing levels of mechanism.
先讲大图景:这节课只回答一个问题——有了文档和一个问题之后,到底是什么机制找到正确的那段内容并交给模型?文件里的所有内容(RAG 流程、提示词/上下文/执行框架的嵌套关系、Genie 与 Knowledge Assistant 与自定义智能体的对比、Lakebase 的两种搜索扩展、混合检索融合)都是对这同一个问题在不同机制层级上的持续回答。
A. Why retrieval agents, and the common pipeline
A model's own knowledge is frozen at training time and has no access to private documents. A retrieval agent closes that gap by running a 4-stage pipeline every time: Indexing (chunk and embed documents once, ahead of time), Retrieval (find the chunks relevant to this question), Generation (the model answers using only those chunks), Feedback (log what was retrieved and how it was used, to improve the next round).
模型自身的知识在训练时就被冻结了,也接触不到私有文档。检索增强智能体通过每次运行一个四阶段流程来弥补这个缺口:索引(提前把文档切块并生成向量,一次性完成)、检索(找到与这个问题相关的那些块)、生成(模型只用这些块来回答)、反馈(记录检索到了什么、怎么被用的,用来改进下一轮)。
B. Prompt Engineering → Context Engineering → Harness Engineering
Three nested levels, each containing the one before it. Prompt engineering: how you phrase the instruction to the model. Context engineering: what information surrounds that instruction — retrieved chunks, conversation history, tool outputs. Harness engineering: the runtime loop, guardrails, observability, and feedback loops that make the whole agent reliable in production, not just smart in a demo. A great prompt inside a weak harness still fails in production.
三个层层嵌套的层级,每一层都包含前一层。提示词工程:怎样表述给模型的指令。上下文工程:这条指令周围有哪些信息——检索到的文本块、对话历史、工具输出。执行框架工程:让整个智能体在生产环境中可靠运行的运行时循环、护栏、可观测性和反馈回路,而不只是在演示里看起来聪明。一个好的提示词放进一个薄弱的执行框架里,到了生产环境照样会失败。
C. Retrieval approaches: Genie, Knowledge Assistants, Custom Agents
| Approach | Control | Effort | When |
|---|---|---|---|
| Genie Agents | Low — managed, declarative | Minutes — zero pipeline code, Content Search (beta) | Fast path, standard document corpora |
| Knowledge Assistants | Medium | Legacy pattern — bring-your-own AI Search index | Existing index already built |
| Custom Agents | Full | Code-first, highest effort | Non-negotiable control requirements — CCAR-P's enforcement-ladder reasoning applies directly here |
三种检索方式在"控制力"和"开发成本"之间做取舍:Genie Agent 托管、声明式,几分钟上线;Knowledge Assistant 需要自带已建好的索引;自定义智能体代码优先、控制力最强,但成本最高——这正是 CCAR-P 强制执行阶梯推理可以直接套用的场景:当某项控制不能商量时,才值得付出自定义智能体的成本。
D–E. Lakebase, and hybrid search via RRF
Lakebase is a managed serverless Postgres, positioned for operational workloads — agent state and memory — not analytics, and it syncs with the Lakehouse so the same governed data is reachable from both. Two Postgres extensions do the retrieval work: lakebase_vector (approximate nearest-neighbor semantic search, pgvector-syntax, IVF+RaBitQ quantization) and lakebase_text (BM25 full-text keyword search, tsvector-compatible, Block-Max WAND top-K pushdown). Hybrid search runs both and fuses the two ranked lists with Reciprocal Rank Fusion (RRF): each document's score is the sum of 1/(k+rank) across both lists, so a document that ranks well on meaning but shares zero exact words with the query can still surface — the case a pure keyword search would miss, and a case the lecture's diagram illustrates directly (confirmed readable from the raw file, full SVG and its accessibility label intact).
Lakebase 是托管的无服务器 Postgres,定位是业务型工作负载——智能体的状态和记忆——而不是分析型工作负载,并且会与 Lakehouse 同步,使同一份受治理的数据可以从两边同时访问。两个 Postgres 扩展承担检索工作:lakebase_vector(近似最近邻语义搜索,pgvector 语法,IVF+RaBitQ 量化)和 lakebase_text(BM25 全文关键词搜索,兼容 tsvector,Block-Max WAND 的 top-K 下推)。混合检索同时跑这两种搜索,再用倒数排名融合(RRF)把两个排名列表融合:每个文档的得分是两个列表中 1/(k+rank) 的加总,所以一个在语义上很贴切、但和查询词一个字都不重合的文档,照样能被排到前面——这正是纯关键词搜索会漏掉的情况,讲义里的示意图直接演示了这一点(已确认可从原始文件中完整读取,包括 SVG 图形和它的无障碍文字说明)。
"IVF+RaBitQ quantization" is a name-drop here — File 8's appendix opens up exactly what IVF means mechanically (how the partitioning actually works) and adds the GUCs you'd tune it with.
这里的"IVF+RaBitQ 量化"只是先点个名——File 8 附录会把 IVF 到底怎么运作讲透,还会给出调它用的那几个 GUC 参数。
Hybrid search is the direct answer to a recurring audit-evidence problem: a reconciliation question phrased in plain English ("why did this obligation not match Treasury") needs to find the right supporting document even when the document uses different wording (USSGL account names, system-specific codes). RRF-style fusion, not keyword search alone, is the mechanism that makes that findable.
混合检索直接回应了审计证据场景里反复出现的一个问题:用自然语言提出的对账问题("这笔义务为什么和财政部的数据不一致")需要找到正确的支持性文档,即便文档用的是完全不同的措辞(USSGL 科目名称、各系统特有的代码)。能让这类文档被检索到的机制,是 RRF 式的融合检索,而不是单纯的关键词搜索。
File 2 Demo — Creating a Genie Agent for Unstructured Data
Big picture first: this demo walks two different paths to "Genie can see this document," and the gap between them is the real lesson. Attaching a volume at agent creation gets file visibility only — the agent lists the PDF but has not indexed it. Turning on Content Search is the step that actually triggers Lakebase indexing underneath. A later step proves indexing stays manual going forward too: a new document dropped into an already-indexed volume stays invisible until someone clicks Re-index.
先讲大图景:这个演示走了两条不同的路径让 Genie "看到"文档,而这两条路径之间的差距才是真正的教学重点。在创建智能体时附加 volume,只带来文件可见性——智能体能列出 PDF,但还没有建立索引。打开 Content Search 才是真正触发底层 Lakebase 索引的那一步。后面的步骤还证明了索引之后依然不是自动的:一份新加入已建索引 volume 的文档,在有人点击"重新索引"之前,始终不可见。
B–C. Two volumes, two source descriptions, one agent
Setup provisions two volumes, each one PDF: listings_vol (Airbnb property listings) and house_rules_vol (guest house rules). Before wiring either into Genie, the demo has you write a source description for each — what the document contains, what questions it answers, and explicitly what it does not contain ("this is a listings catalog, it does not contain guest policies"). That negative statement is doing real work: it is what keeps Genie from guessing an answer out of the wrong document when a question is ambiguous.
课堂设置提供了两个 volume,每个各存一份 PDF:listings_vol(Airbnb 房源列表)和 house_rules_vol(房客须知)。在把任何一个接入 Genie 之前,演示要求先给每份文档写一段来源说明——这份文档包含什么、能回答什么问题,以及明确指出它不包含什么("这是房源目录,不包含房客政策")。这句否定说明在真正发挥作用:当问题含糊不清时,正是它防止 Genie 从错误的文档里猜出一个答案。
The agent is created against house_rules_vol directly in the creation flow. Step C1 then asks it "what context files do you have access to?" and the answer only lists that one PDF — proof the agent can see it, but notice this happens before Content Search is ever mentioned. File visibility and indexing are two separate things, and this step exists to make you notice the difference before the next step blurs it.
智能体是在创建流程中直接针对 house_rules_vol 建立的。步骤 C1 接着问它"你能访问哪些上下文文件",得到的答案只列出了这一份 PDF——这证明了智能体能看到它,但要注意这发生在 Content Search 被提到之前。文件可见性和建立索引是两件不同的事,这一步的设计意图就是让你先注意到这个区别,再进入下一步容易把两者混在一起的地段。
D. Content Search, and what it actually provisions underneath
Adding the second volume (listings_vol) through Sources → Add → Volume is what turns on Content Search and starts real indexing — the UI shows "Indexing" then "Ready." Step D4, admin-only, inspects what that indexing job actually built: a Lakebase project (named like vi-ws-XXX-lakebase, owned by a volume-index system service principal) holding a table shaped exactly like File 1's hybrid search extensions, not analogous to them — the same mechanism.
通过"数据源 → 添加 → Volume"添加第二个 volume(listings_vol)才是真正打开 Content Search、启动真实索引的动作——界面上会先显示"Indexing",之后变成"Ready"。只有管理员能看的步骤 D4,检查了这次索引任务到底建出了什么:一个 Lakebase 项目(名字类似 vi-ws-XXX-lakebase,由一个负责 volume 索引的系统服务账号持有),其中有一张表,结构和 File 1 里讲的混合检索扩展完全一致——不是"类似",而是同一套机制。
| Column group | Columns |
|---|---|
| Document metadata | filename, modificationTime, doc_uri, doc_type |
| Parsing config | parser, splitter, chunk_size, chunk_overlap |
| Chunks | chunk_id (primary key), chunk_pos_id, chunk_text, metadata, parsed_doc_summary |
| Search columns | embedding_model, __db_chunk_text_pgvector VECTOR(1024), __db_chunk_text_tsvector TSVECTOR (generated columns) |
| Indexes | LAKEBASE_ANN on the pgvector column, LAKEBASE_BM25 on the tsvector column, plus a btree on chunk_id |
这张表直接对上了 File 1 的术语:pgvector 列配 LAKEBASE_ANN 索引,就是 lakebase_vector 扩展(近似最近邻语义检索);tsvector 列配 LAKEBASE_BM25 索引,就是 lakebase_text 扩展(BM25 全文检索)。Content Search 这个产品级功能名字背后,字面意义上就是把文档切块、生成向量,同时建好两套索引,放进同一张表——这正是混合检索能够融合两种排名列表的前提条件。
This closes the loop with File 1 by name, not just by analogy: __db_chunk_text_pgvector paired with LAKEBASE_ANN is lakebase_vector; __db_chunk_text_tsvector paired with LAKEBASE_BM25 is lakebase_text. Content Search is the product name; Lakebase hybrid search is the mechanism underneath it, chunking and indexing into both columns of one table the moment indexing runs.
E. Three query patterns
The demo deliberately asks three prompts: one answerable from the house rules PDF alone (pet policy, quiet hours), one from the listings PDF alone (proximity to Golden Gate Park and amenities), and a third that needs both — "summarize a listing's amenities and the house rules a guest would need to follow." That third prompt is the actual test of hybrid retrieval across documents, not within one; each cited answer should trace back to a specific source PDF when you expand citations.
演示特意设计了三个问题:一个只能从房屋规则 PDF 回答(宠物政策、安静时段),一个只能从房源列表 PDF 回答(靠近金门公园的房源及其配套设施),第三个则需要两份文档都用上——"总结某个房源的配套设施,以及房客需要遵守的房屋规则"。第三个问题才是真正测试跨文档混合检索能力的场景,而不是单一文档内的检索;展开引用时,每条答案都应该能追溯到具体的那份源 PDF。
F. The re-index gotcha, proven by before/after
Section F is a controlled experiment: ask about an invoice before it exists in the volume (no answer, correctly), copy the PDF in with a short Python cell, then ask again immediately — still no answer, because the copy alone does not trigger indexing. Only after clicking Re-index in the Sources tab and waiting for "Synced" does the same question get a cited answer. The copy step itself is plain code, not a UI click:
第 F 节是一次对照实验:发票还没加入 volume 之前先问一次(正确地得不到答案),用一段简短的 Python 代码把 PDF 复制进去,然后立刻再问一次——仍然得不到答案,因为单纯复制文件并不会触发索引。只有在"数据源"标签里点击"重新索引"并等到状态变为"Synced"之后,同一个问题才能得到带引用的答案。复制这一步本身是普通代码,不是界面点击:
dest_dir = f"/Volumes/{"{catalog_name}"}/{"{schema_name}"}/listings_vol/invoices"
os.makedirs(dest_dir, exist_ok=True)
shutil.copy("./Includes/data/invoices/invoice_01.pdf",
os.path.join(dest_dir, "invoice_01.pdf"))
# file is now in the volume — but NOT yet searchable.
# Content Search only re-indexes on an explicit "Re-index" click.This is the closest thing in Day 1 to a working prototype of a Key Supporting Documentation (KSD) retrieval tool: point it at a volume of scanned invoices or reconciliation memos instead of Airbnb PDFs, and the same pattern — source descriptions, Content Search, citation-backed answers — becomes an auditor-facing "find the evidence for this transaction" assistant. Section F makes the risk concrete rather than theoretical: a document land in storage and a document being findable are two different timestamps, and the gap between them is exactly where an audit finding lives. Any KSD pipeline built this way needs the re-index trigger wired into the ingestion step itself, not left as a manual click, or "evidence exists but wasn't found" becomes a recurring, explainable failure mode instead of a one-off.
这是 Day 1 材料里最接近"关键支持性文档(KSD)检索工具"原型的一个场景:把它指向扫描发票或对账备忘录的 volume,而不是 Airbnb 的 PDF,同样的模式——来源说明、Content Search、带引用的答案——就变成了一个面向审计人员的"帮我找这笔交易的证据"助手。第 F 节把这个风险从理论变成了具体事实:一份文档"存进去"的时间点,和一份文档"能被检索到"的时间点,是两个不同的时间戳,而这两者之间的空隙,正是审计发现(finding)最容易出现的地方。任何照这个模式搭建的 KSD 流水线,都需要把重新索引这一步直接接入数据接入环节本身,而不是留给人工点击,否则"证据其实存在、只是没被检索到"就会从一次性意外,变成一种反复出现、却可以被审计质疑的系统性失败模式。
File 3 Lab — Information Retrieval with Lakebase Search
Big picture first: Lab 3 makes you build the query side of hybrid search by hand, in SQL, inside a Lakebase project pre-loaded with a doc_chunks table (chunk text, a 1024-dim embedding column, a chunk_tsvector column). It's the mechanism File 1 only described and File 2 only showed as a black box, now with every operator visible.
先讲大图景:Lab 3 让你亲手用 SQL 搭建混合检索的查询那一端,在一个预先加载好 doc_chunks 表(文本块、1024 维的 embedding 列、chunk_tsvector 列)的 Lakebase 项目里完成。这正是 File 1 只做理论描述、File 2 只当黑箱展示的机制,现在每个算子都看得见。
Three ways data gets into a Lakebase search table, vs. Content Search
| Path | How | When you'd use it |
|---|---|---|
| Start from scratch | Create VECTOR(n) + TSVECTOR columns, insert data, build lakebase_ann + lakebase_bm25 indexes | You already have chunked, embedded data from elsewhere |
| Existing Lakebase table | Columns already the right shape — just build the two indexes | Migrating an existing Postgres table into search |
| Sync from Unity Catalog | A synced table maps the embedding column to VECTOR(n) and generates TSVECTOR from a text column during sync, then builds the indexes | You parsed/chunked/embedded upstream yourself, just need the search layer |
| Content Search (File 2) | Point at a raw-file volume; Databricks parses, chunks, embeds, and indexes automatically | Raw unstructured files, zero pipeline code |
数据进入 Lakebase 检索表的前三种方式,都假设切分和向量化已经在别处完成了,Lakebase 只负责建索引。只有 Content Search 会自动帮你完成解析和切分——这是四者里唯一一个"从原始文件直接到可检索"全自动的路径;Lab 3 的 SQL 是在处理流水线的产出,而不是流水线本身。
Four stages, confirmed from the actual queries
| Stage | Question | When | Mechanism |
|---|---|---|---|
| Chunking | How do we cut a document into retrievable units? | Once per document, before anything else | Not shown here — doc_chunks arrives pre-populated. File 4's subject. |
| Embedding | How do we turn text into a meaning-bearing vector? | Once per chunk (index time) and once per query (query time) | ai_query(endpoint, text) — e.g. ai_query('databricks-qwen3-embedding-0-6b', '...') → 1024-dim vector |
| Indexing | How do we structure stored data so search is fast at scale? | Once, rebuilt on change | LAKEBASE_ANN on the vector column, LAKEBASE_BM25 on the tsvector column |
| Ranking | Given a query, which items are most relevant, in what order? | Every query | <=> cosine distance, <@> BM25 score, RRF fusing both |
Chunking and indexing are build-time, done once. Ranking happens at query time. Embedding straddles both — once per chunk when indexing, once per query when searching. The RRF query proves this structurally: it runs two independent RANK() OVER (...) subqueries (LIMIT 40 each) before fusing them with COALESCE(1.0/(60+v.rank),0) + COALESCE(1.0/(60+k.rank),0) AS rrf_score — ranking is a post-retrieval step applied to whatever indexing already made fast to retrieve.
切分和建索引是构建时、只做一次的;排序发生在查询时;向量化横跨两边——建索引时对每个文本块做一次,查询时对问题再做一次。RRF 查询在结构上证明了这一点:先跑两个独立的 RANK() OVER (...) 子查询(各 LIMIT 40),再用 COALESCE(1.0/(60+v.rank),0) + COALESCE(1.0/(60+k.rank),0) AS rrf_score 融合——排序是索引已经让检索变快之后,加在检索结果之上的后处理步骤。
-- B3: vector similarity (cosine distance, lower = more similar)
SELECT chunk_text, embedding <=> '<1024-dim vector>' AS distance
FROM doc_chunks ORDER BY distance; -- ~0.501
-- B4: keyword search (BM25, negative score, ascending = best first)
SELECT *, chunk_tsvector <@> to_bm25query(
to_tsvector('english','Victorian'), 'doc_chunks_ts_idx') AS score
FROM doc_chunks ORDER BY score; -- ~-0.556
-- B5: hybrid, RRF over independently ranked top-40 lists
WITH vector_ranked AS (
SELECT chunk_id, RANK() OVER (ORDER BY dist) AS rank FROM (
SELECT chunk_id, embedding <=> '<vec>' AS dist
FROM doc_chunks ORDER BY dist LIMIT 40) v),
keyword_ranked AS (
SELECT chunk_id, RANK() OVER (ORDER BY score) AS rank FROM (
SELECT chunk_id, chunk_tsvector <@> to_bm25query(
to_tsvector('english','Victorian'),'doc_chunks_ts_idx') AS score
FROM doc_chunks ORDER BY score LIMIT 40) k)
SELECT d.chunk_id, LEFT(d.chunk_text,120) AS preview,
COALESCE(1.0/(60+v.rank),0) + COALESCE(1.0/(60+k.rank),0) AS rrf_score
FROM doc_chunks d
LEFT JOIN vector_ranked v ON d.chunk_id = v.chunk_id
LEFT JOIN keyword_ranked k ON d.chunk_id = k.chunk_id
WHERE v.chunk_id IS NOT NULL OR k.chunk_id IS NOT NULL
ORDER BY rrf_score DESC LIMIT 10;Two operators did real work above without being named: <=> is vector_cosine_ops, and <@> is the BM25 distance operator. Both, plus the lakebase_ann index these queries lean on for speed, get their full explanation in File 8's appendix — including the two other distance operators (<->, <#>) this lab didn't need but you may.
上面用到了两个没点名解释的操作符:<=> 是 vector_cosine_ops,<@> 是 BM25 距离操作符。这两个,加上这些查询靠它提速的 lakebase_ann 索引,完整讲解都在 File 8 附录 里——还包括这个 lab 没用到、但你可能会用到的另外两种距离操作符(<->、<#>)。
This lab is the literal implementation of the RRF formula described abstractly in File 1 — the same k=60 constant, the same top-K-then-fuse pattern. For a KSD retrieval tool, this is the SQL you would actually own and tune: raise LIMIT for recall-sensitive audit evidence searches, adjust the RRF constant to favor keyword matches on exact account codes over semantic similarity, or weight one signal over the other depending on whether the question names a specific USSGL code (favor BM25) or describes a situation in plain English (favor vector).
这个 lab 就是 File 1 里抽象描述的 RRF 公式的具体实现——同样的 k=60 常数,同样的"先各取 top-K 再融合"模式。对一个 KSD 检索工具来说,这正是你会真正拥有并调优的 SQL:对召回率敏感的审计证据检索可以调大 LIMIT;可以调整 RRF 常数,让精确的科目代码匹配更偏向关键词检索;也可以根据问题是点名具体 USSGL 科目代码(偏向 BM25)还是用自然语言描述情境(偏向向量检索)来调整两个信号的权重。
File 4 Lecture — Document Parsing and Chunking Strategies for AI Search
Big picture first: this is the file every earlier section pointed to as "not yet covered." Four SQL AI Functions, each one stage of turning a PDF into a searchable row: ai_parse_document (parsing — confirmed as the exact function Content Search uses under the hood), ai_classify and ai_extract (metadata), ai_prep_search (chunking). The deepest idea isn't any one function — it's that ai_prep_search produces two different columns from the same chunk, one to embed and one to retrieve.
先讲大图景:这是前面每一节都说"还没讲到"所指的那个文件。四个 SQL AI 函数,各负责把 PDF 变成可检索数据这条流水线上的一环:ai_parse_document(解析——已确认就是 Content Search 背后用的那个函数)、ai_classify 和 ai_extract(元数据)、ai_prep_search(切分)。最深的那个想法不是任何一个函数本身——而是 ai_prep_search 从同一个文本块产出两个不同的列,一个用来向量化,一个用来检索。
A-C. Parse, classify, extract
ai_parse_document(content, MAP('version','2.0')) against a volume returns a VARIANT (structured JSON) with layout-aware text — document:elements and document:pages. variant_explode turns that JSON into queryable rows. ai_classify assigns a label from a defined set (routing logic — which processing path a document takes); ai_extract pulls named fields into real columns. Both get joined onto the chunk table as metadata, which is what lets AI Search filter or rank by document type or extracted value later, not just by semantic similarity.
对一个 volume 调用 ai_parse_document(content, MAP('version','2.0')),返回一个带版式信息的结构化 JSON(VARIANT),拆成 document:elements 和 document:pages。variant_explode 把这个 JSON 变成可查询的行。ai_classify 从一组预定义标签里选一个(路由逻辑——文档走哪条处理路径);ai_extract 把命名字段抽取成真正的列。两者都会拼接到文本块表里作为元数据,这正是后面 AI Search 能按文档类型或抽取字段过滤、排序,而不只靠语义相似度的原因。
D. Chunking principles, and the embed/retrieve split
ai_prep_search chunks using AI-found semantic boundaries instead of fixed character counts. Three stated principles: chunk size must respect the embedding model's context window (overflow is silently truncated — a dangerous failure mode, nothing errors); 10-20% overlap prevents information loss at boundaries; smaller chunks are more precise but lose context, larger chunks keep context but dilute signal. The "Lost in the Middle" phenomenon (LLMs attend less to information buried mid-context than at the start or end) is given as the reason to favor smaller, focused chunks.
ai_prep_search 用 AI 找到的语义边界切分,而不是固定字符数。文中给出三条原则:chunk 大小必须符合向量模型的上下文窗口(超出部分会被静默截断——危险的失败模式,不会报错);10-20% 的重叠能防止边界处信息丢失;块越小越精确但失去上下文,块越大保留上下文但信号被稀释。"Lost in the Middle"(迷失在中间,大语言模型对长上下文中间部分的关注度低于开头和结尾)被直接点名,作为偏好更小、更聚焦的块的理由。
chunk_to_embed ≠ chunk_to_retrieveEmbedding answers "what is this chunk about?" — gets surrounding context prepended (headers, section titles) so the vector lands in the right region of vector space. The lecture's example: "The fee is $50" alone embeds meaninglessly; "Cleaning Policy > Late Checkout: The fee is $50" is findable. Retrieval answers "what should the LLM read?" — the clean original text, no prepended metadata, since that would waste context and risk confusing generation. Rule: optimize for findability when embedding, optimize for readability when retrieving.
向量化回答"这个块讲的是什么"——会加上周边上下文(标题、章节名),让向量落在向量空间里正确的区域。课程例子:单独的 "The fee is $50" 向量化毫无意义;"Cleaning Policy > Late Checkout: The fee is $50" 就能被找到。检索回答"应该给模型读什么"——是没有附加元数据的干净原文,因为那会浪费上下文、还可能干扰生成。原则:向量化时为"可被找到"优化,检索时为"可读性"优化。
E. The real Vector Search index parameters
| Parameter | What it does |
|---|---|
| endpoint_name | Which Vector Search endpoint serves the index |
| source_table_name | The Delta table with your chunks |
| index_name | Fully-qualified Unity Catalog name for the index |
| pipeline_type | TRIGGERED (sync on demand) or CONTINUOUS (auto sync) |
| primary_key | Unique row ID, tracks what's been processed |
| embedding_source_column | Which column goes to the embedding model — this is chunk_to_embed |
| embedding_model_endpoint_name | e.g. databricks-gte-large-en |
| columns_to_sync | Columns returned in search results — this is where chunk_to_retrieve goes |
Change Data Feed (ALTER TABLE ... SET TBLPROPERTIES (delta.enableChangeDataFeed = true)) is required for incremental sync — without it, every sync reprocesses the whole table. TRIGGERED is the batch-friendly choice; CONTINUOUS costs more compute for near-real-time freshness.
开启 Change Data Feed(ALTER TABLE ... SET TBLPROPERTIES (delta.enableChangeDataFeed = true))是增量同步的必要条件——不开启,每次同步都要重新处理整张表。TRIGGERED 适合批处理场景;CONTINUOUS 用更多算力换取接近实时的新鲜度。
This file is the actual recipe for the Vector Search build Section 7 calls for in Advana (no Lakebase there). Concretely: run ai_parse_document + ai_classify/ai_extract on KSD PDFs and reconciliation memos, produce chunk_to_embed (with USSGL account hierarchy or document-type headers prepended, for findability) and chunk_to_retrieve (clean text, for the agent to read) via ai_prep_search, then create the index with embedding_source_column pointing at chunk_to_embed and columns_to_sync including chunk_to_retrieve plus the classified/extracted metadata columns for filtering by document type.
这份文件就是 Section 7 在 Advana(没有 Lakebase)要求的 Vector Search 搭建方案的真实配方。具体做法:对 KSD PDF 和对账备忘录跑 ai_parse_document + ai_classify/ai_extract,通过 ai_prep_search 产出 chunk_to_embed(前面加上 USSGL 科目层级或文档类型标题,便于被找到)和 chunk_to_retrieve(干净文本,供智能体阅读),然后建索引时让 embedding_source_column 指向 chunk_to_embed,columns_to_sync 包含 chunk_to_retrieve 以及分类/抽取出的元数据列,用于按文档类型过滤。
File 5 Demo — Transforming PDFs to Structured Data
Big picture first: File 4 described ai_parse_document, ai_classify, and ai_extract as concepts. File 5 is the hands-on proof that all three run together, in one SQL statement, over a real PDF, landing in an ordinary Delta table — no Lakebase, no Vector Search endpoint, nothing beyond CREATE TABLE AS. It is the smallest possible version of a PDF-to-structured-data pipeline, and the direct template for turning a scanned invoice or KSD into queryable columns.
先讲大图景:File 4 只是把 ai_parse_document、ai_classify、ai_extract 当作概念来讲。File 5 用一个真实 PDF 证明了这三者可以在同一条 SQL 语句里一起跑,最终落地成一张普通的 Delta 表——不需要 Lakebase,不需要 Vector Search 端点,只需要 CREATE TABLE AS。这是"PDF 变结构化数据"流水线能做到的最小可行版本,也是把一张扫描发票或 KSD 变成可查询列的直接模板。
B–B1. Parse, then flatten the VARIANT into rows
ai_parse_document(content, MAP('version','2.0')) against a raw PDF (read via READ_FILES(..., format => 'binaryFile')) returns one VARIANT column per document. Pinning version => '2.0' matters for the same reason a schema version always matters: it freezes the shape of the output (the elements array, bounding boxes, descriptions) so a future default-version change doesn't silently break downstream SQL. LATERAL variant_explode(parsed:document:elements) is the step that turns "one JSON blob per document" into "one row per content block" — the colon operator (:) navigates into the VARIANT, and ::STRING casts a field out of it.
对一个原始 PDF(通过 READ_FILES(..., format => 'binaryFile') 读取)调用 ai_parse_document(content, MAP('version','2.0')),每份文档返回一列 VARIANT。固定 version => '2.0' 的理由和任何场景下固定 schema 版本的理由一样:它把输出的结构(elements 数组、边框坐标、描述文字)锁死,这样以后默认版本变了,也不会悄悄把下游 SQL 搞坏。LATERAL variant_explode(parsed:document:elements) 这一步,就是把"每份文档一个 JSON 大块"变成"每个内容块一行"——冒号操作符(:)钻进 VARIANT 内部,::STRING 把字段转成字符串。
format => 'binaryFile' is generic: it works for any file type at all — PDF, PNG, DOCX, a zip archive — because it does no interpretation of the file's contents. It returns exactly four columns: path, modificationTime, length, and content (raw, unparsed bytes). Its only job is to get those bytes into a column so ai_parse_document has something to parse. All of the real document understanding, including OCR for a scanned (image-based) PDF, happens one step later inside ai_parse_document itself — File 4's description of it as doing "OCR + layout analysis + figure descriptions + bounding boxes" is the detail that lives here.
format => 'binaryFile' 是通用的:它对任何文件类型都有效——PDF、PNG、DOCX、压缩包——因为它完全不解读文件内容,只返回四列:path、modificationTime、length、content(未经解析的原始字节)。它唯一的任务是把这些字节放进一列,交给 ai_parse_document 去解析。真正的文档理解,包括对扫描版(图像型)PDF 做 OCR,都发生在下一步、ai_parse_document 内部——File 4 里说它做"OCR + 版式分析 + 图表描述 + 边框坐标",指的正是这一步。
C vs. D. Classify answers "what kind," extract answers "what facts"
| ai_classify | ai_extract | |
|---|---|---|
| Question | What type of content is this? | What specific facts does it contain? |
| Input 2nd arg | JSON array of candidate labels | JSON array of field names to look for |
| Output shape | VARIANT with a response array — cls:response[0] is the top label | VARIANT with a response object — ext:response.field_name by dot notation |
| Length filter used | LENGTH(content) > 50 — just enough text to categorize | LENGTH(content) > 100 — needs more surrounding text to locate field values reliably |
| Example | "pricing_information" | property_name: "Sunny Victorian" |
两者问的是不同的问题:classify 回答"这是哪一类内容",从你给定的标签集合里选一个;extract 回答"这段内容里有哪些具体事实",从你给定的字段名列表里把值抽出来。两者的长度过滤门槛不同是有意为之——分类只需要够分类的文本量,抽取需要更多上下文才能准确定位字段值。classify 用的是比较宽松的 50 字符门槛,extract 用的是更严格的 100 字符门槛。
E. Both functions run in parallel, per row, in one CREATE TABLE AS
The production query puts ai_classify(content, ...) and ai_extract(content, ...) in the same SELECT, inside one classified_extracted CTE. Because they are independent calls against the same content column in the same row, Databricks runs them in parallel per row rather than sequentially — this is a cost and latency detail worth knowing before estimating what a classify+extract pipeline will cost at KSD volume. The whole thing resolves to one CREATE OR REPLACE TABLE statement: parse, classify, and extract never leave SQL, and the result is an ordinary Delta table other tools and agents can query without knowing any AI Function was involved.
生产版查询把 ai_classify(content, ...) 和 ai_extract(content, ...) 放进同一个 SELECT、同一个 classified_extracted CTE 里。因为它们是对同一行的同一个 content 列做的两次独立调用,Databricks 会按行并行执行,而不是顺序执行——在估算 classify+extract 流水线在 KSD 量级下的成本和延迟之前,这个细节值得先搞清楚。整条流程最终收敛成一条 CREATE OR REPLACE TABLE 语句:解析、分类、抽取全程都在 SQL 里完成,结果是一张普通的 Delta 表,其他工具和智能体可以直接查询,完全不需要知道背后用过任何 AI 函数。
This is the smallest end-to-end template for an actual KSD-ingestion job: point READ_FILES at a volume of scanned invoices or reconciliation memos instead of airbnb_listings.pdf, swap the classify labels for document types that matter ("invoice", "reconciliation_memo", "obligation_support"), swap the extract fields for what an auditor actually needs (obligation_number, ussgl_account, amount, document_date), and the same CREATE OR REPLACE TABLE AS produces a queryable evidence index — no Lakebase, no Vector Search, available even before Section 7's fuller Phase 2 build exists. It is also the fastest way to validate whether ai_classify/ai_extract are accurate enough on real financial documents before investing in the heavier chunk_to_embed/Vector Search pipeline from File 4.
这是一个真正能跑的 KSD 数据接入任务的最小端到端模板:把 READ_FILES 指向一个存放扫描发票或对账备忘录的 volume,而不是 airbnb_listings.pdf;把分类标签换成真正有意义的文档类型("invoice"、"reconciliation_memo"、"obligation_support");把抽取字段换成审计人员真正需要的字段(obligation_number、ussgl_account、amount、document_date)——同一条 CREATE OR REPLACE TABLE AS 语句就能产出一张可查询的证据索引表,不需要 Lakebase,不需要 Vector Search,甚至在 Section 7 更完整的 Phase 2 搭建完成之前就能先用起来。这也是在投入更重的 chunk_to_embed / Vector Search 流水线(File 4)之前,验证 ai_classify/ai_extract 在真实财务文档上准确率够不够的最快方法。
G. Extending the pattern to messy scanned documents: reprogramming and apportionment packets
A reprogramming action packet (the base document is likely DD Form 1414, Base for Reprogramming Action, followed by a required spend plan — worth confirming the exact form number against what your office actually files) is the hard case this file's pattern does not survive unchanged. It is scanned, so parsing is OCR-dependent and quality-sensitive. The same dollar figure, LOA, and suspense date can appear twice: once in a table, once restated in the narrative justification — and the two copies must agree, which is exactly the kind of check a single AI extraction call will not catch on its own.
一份重新编程(reprogramming)文件包(基础文件很可能是 DD Form 1414,Base for Reprogramming Action,后面跟一份要求的支出计划——具体表号值得对照你们单位实际报送的文件再确认一次),是这份文件的模式不能照搬不变的那种难例。它是扫描件,解析依赖 OCR,对扫描质量很敏感。同一个金额、LOA、截止日期可能出现两次:一次在表格里,一次在叙述性说明里重复一遍——而这两份必须一致,这正是单次 AI 抽取调用自己抓不住的那种检查。
| Step | What changes from this file's pattern |
|---|---|
| 1. Parse | ai_parse_document version 2.0 already table-aware for scanned input — OCR runs automatically. Split elements by type: table elements arrive with row/column structure already resolved; text/narrative elements still need extraction. |
| 2. Classify, per element not per document | ai_classify each element as table_row vs narrative, and separately as increase vs decrease vs informational — this is the label the validation math downstream actually keys on. |
| 3. Extract, with explicit format hints | ai_extract field names alone ("amount") don't tell the model a dollar figure must come back as a signed number, not a string with a "$". State the expected type and sign convention in the field description itself. |
| 4. Validate in SQL, not in the AI function | Regex-check the LOA against the known TAS/BETC shape. CAST the extracted amount to DECIMAL and fail loudly, not silently, if it won't cast. Reconcile: table copy vs. narrative copy of the same figure, and line items vs. any stated total. |
| 5. Route, don't merge | Anything that fails step 4 goes to a review_queue table, not the table an agent is allowed to cite. Only rows that pass every check land in the "verified" table — the thing in the comment's own words, "proposed, success stores verified." |
| 6. Keep the raw string | Store the original OCR'd text next to the typed, validated value, always. It is the only way a human can re-check an AI extraction against the actual scanned page later. |
Step 4 and 5 are the actual content of an internal control here, not an implementation detail: "does a number driving obligation authority get verified before anything downstream trusts it" is precisely what OMB Circular A-123 testing and an NFR response are asking about, whether the number came from a human keying it in or an AI function reading a scan. Build the review_queue table and the pass/fail criteria first, before the extraction prompts — the criteria are the control, and the extraction is just how the row gets a chance to meet them.
第 4、5 步才是这里真正的内部控制内容,不只是实现细节:"一个驱动义务权限(obligation authority)的数字,在下游任何环节信任它之前是否经过核实",正是 OMB Circular A-123 测试和 NFR 响应要问的问题,不管这个数字是人工敲进去的还是 AI 函数读扫描件读出来的。建议先搭 review_queue 表和通过/不通过的判定标准,再写抽取用的提示词——判定标准才是控制本身,抽取只是让这一行数据有机会去满足它。
No, and that's the insight worth sitting with. "100% accurate" conflates two different properties: repeatable (same input, same output, every run) and correct (matches the real number on the page). OCR on a scanned document is already lossy and probabilistic before any AI model runs; the LLM behind ai_extract adds a second probabilistic layer on top. Neither hits 100% correct on every input, regardless of prompt or model. The fix is not to chase determinism in the extraction step — it's to move determinism into the acceptance step. The AI's job becomes "produce a candidate," not "be right"; a fully deterministic gate (independent source cross-check, arithmetic closure, format/schema validation, table-vs-narrative agreement — steps 4-5 above, restated as a ranked list) decides whether that candidate is trusted. Confidence scores and prompt tuning never decide acceptance; SQL and reference data do, which is what makes the gate auditable. Human review doesn't disappear — it moves from "read the whole packet" to "read only what failed a gate."
不能,而这正是值得停下来想清楚的地方。"100% 准确"混淆了两件不同的事:可重复(同样输入,每次都跑出同样结果)和正确(和纸面上的真实数字一致)。扫描文档的 OCR 本身在任何 AI 模型介入之前就已经是有损、概率性的;ai_extract 背后的大语言模型又在上面叠加了一层概率性判断。无论怎么调提示词、换模型,都做不到每次输入都 100% 正确。解法不是在抽取这一步追求确定性,而是把确定性搬到验收这一步。AI 的任务变成"产出一个候选值",不是"必须做对";一组完全确定性的关卡(独立数据源交叉核对、算术闭合、格式/schema 校验、表格与叙述文本一致性——就是上面第 4、5 步换个角度重新排序)决定这个候选值是否被信任。置信度分数和提示词调优从不参与这个决定,SQL 和参照数据才参与,这正是这道关卡可审计的原因。人工审核并未消失,只是从"读整份文件"变成"只读没通过关卡的那部分"。
File 6 Lecture — AI Search on Databricks
Big picture first: this lecture names and formalizes the product every earlier file has been building toward without naming it directly: AI Search. It is the official successor name for what Databricks called Mosaic AI Vector Search (the rename shows up in Databricks' own Jun 2026 Data+AI Summit session title "Vector Search → AI Search: Rebuilding Retrieval for the AI Era," and in community discussion through mid-2026 — worth confirming against current docs, but treat "AI Search" and "Vector Search" as the same product line going forward in this notebook). The one new, load-bearing fact: AI Search is built on Unity Catalog tables and volumes, with no Lakebase dependency at all — which means it is the correct building block for Advana regardless of whether Lakebase Postgres is ever available there.
先讲大图景:这节课把前面每一节都在不点名地搭建的那个产品,第一次正式点出了名字:AI Search。它是 Databricks 曾经叫做 Mosaic AI Vector Search 的那个产品的官方新名字(这个改名在 Databricks 自己 2026 年 6 月 Data+AI Summit 的一场会议标题"Vector Search → AI Search: Rebuilding Retrieval for the AI Era"里能看到,2026 年年中社区讨论里也有体现——值得对照最新官方文档再确认一次,但本笔记从这里开始把"AI Search"和"Vector Search"当作同一条产品线)。一个新的、分量很重的事实:AI Search 建立在 Unity Catalog 的表和 volume 之上,完全不依赖 Lakebase——这意味着不管 Advana 以后有没有 Lakebase Postgres,它都是正确的构建组件。
A1–A3. Embeddings, HNSW, and what AI Search actually is
An embedding is a fixed-length vector (often 1024 dimensions) produced by an embedding model (databricks-gte-large-en, databricks-bge-large-en, databricks-qwen3-embedding-0-6b, or an external model) from the context a word or chunk appears in. Related meanings land near each other in that vector space regardless of shared words — the same claim File 1's hybrid search diagram made, now with the mechanism underneath named: Databricks uses HNSW (Hierarchical Navigable Small World) as its ANN algorithm, keeping lookups fast across hundreds of millions of vectors. The same rule from File 4 reappears here at the product level: query-time and index-time embedding must use the identical model, or the two vectors don't live in the same space and nothing compares meaningfully.
向量化(embedding)是向量模型(databricks-gte-large-en、databricks-bge-large-en、databricks-qwen3-embedding-0-6b,或外部模型)根据一个词或文本块出现的上下文,产出的一个固定长度向量(常见是 1024 维)。意思相近的内容会落在向量空间里相近的位置,不需要共享任何字面词——这正是 File 1 混合检索示意图想说明的那件事,这里给出了底层算法的名字:Databricks 用 HNSW(层次化可导航小世界图)作为近似最近邻算法,让即便面对数亿条向量,检索也能保持快速。File 4 里的那条规则在产品层面再次出现:查询时和建索引时的向量化必须用同一个模型,否则两个向量根本不在同一个空间里,比较毫无意义。
A4. Three ways to get embeddings into an index
This is File 4's Vector Search parameter table, now with its product-level name: embedding_source_column + embedding_model_endpoint_name set means managed; leaving the model endpoint unset while the source column already holds vectors means self-managed; Direct Access skips the parameter table approach entirely and writes through the API.
这正是 File 4 那张 Vector Search 参数表,现在有了产品层面的名字:设置了 embedding_source_column 和 embedding_model_endpoint_name 就是托管模式;源列里已经是向量、不设置模型端点就是自管理模式;Direct Access 完全不走这张参数表,直接通过 API 写入。
A5. CDF, and the stale-chunk failure mode
This is the precise mechanism behind a failure mode worse than File 2's re-index gotcha: there, a new document was invisible until re-indexed (a false negative — safe, if annoying). Here, an insert-only sync produces a false positive — a withdrawn or superseded reconciliation memo, corrected KSD, or retracted guidance stays retrievable and citable after it should no longer exist. For an audit-evidence tool, this is the worse failure of the two: an agent confidently citing evidence that has been formally withdrawn. CDF-driven sync with explicit handling of delete/update_postimage events is not optional for any FM Insight retrieval index — it is the only thing standing between "index is stale" and "agent cites something it shouldn't."
这正是比 File 2"重新索引"陷阱更严重的一种失败机制背后的原理:那里,新文档在重新索引之前不可见(假阴性——安全但烦人)。这里,仅插入式同步会产生假阳性——一份已撤回或被取代的对账备忘录、已更正的 KSD、或已撤销的指导意见,在理应消失之后仍然可以被检索和引用。对一个审计证据工具来说,这是两种失败里更严重的那一种:智能体理直气壮地引用一份已经被正式撤回的证据。带有 delete/update_postimage 事件显式处理的 CDF 驱动同步,对任何 FM Insight 检索索引都不是可选项——它是"索引过期"和"智能体引用了不该引用的东西"之间唯一的那道防线。
A6. Three search modes — the same RRF idea, with AI Search's own algorithm names
| Mode | Algorithm | Finds |
|---|---|---|
| Vector (semantic) | HNSW ANN | Rows whose meaning is closest, even with zero shared words |
| Keyword (full-text) | Okapi BM25 | Rows matching exact terms — names, codes, SKUs, account numbers |
| Hybrid | RRF fusion of both ranked lists | Best general default — mixes intent with specific terms |
和 File 1/File 3 讲的是同一个 RRF 思路,只是算法名字换成了 AI Search 自己的实现:语义检索用 HNSW 近似最近邻,关键词检索用 Okapi BM25,混合检索用 RRF 融合两个排名列表。机制相同,产品不同——这正是为什么前面几节讲的 RRF 直觉可以原样搬到 AI Search 上。
B1. Managed RAG vs. Custom RAG
B2. Governance: the same Unity Catalog story, drawn across the whole pipeline
C. AI Search vs. Lakebase Search — the question Section 7 left open, now answered
| AI Search | Lakebase Search | |
|---|---|---|
| What it is | Managed search over UC tables and volumes — embedding, indexing, retrieval fully managed | Postgres extensions adding vector + keyword search inside a Lakebase project |
| Primary use | Production search, document RAG over unstructured content (PDFs, docs, slides) | Operational search over structured/semi-structured data already in Postgres |
| Search modes | Vector (HNSW ANN), keyword (BM25), hybrid (RRF), hybrid + reranker | Vector (ANN), keyword (BM25), hybrid (RRF) |
| JOINs with operational data | No — a separate retrieval call | Yes — search, JOIN, filter in one SQL transaction |
| Permissions | Unity Catalog ACLs on the index | Postgres row-level GRANTs |
| Lakehouse integration | Native — Delta Sync from UC tables/volumes | Via synced tables, with type mapping |
That "Search modes" row hides one more real difference: AI Search's ANN is HNSW (a navigable graph), Lakebase Search's ANN is IVF (clustered partitions, per File 1). Different data structure, same job. AI Search ships it as a managed black box with no tuning knobs in this course's material; Lakebase's version exposes session-level GUCs you can actually turn. File 8's appendix is the IVF-side deep dive, and the right place to go if you ever do get a Lakebase to tune.
"检索模式"这一行还藏着一个真实的区别:"AI Search" 的 ANN 用的是 HNSW(一种可导航图结构),"Lakebase Search" 的 ANN 用的是 IVF(分区聚类,File 1 提到过)。数据结构不同,做的是同一件事。AI Search 把它做成了托管黑箱,课程材料里没给任何调优旋钮;Lakebase 那一版则暴露了真正能调的会话级 GUC 参数。File 8 附录 就是 IVF 那一侧的深入讲解——如果以后真的要调一个 Lakebase,这是该去的地方。
Section 7's open question was whether Vector Search is available independent of the Lakebase/UC rollout in Advana. This table answers it structurally: AI Search is built on UC tables and volumes, not on Lakebase, so its availability tracks Unity Catalog's rollout (confirmed "in the implementation"), not Lakebase's (confirmed absent). That makes AI Search, not Lakebase hybrid search, the correct Phase 2 target for FM Insight's KSD/evidence retrieval regardless of whether Lakebase Postgres ever lands in Advana — the plan in Section 7 was already pointed the right way for the right reason; this file supplies the product-level confirmation of why.
Section 7 留下的那个未解问题,是 Vector Search 在 Advana 能不能独立于 Lakebase/UC 的落地进度而使用。这张表从结构上回答了这个问题:AI Search 建在 UC 的表和 volume 之上,不建在 Lakebase 之上,所以它的可用性跟着 Unity Catalog 的落地进度走(已确认"正在实施中"),不跟着 Lakebase 走(已确认不存在)。这意味着对 FM Insight 的 KSD/证据检索来说,Phase 2 该瞄准的正确目标是 AI Search,不是 Lakebase 混合检索——不管 Advana 以后是否会上线 Lakebase Postgres 都一样。Section 7 的方向本来就是对的,这份文件补上了"为什么是对的"这个产品层面的确认。
File 7 Lab — Chunking PDFs and AI Search
Big picture first: this is the integration lab. Every function from Files 4-6 (ai_parse_document, ai_prep_search, CDF, Delta Sync, query_type modes) gets wired into one real, running AI Search index, queried through the actual SDK (AISearchClient) with the three search modes from File 6's table, side by side, on the same question. Nothing new conceptually — but one genuine gotcha surfaces here for the first time, and it's exactly the kind of mistake a naive build hits in production.
先讲大图景:这是整合实验。File 4-6 里的每一个函数(ai_parse_document、ai_prep_search、CDF、Delta Sync、query_type 几种模式)第一次被接成了一个真实跑起来的 AI Search 索引,并通过真正的 SDK(AISearchClient)用 File 6 表里的三种检索模式,对同一个问题并排查询。概念上没有新东西——但这里第一次冒出一个真实的坑,恰好是朴素实现在生产环境里会踩的那种坑。
B–C. The gotcha: ai_prep_search needs the full VARIANT, not the flattened table
B1 parses the PDF and flattens elements into a table (parsed_house_rules) for inspection — same pattern as File 5. C1 then needs to chunk that same content with ai_prep_search, and the lab states the trap explicitly: ai_prep_search() needs the full ai_parse_document VARIANT per document, not the already-flattened elements table from B1. The obvious move — chunk the table you just built — doesn't work. You have to re-run ai_parse_document (or keep its output around) and feed ai_prep_search the unflattened parsed column directly, then variant_explode(prepped:document:contents) to get one row per chunk.
B1 解析 PDF 并把元素展平成一张表(parsed_house_rules)用于检查——和 File 5 的模式一样。C1 接下来需要用 ai_prep_search 对同一份内容切分,而实验材料把这个坑直接点破了:ai_prep_search() 需要每份文档完整的 ai_parse_document VARIANT,不是 B1 已经展平的元素表。那个看起来顺理成章的做法——直接对刚建好的表做切分——是不行的。必须重新跑一次 ai_parse_document(或者把它的输出保留下来),把没展平的 parsed 列直接喂给 ai_prep_search,再用 variant_explode(prepped:document:contents) 取出一行一个 chunk。
D. Persisting chunks: renamed columns, UUID key, CDF required (not optional)
Writing the chunks table renames File 4's field names to the column names the index will actually reference: chunk_to_embed → chunk_text (what gets embedded), chunk_to_retrieve → retrieval_text (what the LLM reads). A uuid()-generated chunk_id becomes the primary key for both the table and the index. The lab states plainly what File 6 implied: delta.enableChangeDataFeed = true is required for AI Search to sync automatically, not a best practice you can skip.
写入 chunks 表的时候,把 File 4 的字段名改成了索引真正会引用的列名:chunk_to_embed → chunk_text(会被向量化的那一列),chunk_to_retrieve → retrieval_text(给 LLM 读的那一列)。用 uuid() 生成的 chunk_id 成为表和索引共用的主键。实验材料把 File 6 只是暗示的那件事说得很直接:delta.enableChangeDataFeed = true 对 AI Search 的自动同步是必须的,不是可以跳过的最佳实践。
E. Creating the index — File 6's parameter table, now with real values
Before creating the index, the lab polls client.get_endpoint(VS_ENDPOINT) until endpoint_status.state == "ONLINE" — a reminder that an AI Search endpoint is a provisioned resource with its own startup time, not instantaneous. The same check can be done by eye: Compute → AI Search in the left nav lists every endpoint with a Status column (confirmed from the actual workspace screenshot — vs_all_demo shows "Ready" there), alongside Serverless, SQL warehouses, Pools, Apps, and Lakebase on that same Compute page. create_delta_sync_index() then takes exactly the parameters File 4 and File 6 named abstractly: source_table_name = the chunks table, primary_key = chunk_id, embedding_source_column = chunk_text, embedding_model_endpoint_name = databricks-gte-large-en, pipeline_type = TRIGGERED, columns_to_sync = ["chunk_id", "chunk_text", "source_path"]. The except block re-syncs an already-existing index rather than failing — a small but real idempotency detail worth copying into any production build.
建索引之前,实验材料会轮询 client.get_endpoint(VS_ENDPOINT),直到 endpoint_status.state == "ONLINE"——提醒你 AI Search 端点是一个要启动的资源,不是瞬间就位的。同样的检查也能用肉眼完成:左侧导航的 Compute → AI Search 列出每个端点及其 Status 列(已从实际工作区截图确认——vs_all_demo 在那里显示 "Ready"),和 Serverless、SQL warehouses、Pools、Apps、Lakebase 一起排在同一个 Compute 页面上。create_delta_sync_index() 用到的参数,正好就是 File 4 和 File 6 抽象讲过的那些:source_table_name 是 chunks 表,primary_key 是 chunk_id,embedding_source_column 是 chunk_text,embedding_model_endpoint_name 是 databricks-gte-large-en,pipeline_type 是 TRIGGERED,columns_to_sync 是 ["chunk_id", "chunk_text", "source_path"]。except 代码块在索引已存在时选择重新同步、而不是报错失败——一个值得照搬进任何生产环境搭建的、不起眼但真实的幂等性细节。
F. One query, three modes, one parameter
| Subsection | Mode | query_type value | Mechanism |
|---|---|---|---|
| F1 | Similarity (vector ANN) | default — omit the parameter | Query embedded, compared via HNSW ANN |
| F2 | Hybrid | "hybrid" | Vector ANN + BM25, merged by RRF |
| F3 | Full-text keyword (Beta) | "FULL_TEXT" | BM25 only, no embeddings involved |
同一个 index.similarity_search() 方法,同一个查询文本("What are the house rules about pets?"),只改一个参数 query_type,就能在三种检索模式之间切换——这把 File 6 表格里的抽象概念变成了一行代码的区别,也是三种模式最容易直接对比的地方:同一个问题,三份结果,哪个模式实际找到了最相关的那个 chunk,一目了然。
This lab, almost unmodified, is the literal Phase 2 build Section 7 calls for. Swap airbnb_house_rules.pdf for a KSD PDF or reconciliation memo, swap the query in F1-F3 for a real audit question, and every other line — the CDF requirement, the chunk_text/retrieval_text split, the create_delta_sync_index call, the three query_type values — carries over unchanged, because none of it touches Lakebase. This is also the first place in the course where testing three retrieval modes against the same real question stops being a lecture point and becomes a five-minute experiment: run all three, read the three chunk sets, and decide which mode an FM Insight index should default to for KSD-style queries (named codes and account numbers argue for hybrid or full-text; open-ended "why doesn't this reconcile" questions argue for vector or hybrid).
这个实验几乎不用改动,就是 Section 7 要求的 Phase 2 搭建本身。把 airbnb_house_rules.pdf 换成一份 KSD PDF 或对账备忘录,把 F1-F3 里的查询换成一个真实的审计问题,剩下每一行——CDF 的硬性要求、chunk_text/retrieval_text 的拆分、create_delta_sync_index 调用、三个 query_type 取值——原样可用,因为这里没有任何一步依赖 Lakebase。这也是整个课程里第一次,"对同一个真实问题测试三种检索模式"不再只是讲义上的一个论点,而是一个五分钟就能跑的实验:三种都跑一遍,读三组结果,判断 FM Insight 的索引对 KSD 类查询应该默认用哪种模式(点名具体代码和科目编号的问题,适合混合或纯关键词;开放式的"为什么对不上账"类问题,适合向量或混合)。
File 8 Lecture — Appendix: The Search Primitives Underneath Lakebase Search
Big picture first: every file so far has used Lakebase Search's two extensions (lakebase_vector, lakebase_text) as a black box — File 1 named "IVF+RaBitQ quantization" in passing, Lab 3 ran <=> and <@> without explaining them. File 8 is the one file in Folder 1 that opens that box. It covers exactly four things, and nothing else: which distance metric to pick, how IVF (the ANN algorithm) actually partitions vectors, which three GUCs tune the recall/speed trade-off at query time, and how BM25 scores keyword relevance. This is Backend 2 from Section 4.1's split, taken apart to the component level — read it as the reference page you come back to whenever a Lakebase search query behaves strangely, not as a new concept to learn end-to-end in one pass.
先讲大图景:前面每一份文件都把 Lakebase Search 的两个扩展(lakebase_vector、lakebase_text)当黑箱使用——File 1 只是提了一句"IVF+RaBitQ 量化",Lab 3 直接用了 <=> 和 <@> 却没有解释。File 8 是 Folder 1 里唯一打开这个黑箱的文件。它只讲四件事,别的都不讲:选哪种距离度量、IVF(近似最近邻算法)到底怎么给向量分区、三个调"召回率 vs 速度"的 GUC 参数、以及 BM25 怎么给关键词相关性打分。这正是 Section 4.1 划分出的"后端二",被拆到了零件级别——把它当成一份以后 Lakebase 检索查询表现异常时会回来查的参考页,而不是要一次性从头学到尾的新概念。
A. Distance metrics: three operator classes, one choice to make per index
When you build a lakebase_ann index, you pick an operator class — this is the one decision that has to match how your embedding model was actually trained, not a style preference. Cosine (<=>, vector_cosine_ops) measures the angle between two vectors, ignoring their length — the default for almost all text embedding models, including every databricks-*-embedding model used across this notebook. L2/Euclidean (<->, vector_l2_ops) measures straight-line distance and cares about magnitude — use it only when absolute spatial distance is meaningful and your vectors are deliberately not normalized. Inner product (<#>, vector_ip_ops) is a faster shortcut that gives the identical ranking as cosine, but only when every vector is already normalized to unit length — otherwise it silently gives wrong rankings, which is why it is correctly the least-used of the three.
建 lakebase_ann 索引时要选一个操作类(operator class)——这是唯一一个必须和你的向量模型实际训练方式匹配的决定,不是风格偏好。Cosine(余弦)(<=>,vector_cosine_ops)衡量两个向量之间的夹角,不管长度——几乎所有文本向量模型的默认选择,包括本笔记里用到的每一个 databricks-*-embedding 模型。L2/欧几里得(<->,vector_l2_ops)衡量直线距离,关心长度——只有当绝对空间距离本身有意义、且向量故意不做归一化时才用它。内积(Inner product)(<#>,vector_ip_ops)是一条更快的捷径,排序结果和 cosine 完全一致——但前提是每个向量都已经归一化为单位长度,否则会悄悄给出错误的排序,这正是三者中它最少被用到的原因。
B. IVF: how lakebase_ann actually partitions the vector space
Exact nearest-neighbor search compares a query against every row — correct, but too slow once a table has more than a few thousand vectors. lakebase_ann uses IVF (Inverted File): at build time, it clusters all vectors into partitions ("lists") around a set of centroids. At query time, the query vector is compared only against the centroids, and only the nearest few partitions actually get scanned — everything else is skipped entirely, never touched. This is the literal mechanism behind the "approximate" in "approximate nearest-neighbor": a vector sitting just outside a scanned partition's boundary can be missed even if it would have ranked well, which is the recall you're trading away for speed.
精确最近邻搜索要拿查询向量和每一行逐个比较——结果准确,但表一旦超过几千条向量就会慢得不实用。lakebase_ann 用的是 IVF(倒排文件):建索引时,先把所有向量围绕一组中心点(centroid)聚类成若干个分区("list")。查询时,查询向量只和这些中心点比较,只有最近的几个分区真正被扫描——其余分区被完全跳过,连碰都不碰。这正是"近似最近邻"里"近似"二字的字面机制:一个刚好落在被扫描分区边界之外的向量,即便本来排名靠前,也可能被漏掉——这就是用速度换来的那部分召回率损失。
C. Three GUCs that move the recall/speed trade-off at query time
| GUC | Default | What it controls | Direction |
|---|---|---|---|
lakebase_ann.probes | 'auto' | How many IVF partitions get scanned per query — directly the "2 of 5" in the diagram above | ↑ probes → ↑ recall, ↓ speed |
lakebase_ann.epsilon | 'auto' | How many candidates from the scanned partitions get a full-precision rerank pass, instead of trusting the approximate distance | ↑ epsilon → ↑ recall, ↓ speed |
lakebase_ann.prefilter | off | Whether non-vector WHERE filters run before reranking — cheap on a filter that eliminates most rows, wasteful otherwise | context-dependent, not a recall/speed dial |
These three are session-level settings (GUCs — Grand Unified Configuration, Postgres' term for a tunable runtime parameter), not table or index properties — meaning the same index can be queried once at low probes for a cheap, fast, lower-recall lookup and again at high probes for an expensive, slow, high-recall one, without rebuilding anything. 'auto' is a reasonable default for most workloads; override it specifically when you have a concrete reason — higher recall for an evaluation benchmark you're scoring against a known-correct answer set, or lower latency for a production serving path where "good enough, fast" beats "best, slow."
这三个都是会话级设置(GUC——Postgres 里"可调运行时参数"的说法,全称 Grand Unified Configuration),不是表或索引的属性——也就是说,同一个索引可以这次用低 probes 查一次,便宜、快、召回率低一些;下次用高 probes 再查一次,贵、慢、召回率高一些,中间什么都不用重建。'auto' 对大多数场景是合理的默认值;只在有具体理由时才去覆盖它——比如对着一份已知正确答案的评测基准跑测试,想要更高的召回率;或者在生产环境的服务路径上,"够好、够快"比"最好、但慢"更重要。
D. BM25: three factors, and why it beats Postgres' built-in ts_rank
lakebase_bm25 ranks keyword matches using three factors combined: term frequency (how often the term appears in this document — more occurrences, more relevant), inverse document frequency (a term that is rare across the whole corpus counts for more than one that appears everywhere — "reprogramming" matters more than "the"), and length normalization (a long document doesn't win purely by being long enough to mention the term more times by chance). Postgres' built-in ts_rank has no equivalent to the second factor — it scores each document in isolation, with no sense of what's rare or common across the whole collection — which is why BM25 scores stay stable and meaningful as the corpus grows and ts_rank's don't.
lakebase_bm25 综合三个因素给关键词匹配打分:词频(这个词在这篇文档里出现了多少次——出现越多,相关性越高)、逆文档频率(在整个语料库里越少见的词,权重越高——"reprogramming"比"the"更有信息量)、以及长度归一化(一篇长文档不能单靠篇幅长、碰巧多提了几次这个词就赢)。Postgres 自带的 ts_rank 没有第二个因素的对应物——它只孤立地给每篇文档打分,不知道整个语料库里哪些词常见、哪些稀有——这正是为什么语料库越大,BM25 的分数越稳定、越有意义,而 ts_rank 做不到这一点。
This file is also where Section 4.1's two-backend split gets its deepest technical grounding. Lakebase Search's ANN is IVF — cluster into partitions, scan a few, tune with probes/epsilon/prefilter. AI Search's ANN (File 6) is HNSW — a navigable graph structure, walked greedily from an entry point toward the query, no partitions and no exposed GUCs in this course's material because it's a fully managed service. Different algorithm, same contract: approximate, not exact, nearest-neighbor search, trading a small amount of recall for large speed gains at scale. The practical consequence: Lakebase Search gives you dials because you own the Postgres instance; AI Search gives you a service-level guarantee instead, because Databricks owns the tuning.
这份文件也是 Section 4.1 "为什么有这么多名字"那个两后端划分,在算法层面最深的落脚点。Lakebase Search 的 ANN 是 IVF——聚类分区、扫描少数几个、靠 probes/epsilon/prefilter 调优。AI Search(File 6)的 ANN 是 HNSW——一种可导航的图结构,从一个入口点贪心地往查询方向走,没有分区,这门课的材料里也没给出任何可调的 GUC,因为它是完全托管的服务。算法不同,契约相同:都是近似、而非精确的最近邻搜索,用一点召回率换来规模化场景下的大幅提速。实际的结果是:Lakebase Search 给你旋钮,因为你自己掌握着那个 Postgres 实例;AI Search 给你的是服务级别的保证,而不是旋钮,因为调优的事由 Databricks 负责。
None of these three GUCs are reachable in Advana today, for the same reason Content Search isn't: there's no Lakebase Postgres to run SET lakebase_ann.probes = ... against. So this file's direct, hands-on value to the Phase 2 build in Section 7 is limited — the production path there is AI Search, tuned (if at all) through whatever parameters that managed service actually exposes, not these. Its real value is conceptual and durable: "recall vs. speed is a dial, not a fixed property of a search system" is a fact about ANN search in general, not about Lakebase specifically — worth carrying into any future conversation about AI Search's own tuning surface, a different vendor's pgvector deployment, or any other ANN system FM Insight ends up depending on. If Lakebase Postgres ever does land in Advana (Section 7.1's open question), this file is the one to re-read first.
这三个 GUC 眼下在 Advana 里都用不上,原因和 Content Search 用不上一样:没有 Lakebase Postgres 可以让你去跑 SET lakebase_ann.probes = ...。所以这份文件对 Section 7 的 Phase 2 搭建的直接、动手层面的价值有限——那边的生产路径是 AI Search,真要调优也是调那个托管服务实际暴露出来的参数,不是这几个。它真正的价值是概念性的、经久不变的:"召回率 vs 速度是一个旋钮,不是搜索系统的固定属性"——这是关于 ANN 检索本身的事实,不只是关于 Lakebase 的事实,值得带进以后任何关于 AI Search 自身调优接口、别家厂商的 pgvector 部署、或者 FM Insight 最终依赖的任何其他 ANN 系统的讨论里。如果 Lakebase Postgres 以后真的落地 Advana(Section 7.1 留的那个未解问题),这份文件就是该先回来重读的那一篇。
Folder 1 complete — a quick-navigation map for production decisions
Eight files, two backends, and a long list of names. Before moving on to Folder 2, this is the one-page answer to "I need to build X for FM Insight — where in Databricks do I actually go, and what should I pick?" Everything below is a compression of Sections 3-4 and Files 1-8; nothing new is introduced here.
八份文件,两个后端,一长串名字。在进入 Folder 2 之前,这是对"我要给 FM Insight 建 X 功能——在 Databricks 里到底该去哪、该选哪个"这个问题的一页纸答案。下面的内容都是对第 3-4 节和 File 1-8 的压缩,不引入任何新概念。
| You need to… | Use | Where in Databricks | File | Advana verdict |
|---|---|---|---|---|
| Stand up a Q&A agent in minutes, zero pipeline code | Genie Agent + Content Search | SQL → Genie | 2 | Blocked — needs Lakebase |
| Bring your own already-built AI Search index to an agent | Knowledge Assistant | AI/ML → Agents | 1 | Works |
| Full control: own chunking, embedding model, index type | Custom Agent | AI/ML → Agents | 1, 4-7 | This is the path — near-only option |
| Parse a raw PDF (incl. scans/OCR) into structured text | ai_parse_document | SQL AI Function | 4, 5 | Works |
| Label content by type / route by category | ai_classify | SQL AI Function | 4, 5 | Works |
| Pull named fields out of free text | ai_extract | SQL AI Function | 4, 5 | Works |
| Chunk for retrieval with embed/retrieve split | ai_prep_search | SQL AI Function | 4, 7 | Works |
| Production-scale semantic + keyword + hybrid search over documents | AI Search (Delta Sync index) | Compute → AI Search | 6, 7 | Works — the Phase 2 target |
| Search that must JOIN with live operational/transactional tables | Lakebase Search (lakebase_vector + lakebase_text) | Compute → Lakebase | 1, 3, 8 | Blocked — no Lakebase |
| Tune an ANN index's recall/speed trade-off by hand | lakebase_ann.probes/epsilon/prefilter GUCs | SQL, inside Lakebase | 8 | Blocked — no Lakebase; concept still applies elsewhere |
| Govern who can see which table, volume, model, or agent | Unity Catalog grants | Catalog | 3.2 | In the implementation |
| Govern which model an agent is allowed to call, and audit it | Unity Gateway (or legacy AI Gateway) | AI/ML | 3.1 | Unconfirmed — ask |
| Deploy the whole thing as a versioned, repeatable project | DAB (databricks.yml) | CLI / repo | 3.5 | Unconfirmed vs. Dragon pipeline — ask |
| Track whether the agent actually got better after a change | MLflow (Experiments/Models/Serving, eval judges) | AI/ML | 3.1, Folder 3 | Works once the model is served |
这张表是整个 Folder 1 的速查表:想做什么 → 用什么 → 在 Databricks 界面哪里找 → 哪份文件讲过 → 在 Advana 今天能不能用。扫一眼"Advana 判定"这一列就能看出整体格局:凡是依赖 Lakebase 的(Content Search、Lakebase Search、这三个 GUC),现在都被挡住;凡是建在 Unity Catalog 之上的(AI Search、四个 AI 函数、自定义智能体),现在都能用;治理和部署这两块(Unity Gateway、Dragon pipeline 和 DAB 的关系)还没确认,是 Section 7.1 留的真正的开工前问题。
Build on Unity Catalog, not Lakebase: four SQL AI Functions turn any PDF into governed, chunked, structured Delta rows; AI Search turns those rows into a production retrieval index with vector, keyword, and hybrid modes; a Custom Agent wraps that index in a governed, traceable, evaluable service — and every step of that chain runs in Advana today, which is exactly why Section 7's Phase 2 plan was pointed the right way before this file ever confirmed it.
建在 Unity Catalog 之上,不建在 Lakebase 之上:四个 SQL AI 函数把任何 PDF 变成受治理、已切分、结构化的 Delta 行;AI Search 把这些行变成一个生产级的检索索引,支持向量、关键词、混合三种模式;自定义智能体把这个索引包装成一个受治理、可追踪、可评估的服务——这条链上的每一步,今天在 Advana 都能跑通,这正是 Section 7 的 Phase 2 方案在这份文件确认之前,方向就已经是对的的原因。
06 Enterprise at Scale
Big picture first: everything in Sections 1-5 is single-agent craft — build one retrieval agent well. This ebook is about the problem one level up: what happens when ten teams each build an agent like that. Its claim is that quality stops being the bottleneck and operating infrastructure becomes the bottleneck — the exact FM Insight problem, stated by a vendor with no knowledge FM Insight exists.
先讲大图景:第 1-5 节讲的都是单个智能体的手艺——把一个检索智能体做好。这份电子书讲的是再上一层的问题:当十个团队都各自做出这样一个智能体之后会发生什么。它的论点是:到了那个阶段,质量不再是瓶颈,运维基础设施才是瓶颈——这正是 FM Insight 面对的问题,而提出这个论点的厂商根本不知道 FM Insight 的存在。
6.1 The four failure modes, and Agent Bricks' Choice / Context / Control answer
| Failure mode (as teams scale past one agent) | Agent Bricks' answer |
|---|---|
| The last-mile problem: the agent works, but runtime, isolation, observability, and cost tracking don't exist and get hand-built per project | Choice — a shared runtime layer handles deployment/isolation, governed model endpoints handle routing/fallback/budgets |
| Every team rebuilds identity, data access, orchestration, and evaluation from scratch in its own harness | Same — build on existing tools (coding assistants, frameworks, MCP servers) without rebuilding the stack underneath them |
| Agents fail not from weak models but from fragmented business context — avg. 897 applications per enterprise (Gartner), each with its own semantics | Context — a shared ontology and ground agents in the same governed data/documents every time, instead of a bespoke pipeline per agent |
| Governance stays per-system (model logs here, data access there, cost somewhere else) — no one can answer "what did this agent do and was it allowed" | Control — Unity Gateway as one control plane for model/tool usage, guardrails, cost attribution, and budgets |
表格把"扩展到多个智能体时会出现的失败模式"和 Agent Bricks 的"选择 / 上下文 / 控制"三个答案一一对应。关键数字:Gartner 统计企业平均部署 897 个应用,各自的数据定义和语义互不打通;Gartner 还预测到 2027 年,40% 的企业会因为治理漏洞在生产环境出事之后才被发现,而被迫降级或下线自主 AI 智能体——这两个数字直接支撑了"治理必须是控制平面、而不是事后补救"这个论点。
This maps onto the enforcement ladder almost exactly: "the last-mile problem" is what happens when a control (deployment, guardrails, cost limits) is left to per-team discretion instead of being removed from individual choice entirely. The ebook's prescription — a shared runtime and a single governance control plane — is the enforcement ladder's top rung (remove the capability from ad hoc implementation) applied at fleet scale instead of single-agent scale.
这几乎和强制执行阶梯一一对应:"last-mile problem" 说的正是:当一项控制(部署、护栏、成本上限)被留给每个团队自行决定,而不是从个人选择中彻底移除时会发生什么。电子书给出的方案——共享运行时加单一治理控制平面——正是强制执行阶梯最顶层的做法(把能力从临时实现中移除),只不过这次是用在智能体舰队规模上,而不是单个智能体规模上。
6.2 Meta-harness: the layer above File 2's "Agent" from Section 3.1
New vocabulary, precisely defined, that refines Section 3.1's AI-layer table. An agent is a process for one task with a set of tools. A harness is the runtime that wires those pieces together (which models get called, how tools are invoked, how state and traces are captured) — Claude Code and Cursor are named explicitly as examples. A meta-harness sits above individual harnesses: one place to register different harnesses, compose agents that use more than one, and apply consistent policy and observability across all of them, without standardizing on a single framework. Omnigent is Databricks' open-source meta-harness implementing this.
新词汇,但定义精确,正好细化了 3.1 节 AI 层那张表。智能体(agent)是针对一项任务、配一套工具的进程。执行框架(harness)是把这些部件接在一起的运行时(调用哪些模型、怎么调用工具、怎么捕获状态和追踪记录)——文中明确举了 Claude Code 和 Cursor 作为例子。元执行框架(meta-harness)坐在各个具体执行框架之上:一个统一的地方来注册不同的执行框架、组合用到多个执行框架的智能体、并对所有这些统一施加策略和可观测性,而不需要统一到单一框架上。Omnigent 就是 Databricks 实现这一思路的开源元执行框架。
Section 3.1's "Agents" (AI/ML nav) is a harness-level tool — it builds one custom agent. A meta-harness is one level above that: the thing that lets you run a Genie Agent, a custom Agent, and a third-party framework's agent side by side under one set of policies. This is the missing piece between "I built an agent" and "my organization runs agents as a system," which is the ebook's central distinction.
3.1 节里 AI/ML 导航下的"Agents",是执行框架层面的工具——它负责搭建一个自定义智能体。元执行框架比它高一层:让你能把一个 Genie Agent、一个自定义 Agent、以及第三方框架搭的智能体,放在同一套策略下并排运行的那个东西。这正是"我搭了一个智能体"和"我的组织把智能体当作一套系统来运行"之间缺的那一块,也是这份电子书的核心区分。
6.3 Governed context, and the Hawaiian Electric parallel
Two new terms tie directly to Section 3.1 and 3.2: Genie Ontology (the shared business-semantics layer agents draw on, instead of each agent hard-coding its own) and Document Intelligence (helping an agent parse and navigate complex documents — adjacent to, possibly the production-grade version of, the chunking work in File 4). Internal Databricks benchmarks cited: an ontology-grounded agent answered 84.5% of questions correctly on first attempt vs. 52.4% for the strongest general-purpose coding agent and 25% for the weakest, at roughly 2x lower latency. Agent Bricks overall claims 70% higher accuracy than standard RAG and a 30% improvement on multi-step workflows when context is embedded this way.
两个新术语,直接挂到 3.1 和 3.2 节上:Genie Ontology(智能体共用的业务语义层,而不是每个智能体各自硬编码一套)和 Document Intelligence(帮助智能体解析和在复杂文档中导航——和 File 4 要讲的切分工作相邻,也可能是它的生产级版本)。文中引用的 Databricks 内部基准测试:接入本体(ontology)的智能体首次回答正确率 84.5%,对比最强的通用代码智能体 52.4%、最弱的只有 25%,延迟还低了约 2 倍。Agent Bricks 整体宣称:这样嵌入上下文后,准确率比标准 RAG 高 70%,多步骤工作流的表现提升 30%。
Case Study 02/03 in this ebook is Hawaiian Electric: a regulatory assistant searching 60,000+ regulatory filings, where "Agent Bricks provides the agent layer, Unity Catalog governs which documents and tools the agent can access, and Genie Ontology plus Document Intelligence helps the agent understand and navigate complex regulatory text." Swap "regulatory filings" for "KSD packages and reconciliation evidence" and this is close to a reference architecture for the exact tool sketched earlier in this notebook (File 2's Advana/FM callout), not just a comparable use case. Worth pulling the full case study before any FM Insight design review.
这份电子书的第 2/3 个案例研究就是夏威夷电力公司:一个检索超过 6 万份监管文件的监管助手,"Agent Bricks 提供智能体层,Unity Catalog 治理智能体能访问哪些文档和工具,Genie Ontology 加 Document Intelligence 帮助智能体理解和在复杂监管文本中导航"。把"监管文件"换成"KSD 文档包和对账证据",这几乎就是本笔记前面(File 2 的 Advana/FM 小结)勾勒出的那个工具的参考架构,而不只是一个"类似"的案例。在做任何 FM Insight 设计评审之前,值得把这个完整案例研究找来读一遍。
Three evaluation criteria the ebook gives for judging any agent platform, FM Insight's own build included: does it absorb the operational heavy lift (deployment, isolation, tracing, cost controls) instead of leaving teams to hand-build it per project; does it treat context as a platform capability instead of a per-agent pipeline; and is governance genuinely unified, answerable from one place, instead of stitched together from separate logs and policy engines after the fact.
电子书给出了三条评估任何智能体平台的标准,FM Insight 自己的建设也适用:是否真正吸收了运维上的重活(部署、隔离、追踪、成本控制),而不是让每个团队自己动手搭;是否把上下文当作平台能力,而不是每个智能体各自的流水线;治理是否真正统一、能从一个地方得到答案,而不是事后从分散的日志和策略引擎里拼凑出来。
07 Advana/FM Production Path
Big picture first: everything above was learned against the public Databricks course environment. Advana runs DoD IL5, on S3, with Unity Catalog and serverless compute "in the implementation," no Lakebase Postgres, Databricks Apps available, and deployment through an internal Dragon pipeline. The single biggest consequence: Lakebase doesn't exist there, so File 2's Content Search (which provisions a Lakebase project under the hood) almost certainly doesn't work either. The custom-agent path isn't the more-controlled option anymore — it's close to the only option.
先讲大图景:前面所有内容都是在公开的 Databricks 课程环境里学的。Advana 跑在 DoD IL5 上,底层存储是 S3,Unity Catalog 和 serverless 计算都"在实施中",没有 Lakebase Postgres,Databricks Apps 可用,部署走内部的 Dragon pipeline。最大的一个后果是:Lakebase 在那边不存在,所以 File 2 的 Content Search(背后会自动配置一个 Lakebase 项目)大概率也用不了。自定义智能体路径不再是"更可控的选择",而是接近"唯一的选择"。
7.1 Confirmed environment facts and their implications
| Fact | Implication |
|---|---|
| IL5, S3-backed storage | High-compliance, non-SaaS tier — new Databricks features lag the public course environment by months to a year+ while they go through DoD accreditation |
| Unity Catalog + serverless "in the implementation" | Design catalog/schema structure now; don't plan to enforce fine-grained governance before the rollout completes |
| No Lakebase Postgres | Files 1 and 3's Lakebase SQL isn't directly runnable here — use Vector Search instead (7.2) |
| Databricks Apps available | A lightweight agent front-end is buildable now, independent of the UC/serverless rollout |
| Deployment via "Dragon pipeline" | Relationship to DAB (databricks.yml) unconfirmed — likely adds STIG/ATO-boundary checks DAB alone doesn't do. Ask DevSecOps. |
| Only 3 waffle-icon options (not 4) | Lakebase Postgres confirmed absent. Whether Genie One is also missing is unconfirmed — check, since it affects whether Section 6.2's fleet-level routing is near-term feasible |
| Unity Gateway likely absent | IL5 lag makes it likely Advana is still on the older per-endpoint "AI Gateway," or has neither yet. Confirm before designing governance around Section 6.1's Unity Gateway specifically |
7.2 Phased build plan, corrected for Advana's actual constraints
| Phase | What | Where / How |
|---|---|---|
| 0. Assess | Confirm UC/serverless/Vector Search/Unity Gateway availability, data classification of KSD/reconciliation data, ATO coverage for AI/ML workloads | Workspace/platform admin, ISSO, security/compliance lead — before writing anything |
| 1. Data foundation | Land KSD packages and reconciliation evidence as governed Delta tables / UC volumes | UC catalog/schema (request one if you don't own it) + Lakeflow ingestion from GFEBS/Navy ERP/SAP/Oracle feeders |
| 2. Retrieval build | Parse (ai_parse_document), classify/extract metadata, chunk into chunk_to_embed/chunk_to_retrieve (ai_prep_search, see File 4) — all SQL, no Lakebase needed | Create the index with endpoint_name, source_table_name, index_name, pipeline_type, primary_key, embedding_source_column, embedding_model_endpoint_name, columns_to_sync; query via VectorSearchRetrieverTool |
| 3. Governance | UC grants scoped to need-to-know; register the agent as a governed UC object; route model calls through whatever gateway is actually available | Unity Catalog permissions; AI Gateway (legacy) or Unity Gateway, whichever Advana has |
| 4. Evaluate & deploy | Build an eval set from real KSD questions with known answers; score before/after any chunking change; deploy reproducibly | MLflow (Experiments → Models → Serving); packaged via DAB if Dragon pipeline supports it, otherwise however Dragon's existing deployment convention works |
| 5. Fleet layer | Only once more than one team is building agents: shared meta-harness pattern, USSGL-grounded shared semantics layer | Platform-level decision — bring in whoever owns FM Insight's overall architecture |
阶段 0-1 现在就能在自己的 catalog/schema 里动手,不用等任何人;阶段 2 把 Lakebase 换成 Vector Search,概念(切分、向量化、索引、排序)不变,只是实现机制不同;阶段 3-4 需要先确认 Advana 实际有哪个治理网关、Dragon pipeline 和 DAB 的关系,再动手设计;阶段 5 只有在不止一个团队做类似智能体时才重要。
Which three products actually show under the waffle icon (confirms/denies Genie One availability). Whether Dragon pipeline already wraps Databricks Asset Bundles or is a separate deployment path. Which gateway (AI Gateway legacy, Unity Gateway, or neither) is actually available for model governance. These three answers, not more course material, are what turn this section from a plan into a build order.
waffle 图标下实际是哪三个产品(确认 Genie One 是否可用);Dragon pipeline 是否已经包装了 Databricks Asset Bundles,还是一条独立的部署路径;模型治理实际能用哪个网关(旧版 AI Gateway、新版 Unity Gateway,还是都没有)。把这三个问题问清楚,而不是再学更多课程内容,才能把这一节从"方案"变成"开工指令"。
Resolved by File 6: whether Vector Search (now AI Search) is live independent of the UC rollout — yes, structurally. AI Search is built on UC tables/volumes, not Lakebase, so its availability tracks Unity Catalog's rollout, confirmed "in the implementation," not Lakebase's, confirmed absent.
已被 File 6 解决:Vector Search(现称 AI Search)是否独立于 UC 上线进度——结构上看,是的。AI Search 建在 UC 的表/volume 之上,不建在 Lakebase 之上,所以它的可用性跟着已确认"正在实施中"的 Unity Catalog 走,不跟着已确认不存在的 Lakebase 走。