When the Next Step Is Not One Step: Distribution-Aware Execution Modeling for Concurrent Go Programs
Summary
This research introduces a novel approach for modeling concurrent Go programs by treating scheduler nondeterminism as a training signal. Instead of predicting a single next event, a 7B Qwen2.5-Coder model is fine-tuned using a KL objective to match an empirical distribution of next events observed across repeated program runs. This method achieved 36.2% accuracy on 798 held-out predictions from real production Go bugs (CockroachDB, Kubernetes, gRPC, etcd), outperforming Gemini 3.5 Flash zero-shot (34.8%) and the same model without fine-tuning (28.6%). While accuracy was comparable to cross-entropy training (35.8% vs. 36.2%), the KL objective reduced Expected Calibration Error from 0.205 to 0.169. The study also formally derived a goroutine-leak signature for select-blocked goroutines where P("GoUnblock")=0 due to scheduler semantics. The dataset, trained adapters, and tooling are publicly released.
Key takeaway
For AI Scientists and Machine Learning Engineers working on concurrent program analysis, recognize that traditional deterministic execution models fall short. You should consider using distribution-aware training with objectives like KL divergence to capture nondeterministic behavior, improving model calibration and accuracy on real-world concurrency bugs. Be aware that current single-step training limits multi-step prediction coherence. Explore enriching trace representations with synchronization state for future work.
Key insights
Nondeterminism in concurrent execution can be a training signal for next-event distribution prediction, improving model calibration.
Principles
- Concurrent execution is inherently nondeterministic.
- Nondeterminism provides a principled distributional training target.
- Single-step training limits multi-step prediction coherence.
Method
Fine-tune a 7B Qwen2.5-Coder model with a KL objective to match empirical next-event distributions from repeated concurrent Go program runs, using 4-bit QLoRA.
In practice
- Use empirical distributions for concurrent program modeling.
- Focus on single-step prediction for current models.
- Consider encoding channel/mutex state for better reasoning.
Topics
- Concurrent Go Programs
- Execution Modeling
- Nondeterminism
- Distribution Estimation
- Model Calibration
- Concurrency Bugs
Code references
Best for: Research Scientist, AI Scientist, Machine Learning Engineer, Software Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by cs.SE updates on arXiv.org.