当下一步不是一步:面向并发Go程序的分布感知执行建模
When the Next Step Is Not One Step: Distribution-Aware Execution Modeling for Concurrent Go Programs
AI总结:
针对并发程序非确定性调度导致单标签预测困难的问题,提出分布感知训练方法,通过多次运行聚合经验分布并微调7B模型,在真实Go缺陷预测中准确率达36.2%,并降低期望校准误差。
摘要:
训练模型预测并发程序中的下一步比看起来更难:从相同跟踪前缀出发的同一程序的两次运行可能产生不同的有效下一事件,因为调度器是非确定性的。针对单一标签训练的模型实际上是在学习猜测随机过程的一个结果。我们反过来利用这种非确定性作为训练信号。我们将每个程序运行多次,将观察到的下一事件聚合成经验分布,并使用KL散度目标微调一个7B模型。在从真实生产Go缺陷(CockroachDB、Kubernetes、gRPC、etcd)中抽取的798个保留预测上,对少于一千个跟踪进行微调达到了36.2%的准确率,超过了零样本的Gemini 3.5 Flash(34.8%)和未微调的同一模型(28.6%)。分布训练在准确率上与交叉熵相当(35.8% vs. 36.2%),同时将期望校准误差从0.205降低到0.169。我们还推导出一类select阻塞goroutine的形式化goroutine泄漏特征,其中P(GoUnblock)=0由调度器语义保证,而非学习得到。我们发布了数据集、训练适配器和所有工具。
英文摘要:
Predicting the next scheduler event of a concurrent program is ill-posed as single-label classification: repeated runs from the same trace prefix produce different, equally valid next events. We formulate next-event prediction for concurrent Go programs as estimating an empirical next-event distribution obtained from repeated executions, and release a benchmark with 945 training examples from hand-written and generated programs and 798 held-out predictions on 54 real-world GoKer bug kernels from systems such as CockroachDB, Kubernetes, gRPC and etcd. We fine-tune Qwen2.5-Coder-7B with low-rank adapters under a cross-entropy objective and a KL-to-empirical-distribution objective and compare them with zero-shot models and trivial baselines. The outcome is a neutral-to-negative result. The fine-tuned adapters (re-evaluated: 36.3% cross-entropy, 33.6% KL; originally reported 36.2% and 35.8%) are statistically indistinguishable from always predicting the majority event (35.5%), and an event n-gram model reaches 33-34%. Because each held-out prompt carries labels from about five runs, no deterministic predictor can exceed 58.9% top-1 accuracy, so we report macro-F1, balanced accuracy, per-class recall, program-clustered confidence intervals and binned calibration measured directly on both adapters. A sensitivity study with 100 runs per program shows that five-run targets are noisy (mean total-variation distance 0.24 from a 100-run reference), which plausibly limits what the KL objective can learn. Rare event types are essentially never predicted. A select-block goroutine-leak signature follows from scheduler semantics rather than learning. We release the data, adapters and tooling.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。