流式结构推断与Flash-SemiCRF
Streaming Structured Inference with Flash-SemiCRF
AI总结:
本文提出Flash-SemiCRF,通过流式前向后向传递和前缀和数组优化,实现对长序列和大标签集的精确半CRF推断,减少内存消耗并提升效率。
摘要:
半马尔可夫条件随机场(semi-CRFs)为序列的片段分配标签,而非单个位置,从而实现精确的片段级特征推断和边界处的原理性不确定性估计。然而,现有实现必须生成一个大型边势张量,其大小随序列长度、最大片段长度和标签数量增长,这在语音规模的状态空间中变得不可行,在基因组规模上则难以处理,因为序列可能超过100,000个位置。这一内存瓶颈限制了对长序列和大标签集的精确片段级推断的采用。我们发现核心的低效率在于生成边势,这些边势可以改用紧凑的前缀和数组即时评估,并进行了多项改进。首先,用前缀和查找替换存储的边张量,将内存占用减少比例与片段长度和标签数量的乘积成比例。其次,流式前向后向传递结合检查点边界归一化,使工作内存在序列长度下保持亚线性,同时保持精确梯度。第三,零中心累积分数控制数值漂移,并在标签不平衡下诱导自适应持续时间先验。我们将这些想法整合到Flash-SemiCRF中,这是一个融合Triton内核的内核,使在之前无法处理的问题规模上实现精确的半CRF推断。可在https://github.com/biobenkj/flash-semicrf获取。
英文摘要:
Semi-Markov Conditional Random Fields (semi-CRFs) assign labels to segments of a sequence rather than to individual positions, enabling exact inference over segment-level features and principled uncertainty estimates at their boundaries. However, existing implementations must materialize a large edge potential tensor whose size grows with sequence length, maximum segment length, and label count, becoming prohibitive for speech-scale state spaces and intractable at genomic scales where sequences can exceed 100,000 positions. This memory bottleneck has limited the adoption of exact segment-level inference for long sequences and large label sets. We identify that the core inefficiency is materializing edge potentials that can instead be evaluated on-the-fly from a compact prefix-sum array, and make several improvements. First, replacing the stored edge tensor with prefix-sum lookup reduces the memory footprint by a factor proportional to the product of segment length and label count. Second, a streaming forward-backward pass with checkpoint-boundary normalization keeps working memory sublinear in sequence length while preserving exact gradients. Third, zero-centered cumulative scores control numerical drift and induce an adaptive duration prior under label imbalance. We integrate these ideas into Flash-SemiCRF, a fused Triton kernel that enables exact semi-CRF inference on previously intractable problem sizes. Available at https://github.com/biobenkj/flash-semicrf.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。