Rust 项目的五个团队正式采纳了一项大语言模型(LLM)使用政策,对在 rust-lang/rust 代码库中借助 AI 工具进行贡献的做法作出了明确规范 [1]。该政策允许使用 LLM 进行问题解答、数据分析、内容提炼、代码检查、建议和审查等工作,但严格禁止直接使用 LLM 创建代码 [1]。政策的适用范围涵盖 PR 审查者、PR 作者、问题报告者以及使用 LLM 发现问题或引用 LLM 输出的所有参与者 [1]。
政策对 LLM 生成代码的使用设置了多重限制条件 [1]。任何 LLM 生成的代码必须经过预先安排、确保代码非关键性、达到高质量标准、经历充分的测试和审查,且使用者需要主动披露其来源 [1]。对于涉及健全性的关键代码变更,政策强烈不鼓励使用 LLM 生成,即使作者是该领域的专家也不例外 [1]。此外,所有公开的 LLM 生成内容必须披露其来源,除非政策明确豁免 [1]。为了确保透明度,政策要求在 PR 模板中增加询问作者代码是否由 LLM 生成的问题 [1]。
Five teams within the Rust project have established a formal policy governing the use of large language models in contributions to the rust-lang/rust repository [1]. The policy permits LLMs to be used for analysis, suggestions, and code review, but imposes strict restrictions on code generation [1].
Under the new guidelines, LLM usage is permitted for answering questions, analyzing code, extracting information, inspecting outputs, providing suggestions, and conducting reviews [1]. However, the policy explicitly prohibits using LLMs to create code [1]. Contributors must publicly disclose any use of LLM tools, and code generated by LLMs is subject to higher scrutiny standards than human-written code [1]. Additionally, LLM-generated code must be prearranged, non-critical to system soundness, of high quality, thoroughly tested and reviewed, and accompanied by clear disclosure [1]. The policy strongly discourages the generation of soundness-critical code changes through LLMs, even when the author is a domain expert [1].
The policy applies to pull request reviewers, PR authors, issue reporters, individuals who use LLMs to identify problems, and anyone citing LLM outputs [1]. The PR template has been updated to ask authors whether their code was generated by an LLM [1]. This measure comes amid a substantial backlog, with rust-lang/rust currently having 1,281 unprocessed pull requests [1].