用并发程序的不确定性训练模型,预测下一步更准。
When the Next Step Is Not One Step: Distribution-Aware Execution Modeling for Concurrent Go Programs
- 把调度非确定性转为训练信号,建模下一步事件分布
- 仅用不到千条轨迹微调,准确率达36.2%,优于零样本和未微调模型
- 可检测协程泄漏,适合调试生产级Go程序的开发者
训练模型预测并发程序的下一步操作比表面更难:同一程序从相同执行前缀出发,可能因调度器的非确定性产生多个合法的下一步事件。若模型只学习单一标签,实则在猜测随机过程的结果。本文反其道而行之,将非确定性作为训练信号。通过多次运行程序,将观测到的下一步事件聚合为经验分布,并使用KL散度目标微调一个70亿参数模型。在798个来自真实生产Go缺陷(CockroachDB、Kubernetes、gRPC、etcd)的独立预测任务上,微调仅需不足一千条轨迹,准确率即达36.2%,超过零样本的Gemini 3.5 Flash(34.8%)及同模型未微调版本(28.6%)。分布训练在交叉熵准确率上达到35.8%(接近36.2%),同时将期望校准误差从0.205降至0.169。我们还推导出一类选择阻塞协程的规范泄漏特征:根据调度语义,发生协程唤醒的概率为0。数据集、训练适配器及全部工具均已开源。
原文摘要 · Abstract (English)
Training a model to predict the next step in a concurrent program is harder than it looks: two runs of the same program from the same trace prefix can produce different next events, both valid, because the scheduler is nondeterministic. A model trained against a single label is learning to guess one outcome of a random process. We turn this around and use the nondeterminism as a training signal. We run each program many times, aggregate the observed next events into an empirical distribution, and fine-tune a 7B model to match that distribution with a KL objective. On 798 held-out predictions drawn from real production Go bugs (CockroachDB, Kubernetes, gRPC, etcd), fine-tuning on fewer than a thousand traces reaches 36.2% accuracy, ahead of Gemini 3.5 Flash used zero-shot (34.8%) and the same model without fine-tuning (28.6%). Distribution training matches cross-entropy on accuracy (35.8% vs. 36.2%) while reducing Expected Calibration Error from 0.205 to 0.169. We also derive a formal goroutine-leak signature for a class of select-blocked goroutines where P(GoUnblock)=0 holds by scheduler semantics, not by learning. We release the dataset, trained adapters, and all tooling.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。