AiFlow:面向流式LLM应用的Token原生响应式编排

AiFlow: Token-Native Reactive Orchestration with Bounded Backpressure for Streaming LLM Applications

精选理由

AiFlow将LLM输出按token流式编排,实测应用延迟比LangGraph降70.9%-94.7%,队列占用也大幅减小。

AI 摘要

AiFlow是一种Token原生响应式编排模型,将Provider增量归一化为Context<T>事件并通过有向流图传播。每个节点由Node Guardian管理,声明并执行队列上限、并发、排序、溢出策略与重试规则。微基准测试基于DeepSeek轨迹回放(30次)并与LangGraph基线对比,结果显示AiFlow不改变模型TTFT,但将应用TTFPT降低70.9%-94.7%。运行时队列深度也控制在声明边界内,较无界策略减少93.7%-96.5%的MaxQ。实现代码通过FIT Framework仓库公开提供。

原文 · arXiv: DeepSeek

AiFlow: Token-Native Reactive Orchestration with Bounded Backpressure for Streaming LLM Applications

Large language model (LLM) applications increasingly operate as streaming workflows combining retrieval, tool calls, safety filters, and multi-agent coordination. Although contemporary frameworks expose provider deltas, workflow nodes often treat generation as coarse request-response steps, leaving queue management, worker allocation, ordering, and backpressure to ad hoc callback code. This paper presents AiFlow, a token-native reactive orchestration model that normalizes provider deltas into typed Context<T> events propagated through a directed streaming graph. Each node is managed by a Node Guardian that declares and enforces local queue bounds, worker concurrency, ordering, overflow policy, cancellation propagation, and retry discipline. We formalize the bounded-memory property, present the compilation from a compact DSL and JSON graph form, and provide static validation for type safety, state concurrency, and injection compatibility. Controlled microbenchmarks, captured DeepSeek trace replay (30 runs), descriptive online runs, LangGraph baselines, a streaming RAG workload, and an Ollama local-backend check show that AiFlow does not alter provider-side Model TTFT but reduces Application TTFPT by 70.9-94.7\% versus aggregation and keeps runtime-owned queue depth within declared bounds (93.7-96.5\% MaxQ reduction versus unbounded policies). The supplementary artifact contains scripts, raw traces, machine-readable tables, checksums, and an API-free smoke test; the public implementation is available through the FIT Framework repository.