Files
myWiki/concepts/look-ahead-buffer-controller.md

57 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "Look-Ahead Buffer Controller"
created: 2026-06-20
updated: 2026-06-20
type: concept
tags: ["buffer", "streaming", "timing", "inference", "real-time"]
sources: ["https://arxiv.org/abs/2606.17800"]
---
# Look-Ahead Buffer Controller (先行缓冲控制)
**Look-Ahead Buffer Controller** 是 [[maineCoon|MaineCoon]] [[agentic-streaming-inference|流式推理框架]] 的第三个控制器:管理**生成速度与播放速度之间的时间差**。
## 问题:生成≠播放同步
MaineCoon 在单 H100 上以 ~32 FPS 生成,但视频以 25 FPS 播放。两者不同步导致**先行缓冲 (look-ahead buffer)** 的积累:
```
← Past | Future →
Generation: [已生成.........正在生成..........未生成]
↑ generation head
Playback: [已播放.....正在播放.....缓冲中........]
↑ playback head
← lead →
```
## Pace Gate节奏门
Buffer Controller 通过 pace gate 将 lead 保持在一个有界窗口内:
- **上限**lead 过大时减速生成,防止过度承诺未来内容
- **下限**lead 过小时加速生成sprint避免播放卡顿
- **暂停处理**:观众暂停时 hold 生成
## 为什么 Lead 是设计空间
先行缓冲不仅是技术副作用,更是交互式流生成的设计资源:
| Lead 大小 | 优势 | 风险 |
|----------|------|------|
| 大 lead | 容错空间大,可吸收计算抖动 | 观众输入滞后,已生成内容无法修改 |
| 小 lead | 即时响应观众交互 | 一次性能抖动就可能导致播放卡顿 |
理想的 lead 大小是**刚好够缓冲计算抖动,又不至于让观众互动延迟过高**。
## 与分离架构的配合
因为 [[agentic-streaming-inference|Agentic 框架]] 的分离设计:
- **Planner/Observer** 在 generation head 运行(有 lead 保护)
- **Viewer interaction** 通过 fast lane 注入未来 beat不中断当前 chunk
- 计算抖动和 agentic 成本由 lead 吸收,**播放端零延迟**
## 参考
- [[maineCoon|MaineCoon 论文]] Section 4.3
- [[agentic-streaming-inference|Agentic Streaming Inference]]
- [[streaming-generation|Streaming Generation]]