逐日AI

面试题库

共 328 题,当前筛选 1 题。

14 天 RAG:从检索到可信回答

D4 切块策略:固定、递归、按结构、父子与语义五种切法,以及用评估而不是直觉来选

  • 父子切块的收益是什么?它在什么情况下反而会拖慢系统?What does parent-child chunking buy you, and when does it slow the system down instead?
    国内高频海外高频进阶#chunking#parent-child

    分析过程 · 先想清楚再作答

    1. 这题考的是你有没有意识到「检索单位」和「上下文单位」可以是两个东西。答不出这句话,后面说什么都是复述。
    2. 收益一句话说清:小块进索引,信噪比高、容易被找到;命中之后顺着父指针把整节回填给模型,语境完整。精度和完整度这次不用二选一。
    3. 拖慢的场景要从代价一条条推。第一条是上下文预算:每命中一个新子块可能拖进来一整个父节,同样的 token 预算装不下几条,检索结果的多样性反而变差。
    4. 第二条是写入侧:父子两套都要维护,文档更新时两边都要重算,块 id 的稳定性也更难保证,增量同步的复杂度明显上升。
    5. 第三条是收益消失的条件:当文档本身的小节就不长时,父块和子块差不多大,你付了两套索引的钱,什么也没多买到。所以父子切块适合长节、深层级的文档,不适合结构本来就细碎的知识库。
    6. 可预期的追问是「那和直接把块切大有什么区别」。答:切大是把噪声一起放进索引,父子是只把噪声放进上下文、不放进索引——被检索的那一段始终是干净的短文本,这是本质区别。

    How to reason about it · think before answering

    1. This question checks whether you know that the retrieval unit and the context unit can be two different things. Without that sentence, everything else is recitation.
    2. State the benefit compactly: small chunks go into the index so they are easy to match, and once a child is hit you follow the parent pointer and hand the model the whole section. You stop trading precision against completeness.
    3. Derive the slowdown from the costs. First, the context budget: every new child may drag in an entire parent, so an equal budget holds fewer distinct pieces and result diversity drops.
    4. Second, the write path: two levels to maintain, both recomputed on every document update, and chunk ids become harder to keep stable, which makes incremental sync noticeably more complex.
    5. Third, the condition under which the benefit disappears: when sections are already short, the parent and the child are nearly the same text, so you paid for two indexes and bought nothing. Parent-child suits long sections and deep hierarchies, not already fine-grained knowledge bases.
    6. Expect the follow-up: how is this different from simply using bigger chunks. Bigger chunks put the noise into the index; parent-child puts the noise only into the context. What gets matched stays short and clean.

    答题要点

    • 核心是把检索单位和上下文单位拆开:小块负责被找到,大块负责被读懂。
    • 收益是精度与完整度同时拿到,不用在信噪比和语境之间二选一。
    • 代价一:一次命中可能拖进整个父节,同样的上下文预算装得下的条数变少,结果多样性下降。
    • 代价二:父子两套索引都要维护与重算,文档更新时增量同步的复杂度明显上升。
    • 失效场景:文档小节本来就短时父子块差不多大,多付一套成本却没多买到东西。

    Key points

    • The core idea is decoupling the retrieval unit from the context unit: small chunks get found, large chunks get understood.
    • The payoff is precision and completeness at the same time instead of trading one for the other.
    • Cost one: a single hit can drag in a whole parent, so an equal context budget holds fewer distinct results and diversity suffers.
    • Cost two: two index levels to maintain and recompute, which makes incremental sync on document updates considerably harder.
    • It stops paying off when sections are already short, because parent and child are nearly identical and you bought nothing for the extra cost.