首页 > AI前沿 > When Does Depth Matter For In-Context Learning? Adaptive Inference in Deep Transformers

When Does Depth Matter For In-Context Learning? Adaptive Inference in Deep Transformers

arXiv机器学习 2026-06-15 21:30 7 阅读 查看原文
用户需要我作为一个专业的新闻排版工程师,将一段纯文本新闻正文排版成语义化的HTML片段。 规则如下: 1. 只输出HTML片段本身,不要Markdown围栏、不要解释。 2. 每个自然段落用`

`包裹,长文用`

`/`

`划分小节。 3. 列表内容用`
  • `,引用用`
    `,代码用`
    `,重要句子可用``。
    4. 保留原文所有信息,不得增删改内容。
    5. 不要输出``/``/``等文档级标签。
    
    提供的正文:
    Transformers perform computations through many successive attention and feedforward blocks, allowing them to learn complex correlations between a large collection of coupled variables. When does stacking successive attention-feedforward computations over many layers provide a computational advantage over a single transformer block? We address this question by examining in-context learning in generalized linear attention transformers. We first introduce a general theory of distributed inference in such transformers, subject to constraints on communication and depth. We show that such systems can exploit internal representations (`function vectors') to infer a latent context variable at increasingly finer scales over its layers. For an in-context linear regression task, the theory predicts that while one-layer transformers without feedforward blocks are optimal for Gaussian priors over the context variable, multi-layer transformers are superior for non-Gaussian, tree-like priors. Trained linear attention transformers reproduce quantitative predictions from the theory. Using causal key-patching experiments, we verify that function vectors in intermediate layers mediate adaptive routing of information. Our results suggest that depth and feedforward blocks enable transformers to implement adaptive inference, and this is advantageous when the distribution over latent variables has hierarchical structure.
    
    分析正文:
    这是一段学术新闻/摘要,只有一个自然段落。没有列表、引用、代码。
    可以加一个小标题,比如 `

    Transformer 深度与前馈模块的计算优势

    `?但是规则说“不得增删改内容”,所以我不能自己加标题,除非原文有。原文没有标题,只有一段正文。 那就直接用 `

    ` 包裹这整个段落。 里面有个代码片段 `function vectors`,可以用 `

    ` 或者 `` 包裹,规则说“代码用`
    `”,但这里只是行内代码,用 `` 更合适,或者严格按规则用 `
    ` 但行内用 `
    ` 不太对。规则说“代码用`
    `”,通常指块级代码,行内可以用 ``。为了安全,用 `function vectors`,或者如果必须用 `
    `,那就在行内用 ``,因为 `
    ` 会换行。这里用 `function vectors` 比较合理,或者按照字面意思,把 `function vectors` 用 `` 包裹。
    重要句子可以用 ``。比如最后一句“Our results suggest that depth and feedforward blocks enable transformers to implement adaptive inference, and this is advantageous when the distribution over latent variables has hierarchical structure.”可以加粗。或者第二句“When does stacking successive attention-feedforward computations over many layers provide a computational advantage over a single transformer block?”作为核心问题加粗。
    
    让我们仔细检查原文,确保不增删改内容。
    原文:
    Transformers perform computations through many successive attention and feedforward blocks, allowing them to learn complex correlations between a large collection of coupled variables. When does stacking successive attention-feedforward computations over many layers provide a computational advantage over a single transformer block? We address this question by examining in-context learning in generalized linear attention transformers. We first introduce a general theory of distributed inference in such transformers, subject to constraints on communication and depth. We show that such systems can exploit internal representations (`function vectors') to infer a latent context variable at increasingly finer scales over its layers. For an in-context linear regression task, the theory predicts that while one-layer transformers without feedforward blocks are optimal for Gaussian priors over the context variable, multi-layer transformers are superior for non-Gaussian, tree-like priors. Trained linear attention transformers reproduce quantitative predictions from the theory. Using causal key-patching experiments, we verify that function vectors in intermediate layers mediate adaptive routing of information. Our results suggest that depth and feedforward blocks enable transformers to implement adaptive inference, and this is advantageous when the distribution over latent variables has hierarchical structure.
    
    注意原文中的 `function vectors` 带有反引号:`function vectors' (注意原文是 `function vectors',少了一个反引号,可能是笔误,但我必须保留原文所有信息,不得增删改内容。原文是 `function vectors' ,我直接保留这个文本,用 `` 包裹,或者把反引号也保留在 code 标签内或外。原文是:`function vectors' 。我把它写成 ``function vectors' 或者 `function vectors'。为了严格不修改,写成 ``function vectors' 或者保留反引号:`function vectors'。最好直接原样输出,用 `` 包裹反引号内的部分,但原文只有一个反引号在前面。
    原文:`function vectors'
    我就原样保留文本,用 `` 包裹:``function vectors' 或者 `function vectors'。其实直接原样输出文本,把 `function vectors 用 `` 包裹,即 ``function vectors'。或者更稳妥,直接原样保留字符:``function vectors'。 等一下,原文是:internal representations (`function vectors') 我可以直接写成:internal representations (`function vectors') 或者 internal representations (function vectors')。为了不改变字符,直接 `function vectors'。 检查重要句子加粗: "When does stacking successive attention-feedforward computations over many layers provide a computational advantage over a single transformer block?" -> 加粗。 "Our results suggest that depth and feedforward blocks enable transformers to implement adaptive inference, and this is advantageous when the distribution over latent variables has hierarchical structure." -> 加粗。 组合HTML: 
                                 

    Transformers perform computations through many successive attention and feedforward blocks, allowing them to learn complex correlations between a large collection of coupled variables. When does stacking successive attention-feedforward computations over many layers provide a computational advantage over a single transformer block? We address this question by examining in-context learning in generalized linear attention transformers. We first introduce a general theory of distributed inference in such transformers, subject to constraints on communication and depth. We show that such systems can exploit internal representations (`function vectors') to infer a latent context variable at increasingly finer scales over its layers. For an in-context linear regression task, the theory predicts that while one-layer transformers without feedforward blocks are optimal for Gaussian priors over the context variable, multi-layer transformers are superior for non-Gaussian, tree-like priors. Trained linear attention transformers reproduce quantitative predictions from the theory. Using causal key-patching experiments, we verify that function vectors in intermediate layers mediate adaptive routing of information. Our results suggest that depth and feedforward blocks enable transformers to implement adaptive inference, and this is advantageous when the distribution over latent variables has hierarchical structure.

    再检查规则: 1. 只输出HTML片段本身,不要Markdown围栏、不要解释; -> 满足。 2. 每个自然段落用

    包裹,长文用

    /

    划分小节; -> 只有一个自然段,用

    包裹,没有小节,不需要h2/h3(不能自己加内容)。 3. 列表内容用

    • ,引用用
      ,代码用
      ,重要句子可用; -> 代码用了(行内代码通常用,块级用
      ,这里如果不使用
      可能会被认为没遵守规则。如果必须用
      ,那行内怎么用?其实规则说“代码用
      ”,我可以把 `function vectors