Salvato in:
Dettagli Bibliografici
Autori principali: Jiang, Renshuang, Dong, Pan, Duan, Zhenling, Shi, Yu, Fang, Xiaoxiang, Ding, Yan, Ma, Jun, Zhao, Shuai, Jiang, Zhe
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:https://arxiv.org/abs/2503.02335
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866917944766758912
author Jiang, Renshuang
Dong, Pan
Duan, Zhenling
Shi, Yu
Fang, Xiaoxiang
Ding, Yan
Ma, Jun
Zhao, Shuai
Jiang, Zhe
author_facet Jiang, Renshuang
Dong, Pan
Duan, Zhenling
Shi, Yu
Fang, Xiaoxiang
Ding, Yan
Ma, Jun
Zhao, Shuai
Jiang, Zhe
contents To provide flexibility and low-level interaction capabilities, the unsafe tag in Rust is essential in many projects, but undermines memory safety and introduces Undefined Behaviors (UBs) that reduce safety. Eliminating these UBs requires a deep understanding of Rust's safety rules and strong typing. Traditional methods require depth analysis of code, which is laborious and depends on knowledge design. The powerful semantic understanding capabilities of LLM offer new opportunities to solve this problem. Although existing large model debugging frameworks excel in semantic tasks, limited by fixed processes and lack adaptive and dynamic adjustment capabilities. Inspired by the dual process theory of decision-making (Fast and Slow Thinking), we present a LLM-based framework called RustBrain that automatically and flexibly minimizes UBs in Rust projects. Fast thinking extracts features to generate solutions, while slow thinking decomposes, verifies, and generalizes them abstractly. To apply verification and generalization results to solution generation, enabling dynamic adjustments and precise outputs, RustBrain integrates two thinking through a feedback mechanism. Experimental results on Miri dataset show a 94.3% pass rate and 80.4% execution rate, improving flexibility and Rust projects safety.
format Preprint
id arxiv_https___arxiv_org_abs_2503_02335
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Unlocking a New Rust Programming Experience: Fast and Slow Thinking with LLMs to Conquer Undefined Behaviors
Jiang, Renshuang
Dong, Pan
Duan, Zhenling
Shi, Yu
Fang, Xiaoxiang
Ding, Yan
Ma, Jun
Zhao, Shuai
Jiang, Zhe
Software Engineering
Computation and Language
To provide flexibility and low-level interaction capabilities, the unsafe tag in Rust is essential in many projects, but undermines memory safety and introduces Undefined Behaviors (UBs) that reduce safety. Eliminating these UBs requires a deep understanding of Rust's safety rules and strong typing. Traditional methods require depth analysis of code, which is laborious and depends on knowledge design. The powerful semantic understanding capabilities of LLM offer new opportunities to solve this problem. Although existing large model debugging frameworks excel in semantic tasks, limited by fixed processes and lack adaptive and dynamic adjustment capabilities. Inspired by the dual process theory of decision-making (Fast and Slow Thinking), we present a LLM-based framework called RustBrain that automatically and flexibly minimizes UBs in Rust projects. Fast thinking extracts features to generate solutions, while slow thinking decomposes, verifies, and generalizes them abstractly. To apply verification and generalization results to solution generation, enabling dynamic adjustments and precise outputs, RustBrain integrates two thinking through a feedback mechanism. Experimental results on Miri dataset show a 94.3% pass rate and 80.4% execution rate, improving flexibility and Rust projects safety.
title Unlocking a New Rust Programming Experience: Fast and Slow Thinking with LLMs to Conquer Undefined Behaviors
topic Software Engineering
Computation and Language
url https://arxiv.org/abs/2503.02335