Skip to contentSkip to conversation

docs/devel: relax policy on AI-generated contributions

PATCH Superseded Paolo Bonzini 11 participants 53 messages May 29 – Aug 11

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 docs/devel: relax policy on AI-generated contributions

Until now QEMU's code provenance policy declined any contribution believed to include or derive from AI-generated content. A blanket ban was easy to maintain while LLM output was rarely usable on its own, but as the tools improved an absolute prohibition has become harder to justify.

The concern that motivated the policy is unchanged, and it is worth stating
precisely: the DCO is about whether the submitter has the legal right to contribute the code, not about "creative expression". While the status of LLM output seems to be converging towards non-copyrightability, questions around unintentional reproduction of copyrighted code are still open. What has shifted is the balance of risk:

- projects accepting AI-assisted content have not run into serious legal trouble so far, which suggests the probability of the risk materializing is not high;

- other organizations, such as Red Hat[1], have assessed the risk as acceptable -- though a community of individual developers does not have the legal backing of a company, and even an unfounded dispute would be a long-lasting distraction from work on QEMU.

Nevertheless, even Red Hat mentions that "the possibility of occasional replication cannot be ignored". In QEMU's view, attentiveness and oversight are not a practical way to address this; yet as a copyleft project, copyright and code provenance are of utmost importance to us. Therefore, it remains prudent to only permit AI assistance where the ramifications of copyright violations are at least easy to revert and unlikely to spread: tests, documentation, mechanical changes, and small bug fixes. Core code that other things depend on, and that cannot simply be thrown away once a problem is noticed long after the fact, stays off-limits without prior agreement from a maintainer.

Related to this, and already visible in the incredible uptick in security reports, is the question of maintainer burnout and the shift in effort from the author to the reviewer of the code. AI lowers the cost of producing a patch but does nothing to lower the cost of understanding and reviewing one; if anything it raises it, since a reviewer can no longer assume that the submitter has reasoned through every line. The limits above work just as much to keep the volume of review work sustainable.

Revise the policy according to the above considerations, and introduce the "AI-used-for:" trailer as a record of where AI was used. The standard is slightly different from the more usual "Assisted-by"; the intention is for the metadata to provide more information for reviewers to judge the result.

In any case, use of AI does not relax any other contribution requirement:
authors still comply with the DCO and take responsibility for the whole patch via Signed-off-by.

[Commit message largely based on
https://lore.kernel.org/qemu-devel/[email protected]/, by Kevin Wolf. - Paolo]

[1] https://www.redhat.com/en/blog/ai-assisted-development-and-open-source-navigating-legal-issues

---
 docs/devel/code-provenance.rst | 142 ++++++++++++++++++++++-----------
 1 file changed, 94 insertions(+), 48 deletions(-)
docs/devel/code-provenance.rst +94 -48
index 65b8f232a08..857588c43ba 100644
@@ -1,7 +1,7 @@
 .. _code-provenance:
 
-Code provenance
-===============
+Code provenance and AI usage
+============================
 
 Certifying patch submissions
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -288,62 +288,108 @@ content generators below.
 Use of AI-generated content
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-TL;DR:
+.. warning::
 
-  **Current QEMU project policy is to DECLINE any contributions which are
-  believed to include or derive from AI generated content. This includes
-  ChatGPT, Claude, Copilot, Llama and similar tools.**
+   Please read the below policy before using AI to contribute code or
+   documentation to QEMU.  This applies to ChatGPT, Claude, Copilot,
+   Llama, and similar tools.**
 
-  **This policy does not apply to other uses of AI, such as researching APIs
-  or algorithms, static analysis, or debugging, provided their output is not
-  included in contributions.**
+The increasing prevalence of AI-assisted software development,
+and especially the use of content generated by `Large Language Models
+<https://en.wikipedia.org/wiki/Large_language_model>`__ (LLMs),
+poses a number of difficult questions.
 
-The increasing prevalence of AI-assisted software development results in a
-number of difficult legal questions and risks for software projects, including
-QEMU.  Of particular concern is content generated by `Large Language Models
-<https://en.wikipedia.org/wiki/Large_language_model>`__ (LLMs).
+Risks to open source projects include maintainer burnout from an
+increased number of contributions, as well as the risk to the project
+from unintentional inclusion of copyrighted material in the LLM's output.
+In order to mitigate these risks, the QEMU project currently allows
+using AI/LLM tools to produce patches in a limited set of scenarios:
 
-The QEMU community requires that contributors certify their patch submissions
-are made in accordance with the rules of the `Developer's Certificate of
-Origin (DCO) <dco>`.
+**Mechanical changes**
+  If you can use a deterministic tool, it is preferred that you use it
+  and not replace it with AI. If you don't know how to do the change
+  deterministically, you can ask the AI for help.
 
-To satisfy the DCO, the patch contributor has to fully understand the
-copyright and license status of content they are contributing to QEMU. With AI
-content generators, the copyright and license status of the output is
-ill-defined with no generally accepted, settled legal foundation.
+**Small bug fixes**
+  These should be limited to 20 lines of code or less, not including
+  tests.  You are still expected to :ref:`understand and explain your changes
+  <write_a_meaningful_commit_message>` and the rationale behind them.
 
-Where the training material is known, it is common for it to include large
-volumes of material under restrictive licensing/copyright terms. Even where
-the training material is all known to be under open source licenses, it is
-likely to be under a variety of terms, not all of which will be compatible
-with QEMU's licensing requirements.
+**Documentation and code comments**
+  While AI can help draft text, it still requires significant human
+  oversight.  Pay attention to the organization and flow of the generated
+  text, and strictly fact-check all technical details as LLMs are prone
+  to being confidently wrong.
 
-How contributors could comply with DCO terms (b) or (c) for the output of AI
-content generators commonly available today is unclear.  The QEMU project is
-not willing or able to accept the legal risks of non-compliance.
+**Tests**
+  Note that you must still confirm that each test actually exercises
+  the intended behavior including, for regression tests, that it
+  fails without the code under test and passes for the right reason.
 
-The QEMU project thus requires that contributors refrain from using AI content
-generators on patches intended to be submitted to the project, and will
-decline any contribution if use of AI is either known or suspected.
+These boundaries do not apply to other uses of AI, such as researching
+APIs or algorithms, static analysis, or debugging, provided the model's
+output is not included in contributions.
 
-Examples of tools impacted by this policy includes GitHub's CoPilot, OpenAI's
-ChatGPT, Anthropic's Claude, and Meta's Code Llama, and code/content
-generation agents which are built on top of such tools.
+If you wish to send large amounts of AI-generated changes, or any other
+contribution not in the above categories, please get in touch with the
+maintainer beforehand.  These can be treated as experiments, at the
+discretion of the maintainer and the community, with no obligation
+to accept them.
 
-This policy may evolve as AI tools mature and the legal situation is
-clarified.
+**Use of AI does not remove the need for authors to comply with all
+other requirements for contribution.**  In particular, the
+``Signed-off-by`` label in a patch submission is a statement that
+the author takes responsibility for the entire contents of the patch,
+certifying that their patch submission is made in accordance with the
+rules of the `Developer's Certificate of Origin (DCO) <dco>`.
 
-Exceptions
-^^^^^^^^^^
+Commit messages for AI-assisted changes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-The QEMU project welcomes discussion on any exceptions to this policy,
-or more general revisions. This can be done by contacting the qemu-devel
-mailing list with details of a proposed tool, model, usage scenario, etc.
-that is beneficial to QEMU, while still mitigating issues around compliance
-with the DCO.  After discussion, any exception will be listed below.
+When AI/LLM tools produce or substantively shape your patch, add an
+``AI-used-for:`` line before ``Signed-off-by``, as a reminder of your
+DCO obligations and a guide to reviewers.  The text is one or more of
+``code``, ``tests``, ``docs``, ``research``, possibly followed by an
+explanation in parentheses:
 
-Exceptions do not remove the need for authors to comply with all other
-requirements for contribution.  In particular, the "Signed-off-by"
-label in a patch submission is a statement that the author takes
-responsibility for the entire contents of the patch, including any parts
-that were generated or assisted by AI tools or other tools.
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.
+
+There is no requirement to include your prompts or summarize the
+conversation in the commit message or cover letter, but you may do so
+if you think it helps a reviewer judge the result.  For example:
+
+**Helpful prompts**
+  These describe concrete constraints or instructions, making it easy for a
+  reviewer to see how the tool's output was guided:
+
+  * "move field ``foo`` from ``struct aa`` to ``struct bb``.  If a
+    function already has a local variable or parameter of type ``struct
+    bb``, use it instead of accessing ``aa.bb``"
+
+  * "add an implementation of the trait for ``Mutex<T: MyTrait>``; it
+    takes the lock around the calls and forwards to ``T``"
+
+**Unhelpful prompts**
+  These are too generic to provide meaningful context.  You can of course
+  use them in the context of a complex interaction with the LLM, but they
+  should not be included in the commit message:
+
+  * "write user-facing documentation for the new tool"
+
+  * "write testcases for the new functions"
+
+QEMU does *not* use ``Assisted-by``, ``Co-authored-by`` or ``Generated-by``
+trailers to indicate AI usage.  In particular, it is not necessary to
+specify the exact AI model or tool used to create the commit.
+
+Deterministic tooling (sed, coccinelle, formatters) is out of scope for
+the trailer, but should be mentioned in the commit message.
Signature · 1 line
2.54.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Paolo Bonzini

Until now QEMU's code provenance policy declined any contribution believed to include or derive from AI-generated content. A blanket ban was easy to maintain while LLM output was rarely usable on its own, but as the tools improved an absolute prohibition has become harder to justify.

<snip>

docs/devel/code-provenance.rst content generators below. · line 295

Quoted 11 lines
docs/devel/code-provenance.rst +4 -4
-TL;DR:
+.. warning::
 
-  **Current QEMU project policy is to DECLINE any contributions which are
-  believed to include or derive from AI generated content. This includes
-  ChatGPT, Claude, Copilot, Llama and similar tools.**
+   Please read the below policy before using AI to contribute code or
+   documentation to QEMU.  This applies to ChatGPT, Claude, Copilot,
+   Llama, and similar tools.**

Stray **, also extra space after QEMU.

Quoted 23 lines
docs/devel/code-provenance.rst +11 -10
-  **This policy does not apply to other uses of AI, such as researching APIs
-  or algorithms, static analysis, or debugging, provided their output is not
-  included in contributions.**
+The increasing prevalence of AI-assisted software development,
+and especially the use of content generated by `Large Language Models
+<https://en.wikipedia.org/wiki/Large_language_model>`__ (LLMs),
+poses a number of difficult questions.
 
-The increasing prevalence of AI-assisted software development results in a
-number of difficult legal questions and risks for software projects, including
-QEMU.  Of particular concern is content generated by `Large Language Models
-<https://en.wikipedia.org/wiki/Large_language_model>`__ (LLMs).
+Risks to open source projects include maintainer burnout from an
+increased number of contributions, as well as the risk to the project
+from unintentional inclusion of copyrighted material in the LLM's output.
+In order to mitigate these risks, the QEMU project currently allows
+using AI/LLM tools to produce patches in a limited set of scenarios:
 
-The QEMU community requires that contributors certify their patch submissions
-are made in accordance with the rules of the `Developer's Certificate of
-Origin (DCO) <dco>`.
+**Mechanical changes**
+  If you can use a deterministic tool, it is preferred that you use
Quoted 1 line

it

deterministic tool or script,?

Quoted 51 lines
docs/devel/code-provenance.rst +24 -20
+  and not replace it with AI. If you don't know how to do the change
+  deterministically, you can ask the AI for help.
 
-To satisfy the DCO, the patch contributor has to fully understand the
-copyright and license status of content they are contributing to QEMU. With AI
-content generators, the copyright and license status of the output is
-ill-defined with no generally accepted, settled legal foundation.
+**Small bug fixes**
+  These should be limited to 20 lines of code or less, not including
+  tests.  You are still expected to :ref:`understand and explain your changes
+  <write_a_meaningful_commit_message>` and the rationale behind them.
 
-Where the training material is known, it is common for it to include large
-volumes of material under restrictive licensing/copyright terms. Even where
-the training material is all known to be under open source licenses, it is
-likely to be under a variety of terms, not all of which will be compatible
-with QEMU's licensing requirements.
+**Documentation and code comments**
+  While AI can help draft text, it still requires significant human
+  oversight.  Pay attention to the organization and flow of the generated
+  text, and strictly fact-check all technical details as LLMs are prone
+  to being confidently wrong.
 
-How contributors could comply with DCO terms (b) or (c) for the output of AI
-content generators commonly available today is unclear.  The QEMU project is
-not willing or able to accept the legal risks of non-compliance.
+**Tests**
+  Note that you must still confirm that each test actually exercises
+  the intended behavior including, for regression tests, that it
+  fails without the code under test and passes for the right reason.
 
-The QEMU project thus requires that contributors refrain from using AI content
-generators on patches intended to be submitted to the project, and will
-decline any contribution if use of AI is either known or suspected.
+These boundaries do not apply to other uses of AI, such as researching
+APIs or algorithms, static analysis, or debugging, provided the model's
+output is not included in contributions.
 
-Examples of tools impacted by this policy includes GitHub's CoPilot, OpenAI's
-ChatGPT, Anthropic's Claude, and Meta's Code Llama, and code/content
-generation agents which are built on top of such tools.
+If you wish to send large amounts of AI-generated changes, or any other
+contribution not in the above categories, please get in touch with the
+maintainer beforehand.  These can be treated as experiments, at the
+discretion of the maintainer and the community, with no obligation
+to accept them.
 
-This policy may evolve as AI tools mature and the legal situation is
-clarified.
+**Use of AI does not remove the need for authors to comply with all

docs/devel/code-provenance.rst content generators below. · line 347

Quoted 10 lines
docs/devel/code-provenance.rst +7 -2
+other requirements for contribution.**  In particular, the
+``Signed-off-by`` label in a patch submission is a statement that
+the author takes responsibility for the entire contents of the patch,
+certifying that their patch submission is made in accordance with the
+rules of the `Developer's Certificate of Origin (DCO) <dco>`.
 
-Exceptions
-^^^^^^^^^^
+Commit messages for AI-assisted changes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In my v2 I added:

AI tools **should not be used to write commit messages**. The act of summarising and explaining the reasoning for the changes is an important demonstration of the human authors understanding of the commit.

Quoted 47 lines
docs/devel/code-provenance.rst +36 -10
-The QEMU project welcomes discussion on any exceptions to this policy,
-or more general revisions. This can be done by contacting the qemu-devel
-mailing list with details of a proposed tool, model, usage scenario, etc.
-that is beneficial to QEMU, while still mitigating issues around compliance
-with the DCO.  After discussion, any exception will be listed below.
+When AI/LLM tools produce or substantively shape your patch, add an
+``AI-used-for:`` line before ``Signed-off-by``, as a reminder of your
+DCO obligations and a guide to reviewers.  The text is one or more of
+``code``, ``tests``, ``docs``, ``research``, possibly followed by an
+explanation in parentheses:
 
-Exceptions do not remove the need for authors to comply with all other
-requirements for contribution.  In particular, the "Signed-off-by"
-label in a patch submission is a statement that the author takes
-responsibility for the entire contents of the patch, including any parts
-that were generated or assisted by AI tools or other tools.
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.
+
+There is no requirement to include your prompts or summarize the
+conversation in the commit message or cover letter, but you may do so
+if you think it helps a reviewer judge the result.  For example:
+
+**Helpful prompts**
+  These describe concrete constraints or instructions, making it easy for a
+  reviewer to see how the tool's output was guided:
+
+  * "move field ``foo`` from ``struct aa`` to ``struct bb``.  If a
+    function already has a local variable or parameter of type ``struct
+    bb``, use it instead of accessing ``aa.bb``"
+
+  * "add an implementation of the trait for ``Mutex<T: MyTrait>``; it
+    takes the lock around the calls and forwards to ``T``"
+
+**Unhelpful prompts**
+  These are too generic to provide meaningful context.  You can of course
+  use them in the context of a complex interaction with the LLM, but they
+  should not be included in the commit message:
+

docs/devel/code-provenance.rst content generators below. · line 395

Quoted 10 lines
docs/devel/code-provenance.rst +10 -0
+  * "write user-facing documentation for the new tool"
+
+  * "write testcases for the new functions"
+
+QEMU does *not* use ``Assisted-by``, ``Co-authored-by`` or ``Generated-by``
+trailers to indicate AI usage.  In particular, it is not necessary to
+specify the exact AI model or tool used to create the commit.
+
+Deterministic tooling (sed, coccinelle, formatters) is out of scope for
+the trailer, but should be mentioned in the commit message.

The other changes in my v2 where just different wordings for the same concept.

With those have a:

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#2 lore raw
Quoted 8 lines · Alex Bennée

docs/devel/code-provenance.rst content generators below. · line 295

Quoted 6 lines
docs/devel/code-provenance.rst +3 -3
-  **Current QEMU project policy is to DECLINE any contributions which are
-  believed to include or derive from AI generated content. This includes
-  ChatGPT, Claude, Copilot, Llama and similar tools.**
+   Please read the below policy before using AI to contribute code or
+   documentation to QEMU.  This applies to ChatGPT, Claude, Copilot,
+   Llama, and similar tools.**

Stray **, also extra space after QEMU.

Will fix the stars (extra space is intentional, though it shows my age. I still find that it reads better on monospace fonts to have two spaces at the end of the sentence).

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+**Mechanical changes**
+  If you can use a deterministic tool, it is preferred that you use

deterministic tool or script,?

Sure.

Quoted 6 lines

In my v2 I added:

AI tools **should not be used to write commit messages**. The act of summarising and explaining the reasoning for the changes is an important demonstration of the human authors understanding of the commit.

While I didn't include this, v2 links to the "how to write a commit message" paragraph elsewhere in the documentation. I don't want it to look like people can't even ask for copy-editing of commit messages. Paolo

#3 lore raw
Quoted 28 lines · Paolo Bonzini
Quoted 8 lines · Alex Bennée

docs/devel/code-provenance.rst content generators below. · line 295

Quoted 6 lines
docs/devel/code-provenance.rst +3 -3
-  **Current QEMU project policy is to DECLINE any contributions which are
-  believed to include or derive from AI generated content. This includes
-  ChatGPT, Claude, Copilot, Llama and similar tools.**
+   Please read the below policy before using AI to contribute code or
+   documentation to QEMU.  This applies to ChatGPT, Claude, Copilot,
+   Llama, and similar tools.**

Stray **, also extra space after QEMU.

Will fix the stars (extra space is intentional, though it shows my age. I still find that it reads better on monospace fonts to have two spaces at the end of the sentence).

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+**Mechanical changes**
+  If you can use a deterministic tool, it is preferred that you use

deterministic tool or script,?

Sure.

Quoted 6 lines

In my v2 I added:

AI tools **should not be used to write commit messages**. The act of summarising and explaining the reasoning for the changes is an important demonstration of the human authors understanding of the commit.

Quoted 4 lines

While I didn't include this, v2 links to the "how to write a commit message" paragraph elsewhere in the documentation. I don't want it to look like people can't even ask for copy-editing of commit messages.
Paolo

And maybe "It is ok to ask an AI tool to correct grammar and spelling in your text, as long as you are not asking it to write it".

#4 lore raw
In reply to Paolo Bonzini
Quoted 226 lines · Paolo Bonzini

Until now QEMU's code provenance policy declined any contribution believed to include or derive from AI-generated content. A blanket ban was easy to maintain while LLM output was rarely usable on its own, but as the tools improved an absolute prohibition has become harder to justify.

The concern that motivated the policy is unchanged, and it is worth stating
precisely: the DCO is about whether the submitter has the legal right to contribute the code, not about "creative expression". While the status of LLM output seems to be converging towards non-copyrightability, questions around unintentional reproduction of copyrighted code are still open. What has shifted is the balance of risk:

- projects accepting AI-assisted content have not run into serious legal trouble so far, which suggests the probability of the risk materializing is not high;

- other organizations, such as Red Hat[1], have assessed the risk as acceptable -- though a community of individual developers does not have the legal backing of a company, and even an unfounded dispute would be a long-lasting distraction from work on QEMU.

Nevertheless, even Red Hat mentions that "the possibility of occasional replication cannot be ignored". In QEMU's view, attentiveness and oversight are not a practical way to address this; yet as a copyleft project, copyright and code provenance are of utmost importance to us. Therefore, it remains prudent to only permit AI assistance where the ramifications of copyright violations are at least easy to revert and unlikely to spread: tests, documentation, mechanical changes, and small bug fixes. Core code that other things depend on, and that cannot simply be thrown away once a problem is noticed long after the fact, stays off-limits without prior agreement from a maintainer.

Related to this, and already visible in the incredible uptick in security reports, is the question of maintainer burnout and the shift in effort from the author to the reviewer of the code. AI lowers the cost of producing a patch but does nothing to lower the cost of understanding and reviewing one; if anything it raises it, since a reviewer can no longer assume that the submitter has reasoned through every line. The limits above work just as much to keep the volume of review work sustainable.

Revise the policy according to the above considerations, and introduce the "AI-used-for:" trailer as a record of where AI was used. The standard is slightly different from the more usual "Assisted-by"; the intention is for the metadata to provide more information for reviewers to judge the result.

In any case, use of AI does not relax any other contribution requirement:
authors still comply with the DCO and take responsibility for the whole patch via Signed-off-by.

[Commit message largely based on
https://lore.kernel.org/qemu-devel/[email protected]/, by Kevin Wolf. - Paolo]

[1] https://www.redhat.com/en/blog/ai-assisted-development-and-open-source-navigating-legal-issues

---
docs/devel/code-provenance.rst | 142 ++++++++++++++++++++++-----------

1 file changed, 94 insertions(+), 48 deletions(-)
docs/devel/code-provenance.rst +0 -0
index 65b8f232a08..857588c43ba 100644
@@ -1,7 +1,7 @@

.. _code-provenance:

docs/devel/code-provenance.rst +2 -2
-Code provenance
-===============
+Code provenance and AI usage
+============================

Certifying patch submissions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

docs/devel/code-provenance.rst +0 -0
@@ -288,62 +288,108 @@ content generators below.

Use of AI-generated content
~~~~~~~~~~~~~~~~~~~~~~~~~~~

docs/devel/code-provenance.rst +78 -46
-TL;DR:
+.. warning::
 
-  **Current QEMU project policy is to DECLINE any contributions which are
-  believed to include or derive from AI generated content. This includes
-  ChatGPT, Claude, Copilot, Llama and similar tools.**
+   Please read the below policy before using AI to contribute code or
+   documentation to QEMU.  This applies to ChatGPT, Claude, Copilot,
+   Llama, and similar tools.**
 
-  **This policy does not apply to other uses of AI, such as researching APIs
-  or algorithms, static analysis, or debugging, provided their output is not
-  included in contributions.**
+The increasing prevalence of AI-assisted software development,
+and especially the use of content generated by `Large Language Models
+<https://en.wikipedia.org/wiki/Large_language_model>`__ (LLMs),
+poses a number of difficult questions.
 
-The increasing prevalence of AI-assisted software development results in a
-number of difficult legal questions and risks for software projects, including
-QEMU.  Of particular concern is content generated by `Large Language Models
-<https://en.wikipedia.org/wiki/Large_language_model>`__ (LLMs).
+Risks to open source projects include maintainer burnout from an
+increased number of contributions, as well as the risk to the project
+from unintentional inclusion of copyrighted material in the LLM's output.
+In order to mitigate these risks, the QEMU project currently allows
+using AI/LLM tools to produce patches in a limited set of scenarios:
 
-The QEMU community requires that contributors certify their patch submissions
-are made in accordance with the rules of the `Developer's Certificate of
-Origin (DCO) <dco>`.
+**Mechanical changes**
+  If you can use a deterministic tool, it is preferred that you use it
+  and not replace it with AI. If you don't know how to do the change
+  deterministically, you can ask the AI for help.
 
-To satisfy the DCO, the patch contributor has to fully understand the
-copyright and license status of content they are contributing to QEMU. With AI
-content generators, the copyright and license status of the output is
-ill-defined with no generally accepted, settled legal foundation.
+**Small bug fixes**
+  These should be limited to 20 lines of code or less, not including
+  tests.  You are still expected to :ref:`understand and explain your changes
+  <write_a_meaningful_commit_message>` and the rationale behind them.
 
-Where the training material is known, it is common for it to include large
-volumes of material under restrictive licensing/copyright terms. Even where
-the training material is all known to be under open source licenses, it is
-likely to be under a variety of terms, not all of which will be compatible
-with QEMU's licensing requirements.
+**Documentation and code comments**
+  While AI can help draft text, it still requires significant human
+  oversight.  Pay attention to the organization and flow of the generated
+  text, and strictly fact-check all technical details as LLMs are prone
+  to being confidently wrong.
 
-How contributors could comply with DCO terms (b) or (c) for the output of AI
-content generators commonly available today is unclear.  The QEMU project is
-not willing or able to accept the legal risks of non-compliance.
+**Tests**
+  Note that you must still confirm that each test actually exercises
+  the intended behavior including, for regression tests, that it
+  fails without the code under test and passes for the right reason.
 
-The QEMU project thus requires that contributors refrain from using AI content
-generators on patches intended to be submitted to the project, and will
-decline any contribution if use of AI is either known or suspected.
+These boundaries do not apply to other uses of AI, such as researching
+APIs or algorithms, static analysis, or debugging, provided the model's
+output is not included in contributions.
 
-Examples of tools impacted by this policy includes GitHub's CoPilot, OpenAI's
-ChatGPT, Anthropic's Claude, and Meta's Code Llama, and code/content
-generation agents which are built on top of such tools.
+If you wish to send large amounts of AI-generated changes, or any other
+contribution not in the above categories, please get in touch with the
+maintainer beforehand.  These can be treated as experiments, at the
+discretion of the maintainer and the community, with no obligation
+to accept them.
 
-This policy may evolve as AI tools mature and the legal situation is
-clarified.
+**Use of AI does not remove the need for authors to comply with all
+other requirements for contribution.**  In particular, the
+``Signed-off-by`` label in a patch submission is a statement that
+the author takes responsibility for the entire contents of the patch,
+certifying that their patch submission is made in accordance with the
+rules of the `Developer's Certificate of Origin (DCO) <dco>`.
 
-Exceptions
-^^^^^^^^^^
+Commit messages for AI-assisted changes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-The QEMU project welcomes discussion on any exceptions to this policy,
-or more general revisions. This can be done by contacting the qemu-devel
-mailing list with details of a proposed tool, model, usage scenario, etc.
-that is beneficial to QEMU, while still mitigating issues around compliance
-with the DCO.  After discussion, any exception will be listed below.
+When AI/LLM tools produce or substantively shape your patch, add an
+``AI-used-for:`` line before ``Signed-off-by``, as a reminder of your
+DCO obligations and a guide to reviewers.  The text is one or more of
+``code``, ``tests``, ``docs``, ``research``, possibly followed by an
+explanation in parentheses:
 
-Exceptions do not remove the need for authors to comply with all other
-requirements for contribution.  In particular, the "Signed-off-by"
-label in a patch submission is a statement that the author takes
-responsibility for the entire contents of the patch, including any parts
-that were generated or assisted by AI tools or other tools.
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.
+
+There is no requirement to include your prompts or summarize the
+conversation in the commit message or cover letter, but you may do so
+if you think it helps a reviewer judge the result.  For example:
+
+**Helpful prompts**
+  These describe concrete constraints or instructions, making it easy for a
+  reviewer to see how the tool's output was guided:
+
+  * "move field ``foo`` from ``struct aa`` to ``struct bb``.  If a
+    function already has a local variable or parameter of type ``struct
+    bb``, use it instead of accessing ``aa.bb``"
+
+  * "add an implementation of the trait for ``Mutex<T: MyTrait>``; it
+    takes the lock around the calls and forwards to ``T``"
+
+**Unhelpful prompts**

docs/devel/code-provenance.rst content generators below. · line 391

Quoted 10 lines
docs/devel/code-provenance.rst +10 -0
+  These are too generic to provide meaningful context.  You can of course
+  use them in the context of a complex interaction with the LLM, but they
+  should not be included in the commit message:
+
+  * "write user-facing documentation for the new tool"
+
+  * "write testcases for the new functions"
+
+QEMU does *not* use ``Assisted-by``, ``Co-authored-by`` or ``Generated-by``
+trailers to indicate AI usage.  In particular, it is not necessary to

I think these are commonly referred to as tags and that's how elsewhere in this docs these appear so that's why I was confused by the term trailers. Otherwise this is now clearer, thanks.

Regards,
BALATON Zoltan

Quoted 5 lines
docs/devel/code-provenance.rst +4 -0
+specify the exact AI model or tool used to create the commit.
+
+Deterministic tooling (sed, coccinelle, formatters) is out of scope for
+the trailer, but should be mentioned in the commit message.
#5 lore raw
In reply to Paolo Bonzini
Quoted 23 lines · Paolo Bonzini

Until now QEMU's code provenance policy declined any contribution believed to include or derive from AI-generated content. A blanket ban was easy to maintain while LLM output was rarely usable on its own, but as the tools improved an absolute prohibition has become harder to justify.

The concern that motivated the policy is unchanged, and it is worth stating
precisely: the DCO is about whether the submitter has the legal right to contribute the code, not about "creative expression". While the status of LLM output seems to be converging towards non-copyrightability, questions around unintentional reproduction of copyrighted code are still open. What has shifted is the balance of risk:

- projects accepting AI-assisted content have not run into serious legal trouble so far, which suggests the probability of the risk materializing is not high;

- other organizations, such as Red Hat[1], have assessed the risk as acceptable -- though a community of individual developers does not have the legal backing of a company, and even an unfounded dispute would be a long-lasting distraction from work on QEMU.

Quoted 10 lines

Nevertheless, even Red Hat mentions that "the possibility of occasional replication cannot be ignored". In QEMU's view, attentiveness and oversight are not a practical way to address this; yet as a copyleft project, copyright and code provenance are of utmost importance to us. Therefore, it remains prudent to only permit AI assistance where the ramifications of copyright violations are at least easy to revert and unlikely to spread: tests, documentation, mechanical changes, and small bug fixes. Core code that other things depend on, and that cannot simply be thrown away once a problem is noticed long after the fact, stays off-limits without prior agreement from a maintainer.

This all makes sense to me, except for the part where we allow a maintainer to say "actually it's OK". Where our justification for not wanting AI contributions rests on "it's too much burden on maintainers to have to deal with and review it", allowing an individual maintainer to say "I'm OK with that burden in this case or for this particular contribution" logically follows as a possible relaxation. But if as a project we want to limit the blast-radius if we find we have to rip out a hypothetical tainted contribution, shouldn't that mean that we hold that as a project-wide line, rather than leaving it up to the opinion of the individual maintainer ?

Quoted 21 lines

Related to this, and already visible in the incredible uptick in security reports, is the question of maintainer burnout and the shift in effort from the author to the reviewer of the code. AI lowers the cost of producing a patch but does nothing to lower the cost of understanding and reviewing one; if anything it raises it, since a reviewer can no longer assume that the submitter has reasoned through every line. The limits above work just as much to keep the volume of review work sustainable.

Revise the policy according to the above considerations, and introduce the "AI-used-for:" trailer as a record of where AI was used. The standard is slightly different from the more usual "Assisted-by"; the intention is for the metadata to provide more information for reviewers to judge the result.

In any case, use of AI does not relax any other contribution requirement:
authors still comply with the DCO and take responsibility for the whole patch via Signed-off-by.

[Commit message largely based on
https://lore.kernel.org/qemu-devel/[email protected]/, by Kevin Wolf. - Paolo]

docs/devel/code-provenance.rst content generators below. · line 322

Quoted 5 lines
docs/devel/code-provenance.rst +5 -0
+**Documentation and code comments**
+  While AI can help draft text, it still requires significant human
+  oversight.  Pay attention to the organization and flow of the generated
+  text, and strictly fact-check all technical details as LLMs are prone
+  to being confidently wrong.

I think the application to documentation and comments is the part I'm least enthusiastic about here. For changes to code, we have at least some guardrails on the AI output, in the fact that it has to compile and to pass tests. For changes to documentation, the only guardrails are human eyeballs.

Also both comments and documentation ideally are a record of what we intended the behaviour to be. If an LLM is effectively autogenerating something documentation-shaped from the code we lose that.

-- PMM

#6 lore raw
Quoted 35 lines · Peter Maydell
Quoted 23 lines · Paolo Bonzini

Until now QEMU's code provenance policy declined any contribution believed to include or derive from AI-generated content. A blanket ban was easy to maintain while LLM output was rarely usable on its own, but as the tools improved an absolute prohibition has become harder to justify.

The concern that motivated the policy is unchanged, and it is worth stating
precisely: the DCO is about whether the submitter has the legal right to contribute the code, not about "creative expression". While the status of LLM output seems to be converging towards non-copyrightability, questions around unintentional reproduction of copyrighted code are still open. What has shifted is the balance of risk:

- projects accepting AI-assisted content have not run into serious legal trouble so far, which suggests the probability of the risk materializing is not high;

- other organizations, such as Red Hat[1], have assessed the risk as acceptable -- though a community of individual developers does not have the legal backing of a company, and even an unfounded dispute would be a long-lasting distraction from work on QEMU.

Quoted 10 lines

Nevertheless, even Red Hat mentions that "the possibility of occasional replication cannot be ignored". In QEMU's view, attentiveness and oversight are not a practical way to address this; yet as a copyleft project, copyright and code provenance are of utmost importance to us. Therefore, it remains prudent to only permit AI assistance where the ramifications of copyright violations are at least easy to revert and unlikely to spread: tests, documentation, mechanical changes, and small bug fixes. Core code that other things depend on, and that cannot simply be thrown away once a problem is noticed long after the fact, stays off-limits without prior agreement from a maintainer.

Quoted 11 lines

This all makes sense to me, except for the part where we allow a maintainer to say "actually it's OK". Where our justification for not wanting AI contributions rests on "it's too much burden on maintainers to have to deal with and review it", allowing an individual maintainer to say "I'm OK with that burden in this case or for this particular contribution" logically follows as a possible relaxation. But if as a project we want to limit the blast-radius if we find we have to rip out a hypothetical tainted contribution, shouldn't that mean that we hold that as a project-wide line, rather than leaving it up to the opinion of the individual maintainer ?

I guess, the maintainer can judge that the code is unique and qemu specific enough, and follows from what it is doing automatically enough, that the chances it is accidentally copying something are nil?

Quoted 21 lines
Quoted 20 lines

Related to this, and already visible in the incredible uptick in security reports, is the question of maintainer burnout and the shift in effort from the author to the reviewer of the code. AI lowers the cost of producing a patch but does nothing to lower the cost of understanding and reviewing one; if anything it raises it, since a reviewer can no longer assume that the submitter has reasoned through every line. The limits above work just as much to keep the volume of review work sustainable.

Revise the policy according to the above considerations, and introduce the "AI-used-for:" trailer as a record of where AI was used. The standard is slightly different from the more usual "Assisted-by"; the intention is for the metadata to provide more information for reviewers to judge the result.

In any case, use of AI does not relax any other contribution requirement:
authors still comply with the DCO and take responsibility for the whole patch via Signed-off-by.

[Commit message largely based on
https://lore.kernel.org/qemu-devel/[email protected]/, by Kevin Wolf. - Paolo]

Quoted 8 lines

docs/devel/code-provenance.rst content generators below. · line 322

Quoted 5 lines
docs/devel/code-provenance.rst +5 -0
+**Documentation and code comments**
+  While AI can help draft text, it still requires significant human
+  oversight.  Pay attention to the organization and flow of the generated
+  text, and strictly fact-check all technical details as LLMs are prone
+  to being confidently wrong.

I think the application to documentation and comments is the part I'm least enthusiastic about here.

But I am very enthusiastic about less agrammatical english in both. AI is super helpful for non native speakers.

Quoted 11 lines

For changes to code, we have at
least some guardrails on the AI output, in the fact that it has to compile and to pass tests. For changes to documentation, the only guardrails are human eyeballs.

Also both comments and documentation ideally are a record of what we intended the behaviour to be. If an LLM is effectively autogenerating something documentation-shaped from the code we lose that.

-- PMM

#7 lore raw
Quoted 9 lines · Michael S. Tsirkin
Quoted 7 lines · Peter Maydell
Quoted 5 lines · Paolo Bonzini
docs/devel/code-provenance.rst +5 -0
+**Documentation and code comments**
+  While AI can help draft text, it still requires significant human
+  oversight.  Pay attention to the organization and flow of the generated
+  text, and strictly fact-check all technical details as LLMs are prone
+  to being confidently wrong.
Quoted 5 lines
Quoted 2 lines

I think the application to documentation and comments is the part I'm least enthusiastic about here.

But I am very enthusiastic about less agrammatical english in both. AI is super helpful for non native speakers.

There's a difference between "I wrote the comments / documentation and then asked the AI to check it for grammatical mistakes" or "I wrote the documentation in my own language and asked it to translate" and "I asked the AI to write or draft the documentation starting from nothing". I think the first two are OK, but not so much the third.

-- PMM

#8 lore raw
In reply to Michael S. Tsirkin

Il ven 29 mag 2026, 17:46 Michael S. Tsirkin <[email protected]> ha scritto:

Quoted 10 lines
Quoted 5 lines

If as a project we want to limit the
blast-radius if we find we have to rip out a hypothetical tainted contribution, shouldn't that mean that we hold that as a project-wide line, rather than leaving it up to the opinion of the individual maintainer ?

I guess, the maintainer can judge that the code is unique and qemu specific enough, and follows from what it is doing automatically enough, that the chances it is accidentally copying something are nil?

One thing that I had in mind was using AI to adjust QEMU code as the kernel side goes through review and APIs change. The changes at that point may be not entirely mechanical and, more importantly for traceability, it probably will not make sense to separate them from the original code; but the code still has fundamentally a shape and design that was provided by the human.

Another, which is Rust-specific, is procedural macro code, which is often boring, or very much tied to the shape of the generated code and human-written traits, or both. See
https://github.com/qemu/qemu/blob/master/rust/qemu-macros/src/migration_state.rs
for an example, contrasting the block starting with "self.conversion = match" with the rest.

I don't think it makes sense to have a wholesale permission for procedural macros because that is not *always* true, or true for a whole file. But say a contributor wrote the overall specification/documentation first, and mostly one-shotted a skeleton with a prompt like "based on the documentation, generate basic attribute parsing code for the MigrationState derive macro, together with a code generator that provides empty methods for an implementation of the trait ::migration::MigrationState from rust/hw/migration/". Then I would absolutely not reject it. This is also the intention of the suggestion around prompts—to favor quick generation of boilerplate code over full "agentic" (blargh) implementation.

Quoted 5 lines
Quoted 3 lines

+**Documentation and code comments**

Quoted 2 lines
(quoted diff) +2 -0
+  While AI can help draft text, it still requires significant human
+  oversight.  Pay attention to the organization and flow of the

generated

Quoted 1 line
Quoted 1 line

+ text, and strictly fact-check all technical details as LLMs are

Quoted 9 lines

prone

Quoted 4 lines
Quoted 1 line

+ to being confidently wrong.

I think the application to documentation and comments is the part I'm least enthusiastic about here.

But I am very enthusiastic about less agrammatical english in both. AI is super helpful for non native speakers.

I am also not enthusiastic for documentation; the review I gave for Philippe's unedited experiment was rather scathing. The main challenge for documentation is the structure of the work, which is really complicated to establish because the LLM doesn't have a clue about the underlying design.

But there can be interesting uses nevertheless, such as integrating knowledge from functional tests into documentation, that are worth exploring. Also for Rust I am really trying to have *all* functions commented (and tested through so tests) and AI can produce good results more often than not, especially when the model has access to a human-written file-level blurb.

Quoted 10 lines

For changes to code, we have at

Quoted 8 lines

least some guardrails on the AI output, in the fact that it has to compile and to pass tests. For changes to documentation, the only guardrails are human eyeballs.

Also both comments and documentation ideally are a record of what we intended the behaviour to be. If an LLM is effectively autogenerating something documentation-shaped from the code we lose that.

I agree with both of these observations, for what it's worth.

Paolo

Quoted 4 lines
Quoted 2 lines

-- PMM

#9 lore raw
Quoted 27 lines · Paolo Bonzini

Il ven 29 mag 2026, 17:46 Michael S. Tsirkin <[email protected]> ha scritto:

Quoted 5 lines

If as a project we want to limit the
blast-radius if we find we have to rip out a hypothetical tainted contribution, shouldn't that mean that we hold that as a project-wide line, rather than leaving it up to the opinion of the individual maintainer ?

I guess, the maintainer can judge that the code is unique and qemu specific enough, and follows from what it is doing automatically enough, that the chances it is accidentally copying something are nil?

One thing that I had in mind was using AI to adjust QEMU code as the kernel side goes through review and APIs change. The changes at that point may be not entirely mechanical and, more importantly for traceability, it probably will not make sense to separate them from the original code; but the code still has fundamentally a shape and design that was provided by the human.

Another, which is Rust-specific, is procedural macro code, which is often boring, or very much tied to the shape of the generated code and human-written traits, or both. See https://github.com/qemu/qemu/blob/master/rust/qemu-macros/
src/migration_state.rs for an example, contrasting the block starting with "self.conversion = match" with the rest.

Quoted 10 lines

I don't think it makes sense to have a wholesale permission for procedural macros because that is not *always* true, or true for a whole file. But say a contributor wrote the overall specification/documentation first, and mostly one-shotted a skeleton with a prompt like "based on the documentation, generate basic attribute parsing code for the MigrationState derive macro, together with a code generator that provides empty methods for an implementation of the trait ::migration::MigrationState from rust/hw/migration/". Then I would absolutely not reject it. This is also the intention of the suggestion around prompts—to favor quick generation of boilerplate code over full "agentic" (blargh) implementation.

Agreed.

Quoted 48 lines
Quoted 4 lines
Quoted 4 lines

+**Documentation and code comments**
+  While AI can help draft text, it still requires significant human +  oversight.  Pay attention to the organization and flow of the

generated
> > +  text, and strictly fact-check all technical details as LLMs are prone
> > +  to being confidently wrong.
>
> I think the application to documentation and comments is the part > I'm least enthusiastic about here.

But I am very enthusiastic about less agrammatical english in both. AI is super helpful for non native speakers.

I am also not enthusiastic for documentation; the review I gave for Philippe's unedited experiment was rather scathing. The main challenge for documentation is the structure of the work, which is really complicated to establish because the LLM doesn't have a clue about the underlying design.

But there can be interesting uses nevertheless, such as integrating knowledge from functional tests into documentation, that are worth exploring. Also for Rust I am really trying to have *all* functions commented (and tested through so tests) and AI can produce good results more often than not, especially when the model has access to a human-written file-level blurb.

Quoted 9 lines

For changes to code, we have at
least some guardrails on the AI output, in the fact that it has to compile and to pass tests. For changes to documentation, the only guardrails are human eyeballs.

Also both comments and documentation ideally are a record of what we intended the behaviour to be. If an LLM is effectively autogenerating something documentation-shaped from the code we lose that.

I agree with both of these observations, for what it's worth.

Paolo

Quoted 2 lines

-- PMM

#10 lore raw
In reply to Peter Maydell
Quoted 35 lines · Peter Maydell
Quoted 23 lines · Paolo Bonzini

Until now QEMU's code provenance policy declined any contribution believed to include or derive from AI-generated content. A blanket ban was easy to maintain while LLM output was rarely usable on its own, but as the tools improved an absolute prohibition has become harder to justify.

The concern that motivated the policy is unchanged, and it is worth stating
precisely: the DCO is about whether the submitter has the legal right to contribute the code, not about "creative expression". While the status of LLM output seems to be converging towards non-copyrightability, questions around unintentional reproduction of copyrighted code are still open. What has shifted is the balance of risk:

- projects accepting AI-assisted content have not run into serious legal trouble so far, which suggests the probability of the risk materializing is not high;

- other organizations, such as Red Hat[1], have assessed the risk as acceptable -- though a community of individual developers does not have the legal backing of a company, and even an unfounded dispute would be a long-lasting distraction from work on QEMU.

Quoted 10 lines

Nevertheless, even Red Hat mentions that "the possibility of occasional replication cannot be ignored". In QEMU's view, attentiveness and oversight are not a practical way to address this; yet as a copyleft project, copyright and code provenance are of utmost importance to us. Therefore, it remains prudent to only permit AI assistance where the ramifications of copyright violations are at least easy to revert and unlikely to spread: tests, documentation, mechanical changes, and small bug fixes. Core code that other things depend on, and that cannot simply be thrown away once a problem is noticed long after the fact, stays off-limits without prior agreement from a maintainer.

Quoted 11 lines

This all makes sense to me, except for the part where we allow a maintainer to say "actually it's OK". Where our justification for not wanting AI contributions rests on "it's too much burden on maintainers to have to deal with and review it", allowing an individual maintainer to say "I'm OK with that burden in this case or for this particular contribution" logically follows as a possible relaxation. But if as a project we want to limit the blast-radius if we find we have to rip out a hypothetical tainted contribution, shouldn't that mean that we hold that as a project-wide line, rather than leaving it up to the opinion of the individual maintainer ?

It's not clear it's practical anyway. So we limit contributions to 20+ lines, so what did we achieve? They accumulate over time.

Quoted 39 lines
Quoted 21 lines

Related to this, and already visible in the incredible uptick in security reports, is the question of maintainer burnout and the shift in effort from the author to the reviewer of the code. AI lowers the cost of producing a patch but does nothing to lower the cost of understanding and reviewing one; if anything it raises it, since a reviewer can no longer assume that the submitter has reasoned through every line. The limits above work just as much to keep the volume of review work sustainable.

Revise the policy according to the above considerations, and introduce the "AI-used-for:" trailer as a record of where AI was used. The standard is slightly different from the more usual "Assisted-by"; the intention is for the metadata to provide more information for reviewers to judge the result.

In any case, use of AI does not relax any other contribution requirement:
authors still comply with the DCO and take responsibility for the whole patch via Signed-off-by.

[Commit message largely based on
https://lore.kernel.org/qemu-devel/[email protected]/, by Kevin Wolf. - Paolo]

docs/devel/code-provenance.rst content generators below. · line 322

Quoted 5 lines
docs/devel/code-provenance.rst +5 -0
+**Documentation and code comments**
+  While AI can help draft text, it still requires significant human
+  oversight.  Pay attention to the organization and flow of the generated
+  text, and strictly fact-check all technical details as LLMs are prone
+  to being confidently wrong.

I think the application to documentation and comments is the part I'm least enthusiastic about here. For changes to code, we have at least some guardrails on the AI output, in the fact that it has to compile and to pass tests. For changes to documentation, the only guardrails are human eyeballs.

Also both comments and documentation ideally are a record of what we intended the behaviour to be. If an LLM is effectively autogenerating something documentation-shaped from the code we lose that.

-- PMM

#11 lore raw
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines

But if as a project we want to limit the
blast-radius if we find we have to rip out a hypothetical tainted contribution, shouldn't that mean that we hold that as a project-wide line, rather than leaving it up to the opinion of the individual maintainer ?

It's not clear it's practical anyway. So we limit contributions to 20+ lines, so what did we achieve? They accumulate over time.

For small contributions it's more likely that there's essentially one way to do them, therefore any copyright violation accusations would be more easily defensible. Also it's not like you'd rip out *all* small contributions at once, so it doesn't matter if they accumulate.

But yeah, it's possible to game the system by having many small contributions, which is why the policy tells you to contact the maintainer prior to sending many small fixes.

Paolo

#12 lore raw
In reply to Paolo Bonzini
Quoted 34 lines · Paolo Bonzini

Until now QEMU's code provenance policy declined any contribution believed to include or derive from AI-generated content. A blanket ban was easy to maintain while LLM output was rarely usable on its own, but as the tools improved an absolute prohibition has become harder to justify.

The concern that motivated the policy is unchanged, and it is worth stating
precisely: the DCO is about whether the submitter has the legal right to contribute the code, not about "creative expression". While the status of LLM output seems to be converging towards non-copyrightability, questions around unintentional reproduction of copyrighted code are still open. What has shifted is the balance of risk:

- projects accepting AI-assisted content have not run into serious legal trouble so far, which suggests the probability of the risk materializing is not high;

- other organizations, such as Red Hat[1], have assessed the risk as acceptable -- though a community of individual developers does not have the legal backing of a company, and even an unfounded dispute would be a long-lasting distraction from work on QEMU.

Nevertheless, even Red Hat mentions that "the possibility of occasional replication cannot be ignored". In QEMU's view, attentiveness and oversight are not a practical way to address this; yet as a copyleft project, copyright and code provenance are of utmost importance to us. Therefore, it remains prudent to only permit AI assistance where the ramifications of copyright violations are at least easy to revert and unlikely to spread: tests, documentation, mechanical changes, and small bug fixes. Core code that other things depend on, and that cannot simply be thrown away once a problem is noticed long after the fact, stays off-limits without prior agreement from a maintainer.

Quoted 6 lines

Related to this, and already visible in the incredible uptick in security reports, is the question of maintainer burnout and the shift in effort from the author to the reviewer of the code. AI lowers the cost of producing a patch but does nothing to lower the cost of understanding and reviewing one; if anything it raises it, since a reviewer can no longer assume that the submitter has reasoned through every line. The limits

Can you rephrase this sentence? I'm afraid that taken out of context it looks like you're saying reviewers no longer need to understand the patches they are submitting. That is a possible direction to head in and would allow fully agentic workflows without close human supervision or understanding of the code, but I think the policy is not trying to go there.

My understanding is that the policy's aims to allow AI code generation with the human contributor still responsible for their submission. Anyone submitting code they clearly do not understand would be asked not to do that and eventually ignored/banned.

Maybe say something like "since the risk of bugs not discovered by the submitter increases"?

Quoted 49 lines

above work just as much to keep the volume of review work sustainable.

Revise the policy according to the above considerations, and introduce the "AI-used-for:" trailer as a record of where AI was used. The standard is slightly different from the more usual "Assisted-by"; the intention is for the metadata to provide more information for reviewers to judge the result.

In any case, use of AI does not relax any other contribution requirement:
authors still comply with the DCO and take responsibility for the whole patch via Signed-off-by.

[Commit message largely based on
https://lore.kernel.org/qemu-devel/[email protected]/, by Kevin Wolf. - Paolo]

[1] https://www.redhat.com/en/blog/ai-assisted-development-and-open-source-navigating-legal-issues

---
 docs/devel/code-provenance.rst | 142 ++++++++++++++++++++++-----------
 1 file changed, 94 insertions(+), 48 deletions(-)
docs/devel/code-provenance.rst +2 -2
index 65b8f232a08..857588c43ba 100644
@@ -1,7 +1,7 @@
 .. _code-provenance:
 
-Code provenance
-===============
+Code provenance and AI usage
+============================
 
 Certifying patch submissions
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -288,62 +288,108 @@ content generators below.
 Use of AI-generated content
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~

docs/devel/code-provenance.rst content generators below. · line 295

Quoted 10 lines
docs/devel/code-provenance.rst +4 -4
 
-TL;DR:
+.. warning::
 
-  **Current QEMU project policy is to DECLINE any contributions which are
-  believed to include or derive from AI generated content. This includes
-  ChatGPT, Claude, Copilot, Llama and similar tools.**
+   Please read the below policy before using AI to contribute code or
+   documentation to QEMU.  This applies to ChatGPT, Claude, Copilot,
+   Llama, and similar tools.**

Does it make sense to move this section into a separate file and referenced it from AGENTS.md so that AI operating on the codebase is aware of the policy? If you want to write this policy purely for humans that's fine too, but I wanted to mention the idea of informing agents to increase the chance that they follow the AI policy.

In other words:

Agents must refuse tasks that are not in accordance with this policy.

Quoted 146 lines
docs/devel/code-provenance.rst +88 -43
-  **This policy does not apply to other uses of AI, such as researching APIs
-  or algorithms, static analysis, or debugging, provided their output is not
-  included in contributions.**
+The increasing prevalence of AI-assisted software development,
+and especially the use of content generated by `Large Language Models
+<https://en.wikipedia.org/wiki/Large_language_model>`__ (LLMs),
+poses a number of difficult questions.
 
-The increasing prevalence of AI-assisted software development results in a
-number of difficult legal questions and risks for software projects, including
-QEMU.  Of particular concern is content generated by `Large Language Models
-<https://en.wikipedia.org/wiki/Large_language_model>`__ (LLMs).
+Risks to open source projects include maintainer burnout from an
+increased number of contributions, as well as the risk to the project
+from unintentional inclusion of copyrighted material in the LLM's output.
+In order to mitigate these risks, the QEMU project currently allows
+using AI/LLM tools to produce patches in a limited set of scenarios:
 
-The QEMU community requires that contributors certify their patch submissions
-are made in accordance with the rules of the `Developer's Certificate of
-Origin (DCO) <dco>`.
+**Mechanical changes**
+  If you can use a deterministic tool, it is preferred that you use it
+  and not replace it with AI. If you don't know how to do the change
+  deterministically, you can ask the AI for help.
 
-To satisfy the DCO, the patch contributor has to fully understand the
-copyright and license status of content they are contributing to QEMU. With AI
-content generators, the copyright and license status of the output is
-ill-defined with no generally accepted, settled legal foundation.
+**Small bug fixes**
+  These should be limited to 20 lines of code or less, not including
+  tests.  You are still expected to :ref:`understand and explain your changes
+  <write_a_meaningful_commit_message>` and the rationale behind them.
 
-Where the training material is known, it is common for it to include large
-volumes of material under restrictive licensing/copyright terms. Even where
-the training material is all known to be under open source licenses, it is
-likely to be under a variety of terms, not all of which will be compatible
-with QEMU's licensing requirements.
+**Documentation and code comments**
+  While AI can help draft text, it still requires significant human
+  oversight.  Pay attention to the organization and flow of the generated
+  text, and strictly fact-check all technical details as LLMs are prone
+  to being confidently wrong.
 
-How contributors could comply with DCO terms (b) or (c) for the output of AI
-content generators commonly available today is unclear.  The QEMU project is
-not willing or able to accept the legal risks of non-compliance.
+**Tests**
+  Note that you must still confirm that each test actually exercises
+  the intended behavior including, for regression tests, that it
+  fails without the code under test and passes for the right reason.
 
-The QEMU project thus requires that contributors refrain from using AI content
-generators on patches intended to be submitted to the project, and will
-decline any contribution if use of AI is either known or suspected.
+These boundaries do not apply to other uses of AI, such as researching
+APIs or algorithms, static analysis, or debugging, provided the model's
+output is not included in contributions.
 
-Examples of tools impacted by this policy includes GitHub's CoPilot, OpenAI's
-ChatGPT, Anthropic's Claude, and Meta's Code Llama, and code/content
-generation agents which are built on top of such tools.
+If you wish to send large amounts of AI-generated changes, or any other
+contribution not in the above categories, please get in touch with the
+maintainer beforehand.  These can be treated as experiments, at the
+discretion of the maintainer and the community, with no obligation
+to accept them.
 
-This policy may evolve as AI tools mature and the legal situation is
-clarified.
+**Use of AI does not remove the need for authors to comply with all
+other requirements for contribution.**  In particular, the
+``Signed-off-by`` label in a patch submission is a statement that
+the author takes responsibility for the entire contents of the patch,
+certifying that their patch submission is made in accordance with the
+rules of the `Developer's Certificate of Origin (DCO) <dco>`.
 
-Exceptions
-^^^^^^^^^^
+Commit messages for AI-assisted changes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-The QEMU project welcomes discussion on any exceptions to this policy,
-or more general revisions. This can be done by contacting the qemu-devel
-mailing list with details of a proposed tool, model, usage scenario, etc.
-that is beneficial to QEMU, while still mitigating issues around compliance
-with the DCO.  After discussion, any exception will be listed below.
+When AI/LLM tools produce or substantively shape your patch, add an
+``AI-used-for:`` line before ``Signed-off-by``, as a reminder of your
+DCO obligations and a guide to reviewers.  The text is one or more of
+``code``, ``tests``, ``docs``, ``research``, possibly followed by an
+explanation in parentheses:
 
-Exceptions do not remove the need for authors to comply with all other
-requirements for contribution.  In particular, the "Signed-off-by"
-label in a patch submission is a statement that the author takes
-responsibility for the entire contents of the patch, including any parts
-that were generated or assisted by AI tools or other tools.
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.
+
+There is no requirement to include your prompts or summarize the
+conversation in the commit message or cover letter, but you may do so
+if you think it helps a reviewer judge the result.  For example:
+
+**Helpful prompts**
+  These describe concrete constraints or instructions, making it easy for a
+  reviewer to see how the tool's output was guided:
+
+  * "move field ``foo`` from ``struct aa`` to ``struct bb``.  If a
+    function already has a local variable or parameter of type ``struct
+    bb``, use it instead of accessing ``aa.bb``"
+
+  * "add an implementation of the trait for ``Mutex<T: MyTrait>``; it
+    takes the lock around the calls and forwards to ``T``"
+
+**Unhelpful prompts**
+  These are too generic to provide meaningful context.  You can of course
+  use them in the context of a complex interaction with the LLM, but they
+  should not be included in the commit message:
+
+  * "write user-facing documentation for the new tool"
+
+  * "write testcases for the new functions"
+
+QEMU does *not* use ``Assisted-by``, ``Co-authored-by`` or ``Generated-by``
+trailers to indicate AI usage.  In particular, it is not necessary to
+specify the exact AI model or tool used to create the commit.
+
+Deterministic tooling (sed, coccinelle, formatters) is out of scope for
+the trailer, but should be mentioned in the commit message.
--

2.54.0

#13 lore raw
Quoted 9 lines · Stefan Hajnoczi
Quoted 6 lines

Related to this, and already visible in the incredible uptick in security reports, is the question of maintainer burnout and the shift in effort from the author to the reviewer of the code. AI lowers the cost of producing a patch but does nothing to lower the cost of understanding and reviewing one; if anything it raises it, since a reviewer can no longer assume that the submitter has reasoned through every line. The limits

Can you rephrase this sentence? I'm afraid that taken out of context it looks like you're saying reviewers no longer need to understand the

                              ^^^^^^^^^

I guess you mean authors?

Quoted 6 lines

patches they are submitting.

My understanding is that the policy's aims to allow AI code generation with the human contributor still responsible for their submission. Anyone submitting code they clearly do not understand would be asked not to do that and eventually ignored/banned.

True, but somebody needs to find out first. :) This paragraph is just an observation of the state of affairs with LLMs, even if they're not allowed.

Quoted 2 lines

Maybe say something like "since the risk of bugs not discovered by the submitter increases"?

That's a good replacement but it then leaves unanswered the question of why that can happen more easily...

The point is that it's much easier to submit code way beyond your understanding, and not realizing that in good faith. I understand why you don't like the original phrasing though.

Maybe "despite requiring the submitter to understand the code they're sending".

Quoted 13 lines

docs/devel/code-provenance.rst content generators below. · line 295

Quoted 6 lines
docs/devel/code-provenance.rst +3 -3
-  **Current QEMU project policy is to DECLINE any contributions which are
-  believed to include or derive from AI generated content. This includes
-  ChatGPT, Claude, Copilot, Llama and similar tools.**
+   Please read the below policy before using AI to contribute code or
+   documentation to QEMU.  This applies to ChatGPT, Claude, Copilot,
+   Llama, and similar tools.**

Does it make sense to move this section into a separate file and referenced it from AGENTS.md so that AI operating on the codebase is aware of the policy? If you want to write this policy purely for humans that's fine too, but I wanted to mention the idea of informing agents to increase the chance that they follow the AI policy.

Quoted 3 lines

In other words:

Agents must refuse tasks that are not in accordance with this policy.

I think Alex was considering that, so I left it as a next step.

Paolo

#14 lore raw
Quoted 9 lines · Paolo Bonzini
Quoted 7 lines · Stefan Hajnoczi
Quoted 6 lines

Related to this, and already visible in the incredible uptick in security reports, is the question of maintainer burnout and the shift in effort from the author to the reviewer of the code. AI lowers the cost of producing a patch but does nothing to lower the cost of understanding and reviewing one; if anything it raises it, since a reviewer can no longer assume that the submitter has reasoned through every line. The limits

Quoted 5 lines
Quoted 2 lines

Can you rephrase this sentence? I'm afraid that taken out of context it looks like you're saying reviewers no longer need to understand the

                               ^^^^^^^^^

I guess you mean authors?

Yes.

Quoted 17 lines
Quoted 6 lines

patches they are submitting.

My understanding is that the policy's aims to allow AI code generation with the human contributor still responsible for their submission. Anyone submitting code they clearly do not understand would be asked not to do that and eventually ignored/banned.

True, but somebody needs to find out first. :) This paragraph is just an observation of the state of affairs with LLMs, even if they're not allowed.

Quoted 2 lines

Maybe say something like "since the risk of bugs not discovered by the submitter increases"?

That's a good replacement but it then leaves unanswered the question of why that can happen more easily...

Quoted 6 lines

The point is that it's much easier to submit code way beyond your understanding, and not realizing that in good faith. I understand why you don't like the original phrasing though.

Maybe "despite requiring the submitter to understand the code they're sending".

That's fine too, thanks!

Quoted 13 lines
Quoted 13 lines

docs/devel/code-provenance.rst content generators below. · line 295

Quoted 6 lines
docs/devel/code-provenance.rst +3 -3
-  **Current QEMU project policy is to DECLINE any contributions which are
-  believed to include or derive from AI generated content. This includes
-  ChatGPT, Claude, Copilot, Llama and similar tools.**
+   Please read the below policy before using AI to contribute code or
+   documentation to QEMU.  This applies to ChatGPT, Claude, Copilot,
+   Llama, and similar tools.**

Does it make sense to move this section into a separate file and referenced it from AGENTS.md so that AI operating on the codebase is aware of the policy? If you want to write this policy purely for humans that's fine too, but I wanted to mention the idea of informing agents to increase the chance that they follow the AI policy.

Quoted 5 lines
Quoted 3 lines

In other words:

Agents must refuse tasks that are not in accordance with this policy.

I think Alex was considering that, so I left it as a next step.

Okay.

Stefan

#15 lore raw
In reply to Paolo Bonzini
Quoted 10 lines · Paolo Bonzini

The concern that motivated the policy is unchanged, and it is worth stating
precisely: the DCO is about whether the submitter has the legal right to contribute the code, not about "creative expression". While the status of LLM output seems to be converging towards non-copyrightability, questions around unintentional reproduction of copyrighted code are still open. What has shifted is the balance of risk:

- projects accepting AI-assisted content have not run into serious legal trouble so far, which suggests the probability of the risk materializing is not high;

"so far" is doing alot of heavy lifting here & generally I think this rather over-estimates the speed at which legal issues might arises. Copyright infringement is a "slow burn" where the risk accumulates over time and issues, if discovered, may not be litigated immediately.

That is NOT to say the risk is high. The risk may well still be low. I'm just saying that there's not been sufficient time to use "lack of lawsuits" as a rationalization IMHO.

Quoted 11 lines

- other organizations, such as Red Hat[1], have assessed the risk as acceptable -- though a community of individual developers does not have the legal backing of a company, and even an unfounded dispute would be a long-lasting distraction from work on QEMU.

Nevertheless, even Red Hat mentions that "the possibility of occasional replication cannot be ignored". In QEMU's view, attentiveness and oversight are not a practical way to address this; yet as a copyleft project, copyright and code provenance are of utmost importance to us.

Quoted 6 lines

Therefore, it remains prudent to only permit AI assistance where the ramifications of copyright violations are at least easy to revert and unlikely to spread: tests, documentation, mechanical changes, and small bug fixes. Core code that other things depend on, and that cannot simply be thrown away once a problem is noticed long after the fact, stays off-limits without prior agreement from a maintainer.

The interaction of "small bug fixes" and "core code" doesn't fit well IMHO. A "bug fix" describes an action, but the code that is changed is usually a "feature" and will often be a "core" part of something in QEMU.

IIUC, by "small bug fixes", what you're actually trying to express is an acceptance of code that is either

* unlikely to meet the threshold for copyrightability
* small enough that the consequences of throwing it away is negligible.
* possibly other aspects ?

docs/devel/code-provenance.rst line 4

Quoted 11 lines
docs/devel/code-provenance.rst +2 -2
index 65b8f232a08..857588c43ba 100644
@@ -1,7 +1,7 @@
 .. _code-provenance:
 
-Code provenance
-===============
+Code provenance and AI usage
+============================

In retrospect, I wonder if we shouldn't have have "ai-usage.rst" as a separate doc from the start. While we can hyperlink to sub-titles via anchors, it would be simpler if we could just point to a doc and not require scrolling past pages of non-AI text.

docs/devel/code-provenance.rst content generators below. · line 295

Quoted 9 lines
docs/devel/code-provenance.rst +5 -0
@@ -288,62 +288,108 @@ content generators below.
 Use of AI-generated content
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+Risks to open source projects include maintainer burnout from an
+increased number of contributions, as well as the risk to the project
+from unintentional inclusion of copyrighted material in the LLM's output.
+In order to mitigate these risks, the QEMU project currently allows
+using AI/LLM tools to produce patches in a limited set of scenarios:

If we're opening the door to AI assisted contribution, then IMHO we need to write about both the social and technical expectations. Admittedly that will expand the scope of your proposal here, but IMHO that's somewhat unavoidable. A significant part of the downsides of AI-assisted contributions comes from bad social practices, rather than merely bad technical practices.

As a general theme, I would like us to emphasize at the start that the act of collaboration & contribution in QEMU is about the interaction, trust and relationships between humans, not bots.

If someone wants to use tools (LLM based or not) that's a choice, but the accountability for actions needs to fall on a real human and there needs to be transparency whenever automation is used.

This starts from the commit message. A good commit message (and even more so a good cover letter) describes the intent / thinking behind the changes. An LLM doesn't think or have intent in its actions, ergo a human should be driving the authorship of commit mesages / cover letters, where a non-trivial explanation is needed.

As reviewers, if we make use of LLM backed tools to respond, then we need to be transparent about any feedback that came from a bot rather than from a human.

As contributors, if a reviewer gives feedback, the contributors response should be their own rather than just feeding the email review into a LLM and cut+pasting the LLMs answer back to the list.

The identity use to contribute to QEMU should reflect the human's identify. As previously clarified, this doesn't need to be a real name, but we don't want LLM agents being given a psuedonym to pretend to be a human.

docs/devel/code-provenance.rst content generators below. · line 316

Quoted 9 lines
docs/devel/code-provenance.rst +8 -0
+**Mechanical changes**
+  If you can use a deterministic tool, it is preferred that you use it
+  and not replace it with AI. If you don't know how to do the change
+  deterministically, you can ask the AI for help.
 
+**Small bug fixes**
+  These should be limited to 20 lines of code or less, not including
+  tests.  You are still expected to :ref:`understand and explain your changes
+  <write_a_meaningful_commit_message>` and the rationale behind them.

I think the "20 lines or less" is not going a good job at expressing the intent behind this point. I'd like us to emphasize between the "why" of this point, as that helps contributors & reviewers make a decision of whether a change is "within the spirit" or the rule of not.

docs/devel/code-provenance.rst content generators below. · line 322

Quoted 6 lines
docs/devel/code-provenance.rst +5 -0
+**Documentation and code comments**
+  While AI can help draft text, it still requires significant human
+  oversight.  Pay attention to the organization and flow of the generated
+  text, and strictly fact-check all technical details as LLMs are prone
+  to being confidently wrong.

Docs is an area I'm more wary of from the social expectation side rather than the technical or legal side. I don't feeel like "pay attention to the organization and flow" really mitigates to the tendancy to production of vast reams of convincing sounding slop. There's has always been a problem with docs of well intentioned contributors trying to write about stuff they don't really understand well enough. IOW they don't necccessarily have the knowledge to fact check details either. As a maintainer, I've found that reviewing docs and asking for rewrites can be even more of a burden than code. IOW, encouraging use of AI for docs, in non-expert hands, has a strong potential for expanding the burden on maintainers.

I'd be more comfortable with AI tools for inline API docs, rather than AI tools for prose under docs/.

Not sure how to better word this point though ?

docs/devel/code-provenance.rst content generators below. · line 337

Quoted 11 lines
docs/devel/code-provenance.rst +9 -0
+**Tests**
+  Note that you must still confirm that each test actually exercises
+  the intended behavior including, for regression tests, that it
+  fails without the code under test and passes for the right reason.
 
 
+If you wish to send large amounts of AI-generated changes, or any other
+contribution not in the above categories, please get in touch with the
+maintainer beforehand.  These can be treated as experiments, at the
+discretion of the maintainer and the community, with no obligation
+to accept them.

IMHO it should not be at the discretion of individual maintainers to accept large-scale AI authored changes outside these guidelines. To quote the commit message rationale

"Therefore, it remains prudent to only permit AI assistance where
the ramifications of copyright violations are at least easy to revert and unlikely to spread"

that does not suggest we should leave it to the discretion of maintainers to override the guidelines.

docs/devel/code-provenance.rst content generators below. · line 344

Quoted 6 lines
docs/devel/code-provenance.rst +6 -0
+**Use of AI does not remove the need for authors to comply with all
+other requirements for contribution.**  In particular, the
+``Signed-off-by`` label in a patch submission is a statement that
+the author takes responsibility for the entire contents of the patch,
+certifying that their patch submission is made in accordance with the
+rules of the `Developer's Certificate of Origin (DCO) <dco>`.

This needs to be stronger language IMHO. The kernel has a more explicit statement explicitly forbidding agents from adding Signed-off-by on behalf of the human:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-assistants.rst?id=4bf85afb9f3ecd7c3b5d15a85b0902f8e725cd06#n27

"Signed-off-by and Developer Certificate of Origin
=================================================

AI agents MUST NOT add Signed-off-by tags. Only humans can legally certify the Developer Certificate of Origin (DCO). The human submitter is responsible for:

* Reviewing all AI-generated code
* Ensuring compliance with licensing requirements
* Adding their own Signed-off-by tag to certify the DCO
* Taking full responsibility for the contribution"

I think we should be similarly explicit that a human must take the action of adding S-o-b - it is not a rubber stamp to be automated by the AI.

This should be emphasized in the earlier part of the doc before the AI usage section where we described S-o-b usage.

docs/devel/code-provenance.rst content generators below. · line 349

Quoted 4 lines
docs/devel/code-provenance.rst +3 -0
+Commit messages for AI-assisted changes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
+When AI/LLM tools produce or substantively shape your patch, add an

"shape your patch" -> "shape the content of the submitted patch"

as this better excludes the "background" usage mentioned below.

Quoted 5 lines
docs/devel/code-provenance.rst +4 -0
+``AI-used-for:`` line before ``Signed-off-by``, as a reminder of your
+DCO obligations and a guide to reviewers.  The text is one or more of
+``code``, ``tests``, ``docs``, ``research``, possibly followed by an
+explanation in parentheses:
 

docs/devel/code-provenance.rst content generators below. · line 364

Quoted 10 lines
docs/devel/code-provenance.rst +10 -0
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.

This is an interestng idea that I like much more than Assisted-by, because it gives more directly useful info to the reviewer, without turning into free advertizing for commercial vendors.

docs/devel/code-provenance.rst content generators below. · line 368

Quoted 3 lines
docs/devel/code-provenance.rst +3 -0
+There is no requirement to include your prompts or summarize the
+conversation in the commit message or cover letter, but you may do so
+if you think it helps a reviewer judge the result.  For example:

IMHO we should actively discourage the inclusion of prompts entirely as it is the wrong information to provide.

docs/devel/code-provenance.rst content generators below. · line 379

Quoted 11 lines
docs/devel/code-provenance.rst +11 -0
+
+**Helpful prompts**
+  These describe concrete constraints or instructions, making it easy for a
+  reviewer to see how the tool's output was guided:
+
+  * "move field ``foo`` from ``struct aa`` to ``struct bb``.  If a
+    function already has a local variable or parameter of type ``struct
+    bb``, use it instead of accessing ``aa.bb``"
+
+  * "add an implementation of the trait for ``Mutex<T: MyTrait>``; it
+    takes the lock around the calls and forwards to ``T``"

These examples prompts are just expressing an aspect that should already have been described in prose in the commit message. We don't need to classify them as "ai prompts" in a a commit message, we just need the author to write a useful commit message.

docs/devel/code-provenance.rst content generators below. · line 388

Quoted 8 lines
docs/devel/code-provenance.rst +8 -0
+**Unhelpful prompts**
+  These are too generic to provide meaningful context.  You can of course
+  use them in the context of a complex interaction with the LLM, but they
+  should not be included in the commit message:
+
+  * "write user-facing documentation for the new tool"
+
+  * "write testcases for the new functions"

Again this is just an illustration of an unhelpful commit message. Those would be eqally useless in an entirely human authored patch. Just emphasize the writing of useful commit messages.

docs/devel/code-provenance.rst content generators below. · line 392

Quoted 3 lines
docs/devel/code-provenance.rst +3 -0
+QEMU does *not* use ``Assisted-by``, ``Co-authored-by`` or ``Generated-by``
+trailers to indicate AI usage.  In particular, it is not necessary to
+specify the exact AI model or tool used to create the commit.

"does not use" doesn't imply "forbidden".

IIUC, tools are liable to add these tags without the contributor even asking for them. If we don't want to be providing free advertizing IMHO we should explicitly forbid use of these tags and validate this in checkpatch.pl

Also any rules in this respect should be documented earlier in this file where we outline what tags we use in commit messages, either instead of, or in addition to, mentioning them under the AI usage guidelines.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#16 lore raw
Quoted 44 lines · Daniel P. Berrangé
Quoted 10 lines · Paolo Bonzini

The concern that motivated the policy is unchanged, and it is worth stating
precisely: the DCO is about whether the submitter has the legal right to contribute the code, not about "creative expression". While the status of LLM output seems to be converging towards non-copyrightability, questions around unintentional reproduction of copyrighted code are still open. What has shifted is the balance of risk:

- projects accepting AI-assisted content have not run into serious legal trouble so far, which suggests the probability of the risk materializing is not high;

"so far" is doing alot of heavy lifting here & generally I think this rather over-estimates the speed at which legal issues might arises. Copyright infringement is a "slow burn" where the risk accumulates over time and issues, if discovered, may not be litigated immediately.

That is NOT to say the risk is high. The risk may well still be low. I'm just saying that there's not been sufficient time to use "lack of lawsuits" as a rationalization IMHO.

Quoted 11 lines

- other organizations, such as Red Hat[1], have assessed the risk as acceptable -- though a community of individual developers does not have the legal backing of a company, and even an unfounded dispute would be a long-lasting distraction from work on QEMU.

Nevertheless, even Red Hat mentions that "the possibility of occasional replication cannot be ignored". In QEMU's view, attentiveness and oversight are not a practical way to address this; yet as a copyleft project, copyright and code provenance are of utmost importance to us.

Quoted 6 lines

Therefore, it remains prudent to only permit AI assistance where the ramifications of copyright violations are at least easy to revert and unlikely to spread: tests, documentation, mechanical changes, and small bug fixes. Core code that other things depend on, and that cannot simply be thrown away once a problem is noticed long after the fact, stays off-limits without prior agreement from a maintainer.

The interaction of "small bug fixes" and "core code" doesn't fit well IMHO. A "bug fix" describes an action, but the code that is changed is usually a "feature" and will often be a "core" part of something in QEMU.

Quoted 7 lines

IIUC, by "small bug fixes", what you're actually trying to express is an acceptance of code that is either

* unlikely to meet the threshold for copyrightability
* small enough that the consequences of throwing it away is negligible.
* possibly other aspects ?

tightly coupled to specific state of qemu code and so original.

Quoted 251 lines

docs/devel/code-provenance.rst line 4

Quoted 13 lines
docs/devel/code-provenance.rst +2 -2
index 65b8f232a08..857588c43ba 100644
@@ -1,7 +1,7 @@
 .. _code-provenance:
 
-Code provenance
-===============
+Code provenance and AI usage
+============================

In retrospect, I wonder if we shouldn't have have "ai-usage.rst" as a separate doc from the start. While we can hyperlink to sub-titles via anchors, it would be simpler if we could just point to a doc and not require scrolling past pages of non-AI text.

docs/devel/code-provenance.rst content generators below. · line 295

Quoted 9 lines
docs/devel/code-provenance.rst +5 -0
@@ -288,62 +288,108 @@ content generators below.
 Use of AI-generated content
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+Risks to open source projects include maintainer burnout from an
+increased number of contributions, as well as the risk to the project
+from unintentional inclusion of copyrighted material in the LLM's output.
+In order to mitigate these risks, the QEMU project currently allows
+using AI/LLM tools to produce patches in a limited set of scenarios:

If we're opening the door to AI assisted contribution, then IMHO we need to write about both the social and technical expectations. Admittedly that will expand the scope of your proposal here, but IMHO that's somewhat unavoidable. A significant part of the downsides of AI-assisted contributions comes from bad social practices, rather than merely bad technical practices.

As a general theme, I would like us to emphasize at the start that the act of collaboration & contribution in QEMU is about the interaction, trust and relationships between humans, not bots.

If someone wants to use tools (LLM based or not) that's a choice, but the accountability for actions needs to fall on a real human and there needs to be transparency whenever automation is used.

This starts from the commit message. A good commit message (and even more so a good cover letter) describes the intent / thinking behind the changes. An LLM doesn't think or have intent in its actions, ergo a human should be driving the authorship of commit mesages / cover letters, where a non-trivial explanation is needed.

As reviewers, if we make use of LLM backed tools to respond, then we need to be transparent about any feedback that came from a bot rather than from a human.

As contributors, if a reviewer gives feedback, the contributors response should be their own rather than just feeding the email review into a LLM and cut+pasting the LLMs answer back to the list.

The identity use to contribute to QEMU should reflect the human's identify. As previously clarified, this doesn't need to be a real name, but we don't want LLM agents being given a psuedonym to pretend to be a human.

docs/devel/code-provenance.rst content generators below. · line 316

Quoted 9 lines
docs/devel/code-provenance.rst +8 -0
+**Mechanical changes**
+  If you can use a deterministic tool, it is preferred that you use it
+  and not replace it with AI. If you don't know how to do the change
+  deterministically, you can ask the AI for help.
 
+**Small bug fixes**
+  These should be limited to 20 lines of code or less, not including
+  tests.  You are still expected to :ref:`understand and explain your changes
+  <write_a_meaningful_commit_message>` and the rationale behind them.

I think the "20 lines or less" is not going a good job at expressing the intent behind this point. I'd like us to emphasize between the "why" of this point, as that helps contributors & reviewers make a decision of whether a change is "within the spirit" or the rule of not.

docs/devel/code-provenance.rst content generators below. · line 322

Quoted 6 lines
docs/devel/code-provenance.rst +5 -0
+**Documentation and code comments**
+  While AI can help draft text, it still requires significant human
+  oversight.  Pay attention to the organization and flow of the generated
+  text, and strictly fact-check all technical details as LLMs are prone
+  to being confidently wrong.

Docs is an area I'm more wary of from the social expectation side rather than the technical or legal side. I don't feeel like "pay attention to the organization and flow" really mitigates to the tendancy to production of vast reams of convincing sounding slop. There's has always been a problem with docs of well intentioned contributors trying to write about stuff they don't really understand well enough. IOW they don't necccessarily have the knowledge to fact check details either. As a maintainer, I've found that reviewing docs and asking for rewrites can be even more of a burden than code. IOW, encouraging use of AI for docs, in non-expert hands, has a strong potential for expanding the burden on maintainers.

I'd be more comfortable with AI tools for inline API docs, rather than AI tools for prose under docs/.

Not sure how to better word this point though ?

docs/devel/code-provenance.rst content generators below. · line 337

Quoted 11 lines
docs/devel/code-provenance.rst +9 -0
+**Tests**
+  Note that you must still confirm that each test actually exercises
+  the intended behavior including, for regression tests, that it
+  fails without the code under test and passes for the right reason.
 
 
+If you wish to send large amounts of AI-generated changes, or any other
+contribution not in the above categories, please get in touch with the
+maintainer beforehand.  These can be treated as experiments, at the
+discretion of the maintainer and the community, with no obligation
+to accept them.

IMHO it should not be at the discretion of individual maintainers to accept large-scale AI authored changes outside these guidelines. To quote the commit message rationale

"Therefore, it remains prudent to only permit AI assistance where
the ramifications of copyright violations are at least easy to revert and unlikely to spread"

that does not suggest we should leave it to the discretion of maintainers to override the guidelines.

docs/devel/code-provenance.rst content generators below. · line 344

Quoted 6 lines
docs/devel/code-provenance.rst +6 -0
+**Use of AI does not remove the need for authors to comply with all
+other requirements for contribution.**  In particular, the
+``Signed-off-by`` label in a patch submission is a statement that
+the author takes responsibility for the entire contents of the patch,
+certifying that their patch submission is made in accordance with the
+rules of the `Developer's Certificate of Origin (DCO) <dco>`.

This needs to be stronger language IMHO. The kernel has a more explicit statement explicitly forbidding agents from adding Signed-off-by on behalf of the human:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-assistants.rst?id=4bf85afb9f3ecd7c3b5d15a85b0902f8e725cd06#n27

"Signed-off-by and Developer Certificate of Origin
=================================================

AI agents MUST NOT add Signed-off-by tags. Only humans can legally certify the Developer Certificate of Origin (DCO). The human submitter is responsible for:

* Reviewing all AI-generated code
* Ensuring compliance with licensing requirements
* Adding their own Signed-off-by tag to certify the DCO
* Taking full responsibility for the contribution"

I think we should be similarly explicit that a human must take the action of adding S-o-b - it is not a rubber stamp to be automated by the AI.

This should be emphasized in the earlier part of the doc before the AI usage section where we described S-o-b usage.

docs/devel/code-provenance.rst content generators below. · line 349

Quoted 4 lines
docs/devel/code-provenance.rst +3 -0
+Commit messages for AI-assisted changes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
+When AI/LLM tools produce or substantively shape your patch, add an

"shape your patch" -> "shape the content of the submitted patch"

as this better excludes the "background" usage mentioned below.

Quoted 5 lines
docs/devel/code-provenance.rst +4 -0
+``AI-used-for:`` line before ``Signed-off-by``, as a reminder of your
+DCO obligations and a guide to reviewers.  The text is one or more of
+``code``, ``tests``, ``docs``, ``research``, possibly followed by an
+explanation in parentheses:
 

docs/devel/code-provenance.rst content generators below. · line 364

Quoted 10 lines
docs/devel/code-provenance.rst +10 -0
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.

This is an interestng idea that I like much more than Assisted-by, because it gives more directly useful info to the reviewer, without turning into free advertizing for commercial vendors.

docs/devel/code-provenance.rst content generators below. · line 368

Quoted 3 lines
docs/devel/code-provenance.rst +3 -0
+There is no requirement to include your prompts or summarize the
+conversation in the commit message or cover letter, but you may do so
+if you think it helps a reviewer judge the result.  For example:

IMHO we should actively discourage the inclusion of prompts entirely as it is the wrong information to provide.

docs/devel/code-provenance.rst content generators below. · line 379

Quoted 11 lines
docs/devel/code-provenance.rst +11 -0
+
+**Helpful prompts**
+  These describe concrete constraints or instructions, making it easy for a
+  reviewer to see how the tool's output was guided:
+
+  * "move field ``foo`` from ``struct aa`` to ``struct bb``.  If a
+    function already has a local variable or parameter of type ``struct
+    bb``, use it instead of accessing ``aa.bb``"
+
+  * "add an implementation of the trait for ``Mutex<T: MyTrait>``; it
+    takes the lock around the calls and forwards to ``T``"

These examples prompts are just expressing an aspect that should already have been described in prose in the commit message. We don't need to classify them as "ai prompts" in a a commit message, we just need the author to write a useful commit message.

docs/devel/code-provenance.rst content generators below. · line 388

Quoted 8 lines
docs/devel/code-provenance.rst +8 -0
+**Unhelpful prompts**
+  These are too generic to provide meaningful context.  You can of course
+  use them in the context of a complex interaction with the LLM, but they
+  should not be included in the commit message:
+
+  * "write user-facing documentation for the new tool"
+
+  * "write testcases for the new functions"

Again this is just an illustration of an unhelpful commit message. Those would be eqally useless in an entirely human authored patch. Just emphasize the writing of useful commit messages.

docs/devel/code-provenance.rst content generators below. · line 392

Quoted 3 lines
docs/devel/code-provenance.rst +3 -0
+QEMU does *not* use ``Assisted-by``, ``Co-authored-by`` or ``Generated-by``
+trailers to indicate AI usage.  In particular, it is not necessary to
+specify the exact AI model or tool used to create the commit.

"does not use" doesn't imply "forbidden".

IIUC, tools are liable to add these tags without the contributor even asking for them. If we don't want to be providing free advertizing IMHO we should explicitly forbid use of these tags and validate this in checkpatch.pl

Also any rules in this respect should be documented earlier in this file where we outline what tags we use in commit messages, either instead of, or in addition to, mentioning them under the AI usage guidelines.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#17 lore raw
In reply to Daniel P. Berrangé

Hi Daniel,

Thanks for the review. It will take a while to incorporate everything and I'll wait for more feedback, in the meantime just a couple things I can confirm or add...

Quoted 6 lines · Daniel P. Berrangé

IIUC, by "small bug fixes", what you're actually trying to express is an acceptance of code that is either

* unlikely to meet the threshold for copyrightability
* small enough that the consequences of throwing it away is negligible.

Yes, these two.

Quoted 4 lines

In retrospect, I wonder if we shouldn't have have "ai-usage.rst" as a separate doc from the start. While we can hyperlink to sub-titles via anchors, it would be simpler if we could just point to a doc and not require scrolling past pages of non-AI text.

I can split it, especially since there's basically no shared text with the old one.

Quoted 13 lines

docs/devel/code-provenance.rst content generators below. · line 295

Quoted 9 lines
docs/devel/code-provenance.rst +5 -0
@@ -288,62 +288,108 @@ content generators below.
 Use of AI-generated content
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+Risks to open source projects include maintainer burnout from an
+increased number of contributions, as well as the risk to the project
+from unintentional inclusion of copyrighted material in the LLM's output.
+In order to mitigate these risks, the QEMU project currently allows
+using AI/LLM tools to produce patches in a limited set of scenarios:

If we're opening the door to AI assisted contribution, then IMHO we need to write about both the social and technical expectations.

Quoted 8 lines

Admittedly that will expand the scope of your proposal here, but IMHO that's somewhat unavoidable. A significant part of the downsides of AI-assisted contributions comes from bad social practices, rather than merely bad technical practices.

As a general theme, I would like us to emphasize at the start that the act of collaboration & contribution in QEMU is about the interaction, trust and relationships between humans, not bots.

I agree that it needs to be there somewhere. On the other hand I'm a bit worried about having a treatise that no one will read -- at least with stuff like "writing a commit message" we can point people to it.

Quoted 19 lines

If someone wants to use tools (LLM based or not) that's a choice, but the accountability for actions needs to fall on a real human and there needs to be transparency whenever automation is used.

This starts from the commit message. A good commit message (and even more so a good cover letter) describes the intent / thinking behind the changes. An LLM doesn't think or have intent in its actions, ergo a human should be driving the authorship of commit mesages / cover letters, where a non-trivial explanation is needed.

As reviewers, if we make use of LLM backed tools to respond, then we need to be transparent about any feedback that came from a bot rather than from a human.

As contributors, if a reviewer gives feedback, the contributors response should be their own rather than just feeding the email review into a LLM and cut+pasting the LLMs answer back to the list.

Quoted 4 lines

The identity use to contribute to QEMU should reflect the human's identify. As previously clarified, this doesn't need to be a real name, but we don't want LLM agents being given a psuedonym to pretend to be a human.

I'll try to weave these in either this section or a similar one.

Quoted 10 lines

docs/devel/code-provenance.rst content generators below. · line 316

Quoted 4 lines
docs/devel/code-provenance.rst +4 -0
+**Small bug fixes**
+  These should be limited to 20 lines of code or less, not including
+  tests.  You are still expected to :ref:`understand and explain your changes
+  <write_a_meaningful_commit_message>` and the rationale behind them.

I think the "20 lines or less" is not going a good job at expressing the intent behind this point. I'd like us to emphasize between the "why" of this point, as that helps contributors & reviewers make a decision of whether a change is "within the spirit" or the rule of not.

True but we also need a rule. The spirit is better explained elsewhere (and also, building consensus on spirit vs. a rule are two different things).

Quoted 4 lines

Docs is an area I'm more wary of from the social expectation side rather than the technical or legal side. I don't feeel like "pay attention to the organization and flow" really mitigates to the tendancy to production of vast reams of convincing sounding slop.

Reviewers have no obligation to review. The good thing about slop is that saying no takes about the same effort as the author put into the creation of the change.

Quoted 10 lines

IMHO it should not be at the discretion of individual maintainers to accept large-scale AI authored changes outside these guidelines. To quote the commit message rationale

"Therefore, it remains prudent to only permit AI assistance where
the ramifications of copyright violations are at least easy to revert and unlikely to spread"

that does not suggest we should leave it to the discretion of maintainers to override the guidelines.

See my reply to Peter elsewhere in the thread. I agree with your concerns for both docs and discretion, but I had specific uses in mind that I'd like to allow.

For docs:
- create tutorials and/or feature documentation based on functional tests
- create function comments (including Rust doctests) based on a high-level, human-written description of the module

For maintainer discretion:
- updating patches for changes to kernel APIs, before the kernel side is ready for inclusion
- creation of parsing code for Rust procedural macros based on code examples and/or a human-written description of the macro
- creation of boilerplate code similar to hw/core/hotplug.c

I think all of these are potentially compelling and I would like people to be allowed to experiment with them or similar cases.

The idea of contacting maintainers beforehand comes from the policy currently under discussion in the Rust project.

Quoted 11 lines

docs/devel/code-provenance.rst content generators below. · line 349

Quoted 1 line
docs/devel/code-provenance.rst +1 -0
+When AI/LLM tools produce or substantively shape your patch, add an

"shape your patch" -> "shape the content of the submitted patch"

as this better excludes the "background" usage mentioned below.

Quoted 5 lines
docs/devel/code-provenance.rst +4 -0
+``AI-used-for:`` line before ``Signed-off-by``, as a reminder of your
+DCO obligations and a guide to reviewers.  The text is one or more of
+``code``, ``tests``, ``docs``, ``research``, possibly followed by an
+explanation in parentheses:
 
Quoted 14 lines

docs/devel/code-provenance.rst content generators below. · line 364

Quoted 10 lines
docs/devel/code-provenance.rst +10 -0
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.

This is an interestng idea that I like much more than Assisted-by, because it gives more directly useful info to the reviewer, without turning into free advertizing for commercial vendors.

Yes! Thanks Kevin. :)

Quoted 6 lines

docs/devel/code-provenance.rst content generators below. · line 368

Quoted 3 lines
docs/devel/code-provenance.rst +3 -0
+There is no requirement to include your prompts or summarize the
+conversation in the commit message or cover letter, but you may do so
+if you think it helps a reviewer judge the result.  For example:

IMHO we should actively discourage the inclusion of prompts entirely as it is the wrong information to provide.

Why? I think it helps especially in the case where we're asking for maintainers to apply their discretion, and for reproducibility. It may not be always applicable, but it can also help.

Quoted 7 lines
Quoted 7 lines
docs/devel/code-provenance.rst +7 -0
+**Helpful prompts**
+  These describe concrete constraints or instructions, making it easy for a
+  reviewer to see how the tool's output was guided:
+
+  * "move field ``foo`` from ``struct aa`` to ``struct bb``.  If a
+    function already has a local variable or parameter of type ``struct
+    bb``, use it instead of accessing ``aa.bb``"
Quoted 8 lines

docs/devel/code-provenance.rst content generators below. · line 379

Quoted 3 lines
docs/devel/code-provenance.rst +3 -0
+
+  * "add an implementation of the trait for ``Mutex<T: MyTrait>``; it
+    takes the lock around the calls and forwards to ``T``"

These examples prompts are just expressing an aspect that should already have been described in prose in the commit message. We don't need to classify them as "ai prompts" in a a commit message, we just need the author to write a useful commit message.

The commit message does not have to contain this information. For example, commit 44a9d1b86c0 does not explain that it implements the ToMigrationState{,Shared} traits for Mutex. The commit message could say something like

"The implementation of the traits for types ... were created with AI. The prompt was: "add a simple forwarding implementation of the traits in rust/migration/src/migratable.rs for the array type [T; N] and for the interior mutable types Mutex<T> and BqlRefCell<T>. Note that interior mutable types only need T: ToMigrationState in order to implement ToMigrationStateShared".

I agree that this is not a typical part of a commit message. On the other hand we do mention occasionally how a commit was automated, and this falls under that case, sort of? See for example commit 324b2298fea ("docs/system: convert Texinfo documentation to rST", 2020-03-06).

Quoted 10 lines

docs/devel/code-provenance.rst content generators below. · line 392

Quoted 3 lines
docs/devel/code-provenance.rst +3 -0
+QEMU does *not* use ``Assisted-by``, ``Co-authored-by`` or ``Generated-by``
+trailers to indicate AI usage.  In particular, it is not necessary to
+specify the exact AI model or tool used to create the commit.

"does not use" doesn't imply "forbidden".

IIUC, tools are liable to add these tags without the contributor even asking for them. If we don't want to be providing free advertizing IMHO we should explicitly forbid use of these tags and validate this in checkpatch.pl

Ok.

Paolo

Quoted 12 lines

Also any rules in this respect should be documented earlier in this file where we outline what tags we use in commit messages, either instead of, or in addition to, mentioning them under the AI usage guidelines.

With regards,
Daniel
--

|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#18 lore raw
Quoted 19 lines · Paolo Bonzini
Quoted 18 lines · Daniel P. Berrangé

docs/devel/code-provenance.rst content generators below. · line 295

Quoted 9 lines
docs/devel/code-provenance.rst +5 -0
@@ -288,62 +288,108 @@ content generators below.
 Use of AI-generated content
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+Risks to open source projects include maintainer burnout from an
+increased number of contributions, as well as the risk to the project
+from unintentional inclusion of copyrighted material in the LLM's output.
+In order to mitigate these risks, the QEMU project currently allows
+using AI/LLM tools to produce patches in a limited set of scenarios:

If we're opening the door to AI assisted contribution, then IMHO we need to write about both the social and technical expectations.

Admittedly that will expand the scope of your proposal here, but IMHO that's somewhat unavoidable. A significant part of the downsides of AI-assisted contributions comes from bad social practices, rather than merely bad technical practices.

Quoted 7 lines
Quoted 3 lines

As a general theme, I would like us to emphasize at the start that the act of collaboration & contribution in QEMU is about the interaction, trust and relationships between humans, not bots.

I agree that it needs to be there somewhere. On the other hand I'm a bit worried about having a treatise that no one will read -- at least with stuff like "writing a commit message" we can point people to it.

It doesn't have to be an especially long introduction in the context of the AI policy doc. If we want something more verbose that could fit elsewhere in our contribution docs. The AI policy should just make a point that we expect to be communicating with people not bots pretending to be people.

Quoted 11 lines
Quoted 10 lines

docs/devel/code-provenance.rst content generators below. · line 316

Quoted 4 lines
docs/devel/code-provenance.rst +4 -0
+**Small bug fixes**
+  These should be limited to 20 lines of code or less, not including
+  tests.  You are still expected to :ref:`understand and explain your changes
+  <write_a_meaningful_commit_message>` and the rationale behind them.

I think the "20 lines or less" is not going a good job at expressing the intent behind this point. I'd like us to emphasize between the "why" of this point, as that helps contributors & reviewers make a decision of whether a change is "within the spirit" or the rule of not.

Quoted 3 lines

True but we also need a rule. The spirit is better explained elsewhere (and also, building consensus on spirit vs. a rule are two different things).

Do we have a better elsewhere in this case ? It is a point specifically about intent of the AI policy rule.

Quoted 8 lines
Quoted 4 lines

Docs is an area I'm more wary of from the social expectation side rather than the technical or legal side. I don't feeel like "pay attention to the organization and flow" really mitigates to the tendancy to production of vast reams of convincing sounding slop.

Reviewers have no obligation to review. The good thing about slop is that saying no takes about the same effort as the author put into the creation of the change.

That is true, but at the same time even if you merely say "no", being on the receiving end of it drains you mental energy, as you still have to pay some attention in order to decide whether to say no or not. I'm pretty wary at a policy that is liable to unleash volumuous docs submissions on maintainers.

Can we do this more incrementally and have a more tightly constrained guide for docs initially and review it again at a later date if we feel it is worth relaxing further.

Quoted 11 lines
Quoted 10 lines

IMHO it should not be at the discretion of individual maintainers to accept large-scale AI authored changes outside these guidelines. To quote the commit message rationale

"Therefore, it remains prudent to only permit AI assistance where
the ramifications of copyright violations are at least easy to revert and unlikely to spread"

that does not suggest we should leave it to the discretion of maintainers to override the guidelines.

Quoted 6 lines

See my reply to Peter elsewhere in the thread. I agree with your concerns for both docs and discretion, but I had specific uses in mind that I'd like to allow.

For docs:
- create tutorials and/or feature documentation based on functional tests

That doesn't sound too appealing to me. Reverse engineering docs or tutorials from our functional tests is exactly the kind of thing that feels likely to result in volumous text of marginal value which will have a large burden on reviewers.

Quoted 2 lines

- create function comments (including Rust doctests) based on a high-level, human-written description of the module

This feels interesting to trial.

The key difference with function comments is that you don't really have any of the trouble with document structure & coherence. The API docs should be comparatively smaller & easier to read & digest and give feedback on accuracy of.

Quoted 9 lines

For maintainer discretion:
- updating patches for changes to kernel APIs, before the kernel side is ready for inclusion
- creation of parsing code for Rust procedural macros based on code examples and/or a human-written description of the macro
- creation of boilerplate code similar to hw/core/hotplug.c

I think all of these are potentially compelling and I would like people to be allowed to experiment with them or similar cases.

Those are largely in direct conflict with the intent behind only allowing "small bug fixes". Either we accept broad contributions like this as a project, or we don't - I don't see that as something that is suitable for per-maintainer discretion. If it will not be intended for merge, then the policy is irrelevant and people can just experiment out of tree at will.

Quoted 2 lines

The idea of contacting maintainers beforehand comes from the policy currently under discussion in the Rust project.

I presume you're looking at

https://github.com/rust-lang/rust-forge/pull/1040/changes

What I find interesting there is that their rule that is comparable to your "small bug fixes" rule, emphasizes it is about allowing "trivial" chances and specifically references the idea of a threshold for originality / copyrightability. I find that more satisfying than talking about lines of code and bug fixes.

The talk about experimenting with LLMS for larger changes emphasizes experimentation and use of PRs in order to trigger the run of tools from their review pipeline.

That doesn't explicitly say whether such "experiments" are permissible to be merged though. I don't know if the Rust project has specific terminology here, but my reading of that was that people can agree to collaborate publically on LLM work, but that does not appear to give individual maintainers permission to waive the LLM policy rules to merge arbitrary LLM code in the way this QEMU proposal suggests.

Quoted 32 lines
Quoted 6 lines

docs/devel/code-provenance.rst content generators below. · line 368

Quoted 3 lines
docs/devel/code-provenance.rst +3 -0
+There is no requirement to include your prompts or summarize the
+conversation in the commit message or cover letter, but you may do so
+if you think it helps a reviewer judge the result.  For example:

IMHO we should actively discourage the inclusion of prompts entirely as it is the wrong information to provide.

Why? I think it helps especially in the case where we're asking for maintainers to apply their discretion, and for reproducibility. It may not be always applicable, but it can also help.

Quoted 7 lines
Quoted 7 lines
docs/devel/code-provenance.rst +7 -0
+**Helpful prompts**
+  These describe concrete constraints or instructions, making it easy for a
+  reviewer to see how the tool's output was guided:
+
+  * "move field ``foo`` from ``struct aa`` to ``struct bb``.  If a
+    function already has a local variable or parameter of type ``struct
+    bb``, use it instead of accessing ``aa.bb``"
Quoted 8 lines

docs/devel/code-provenance.rst content generators below. · line 379

Quoted 3 lines
docs/devel/code-provenance.rst +3 -0
+
+  * "add an implementation of the trait for ``Mutex<T: MyTrait>``; it
+    takes the lock around the calls and forwards to ``T``"

These examples prompts are just expressing an aspect that should already have been described in prose in the commit message. We don't need to classify them as "ai prompts" in a a commit message, we just need the author to write a useful commit message.

The commit message does not have to contain this information. For example, commit 44a9d1b86c0 does not explain that it implements the ToMigrationState{,Shared} traits for Mutex. The commit message could say something like

Quoted 6 lines

"The implementation of the traits for types ... were created with AI. The prompt was: "add a simple forwarding implementation of the traits in rust/migration/src/migratable.rs for the array type [T; N] and for the interior mutable types Mutex<T> and BqlRefCell<T>. Note that interior mutable types only need T: ToMigrationState in order to implement ToMigrationStateShared".

If that is relevant info for reviewers then regardless of whether it was written by an LLM or a human, that should have been added to the commit message.

"This commit adds a simple forwarding implementation of the traits
in rust/migration/src/migratable.rs for the array type [T; N] and for the interior mutable types Mutex<T> and BqlRefCell<T>. Note that interior mutable types only need T: ToMigrationState in order to implement ToMigrationStateShared".

there is no reason to call out the inclusion of "LLM prompts" as a concept here. We should be emphasizing that commit messages should explain their intent in all cases, not something specific to AI authored code.

Quoted 5 lines

I agree that this is not a typical part of a commit message. On the other hand we do mention occasionally how a commit was automated, and this falls under that case, sort of? See for example commit 324b2298fea ("docs/system: convert Texinfo documentation to rST", 2020-03-06).

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#19 lore raw

Il mer 3 giu 2026, 19:54 Daniel P. Berrangé <[email protected]> ha scritto:

Quoted 4 lines

The AI policy should just
make a point that we expect to be communicating with people not bots pretending to be people.

Yes, it's better to have that stated clearly.

Quoted 6 lines

True but we also need a rule. The spirit is better explained elsewhere

Quoted 2 lines

(and also, building consensus on spirit vs. a rule are two different things).

Do we have a better elsewhere in this case ? It is a point specifically about intent of the AI policy rule.

The rule in this draft says 20 lines, tests, mechanical changes and docs. The spirit is what is in the commit message, basically to maximize the benefit and limit the possible damage?

Quoted 11 lines
Quoted 3 lines

Docs is an area I'm more wary of from the social expectation side rather

Quoted 2 lines

than the technical or legal side. I don't feeel like "pay attention to the organization and flow" really mitigates to the tendancy to

production

Quoted 1 line
Quoted 1 line

of vast reams of convincing sounding slop.

Can we do this more incrementally and have a more tightly constrained guide for docs initially and review it again at a later date if we feel it is worth relaxing further.

Sure.

Maybe the same can be done for boilerplate changes like the one I suggest below?

Quoted 4 lines

See my reply to Peter elsewhere in the thread. I agree with your

Quoted 3 lines

concerns for both docs and discretion, but I had specific uses in mind that I'd like to allow.

Quoted 8 lines
Quoted 2 lines

For docs:
- create tutorials and/or feature documentation based on functional tests

That doesn't sound too appealing to me. Reverse engineering docs or tutorials from our functional tests is exactly the kind of thing that feels likely to result in volumous text of marginal value which will have a large burden on reviewers.

At the same time this can be helpful for maintainers themselves? Let's also look at this from the point of view of producing better output, not just from that of being on the receiving end of slop. Especially for docs I have a hard time imagining people sending out whole new "manuals"... The bugfixes rule ironically seems the most dangerous to me from the Dunning-Krueger point of view.

My question is: do we want disclosure for anything is created with the help of LLMs, even if only small parts survive untouched? I think so, because a lot more, even if edited, would still be originally from AI. But then it's important to have rules allowing it and a way to track it.

Quoted 9 lines

- create function comments (including Rust doctests) based on a

Quoted 1 line

high-level, human-written description of the module

This feels interesting to trial.

The key difference with function comments is that you don't really have any of the trouble with document structure & coherence. The API docs should be comparatively smaller & easier to read & digest and give feedback on accuracy of.

True.

Quoted 7 lines

For maintainer discretion:

Quoted 6 lines

- updating patches for changes to kernel APIs, before the kernel side is ready for inclusion
- creation of parsing code for Rust procedural macros based on code examples and/or a human-written description of the macro
- creation of boilerplate code similar to hw/core/hotplug.c

Quoted 8 lines
Quoted 2 lines

I think all of these are potentially compelling and I would like people to be allowed to experiment with them or similar cases.

Those are largely in direct conflict with the intent behind only allowing "small bug fixes" Either we accept broad contributions like this as a project, or we don't - I don't see that as something that is suitable for per-maintainer discretion. If it will not be intended for merge, then the policy is irrelevant and people can just experiment out of tree at will.

It would definitely be intended for merge. There's a lot of boilerplate code in the Rust bindings, for example, that is voluminous but *mostly* lacks creativity---the creative part basically can be described by the spec/docs and should already clear the low bar required for originality, even if the code is automatically generated. I included a couple examples in my reply to Peter.

I have no preference for writing English or a programming language, but writing both sucks and LLMs are much better at coding than writing specs (plus, code can be tested). This is exactly the opposite of small bug fixes which are themselves the product of a creative process (debugging) but small enough that, once you've debugged them, there's basically only one way to write them.

Quoted 6 lines

The idea of contacting maintainers beforehand comes from the policy

Quoted 1 line

currently under discussion in the Rust project.

I presume you're looking at

https://github.com/rust-lang/rust-forge/pull/1040/changes

Yes.

What I find interesting there is that their rule that is comparable to your

Quoted 4 lines

"small bug fixes" rule, emphasizes it is about allowing "trivial" chances and specifically references the idea of a threshold for originality / copyrightability. I find that more satisfying than talking about lines of code and bug fixes.

It's also more abstract though; and doesn't touch on what happens if you stumble on someone else's threshold of originality. We're not lawyers, and our contributors probably have thought even less about these issues. That's why both Rust's policy and this proposal have (different) concrete ways to stay within the spirit.

The talk about experimenting with LLMS for larger changes emphasizes

Quoted 5 lines

experimentation and use of PRs in order to trigger the run of tools from their review pipeline.

That doesn't explicitly say whether such "experiments" are permissible to be merged though

There is a part that mentions "pre-arranged, non-critical, high-quality, well-tested, and well-reviewed code changes that are originally created by an LLM", "to experiment with LLMs to inform future policies".

They mention a private channel where maintainers can discuss whether the PRs pass the standards required of LLM changes. The mention of a higher standard strongly suggests that they intend to accept them, otherwise why would you have people do the work for nothing.

Likewise, they say that for CI runs no disclosure is needed while "if a PR is no longer marked as clearly experimental, at that point disclosure is required". The no-longer-experimental PRs fall under the previous rule, and IMO this sentence also supports my reading that they are intended for merging.

This is what I would like to have in QEMU as well, so that people are able to learn. We need to trust maintainers to understand the spirit---which does mean we need to write it down, though. :)

Paolo

I don't know if the Rust project has specific terminology here, but my

Quoted 4 lines

reading of that was that people can agree to collaborate publically on LLM work, but that does not appear to give individual maintainers permission to waive the LLM policy rules to merge arbitrary LLM code in the way this QEMU proposal suggests.

#20 lore raw
Quoted 14 lines · Paolo Bonzini

Il mer 3 giu 2026, 19:54 Daniel P. Berrangé <[email protected]> ha scritto:

Quoted 4 lines

The AI policy should just
make a point that we expect to be communicating with people not bots pretending to be people.

Yes, it's better to have that stated clearly.

Quoted 4 lines

True but we also need a rule. The spirit is better explained elsewhere

Quoted 2 lines

(and also, building consensus on spirit vs. a rule are two different things).

Quoted 7 lines
Quoted 2 lines

Do we have a better elsewhere in this case ? It is a point specifically about intent of the AI policy rule.

The rule in this draft says 20 lines, tests, mechanical changes and docs. The spirit is what is in the commit message, basically to maximize the benefit and limit the possible damage?

Putting "the spirit" in the commit message is essentially /dev/null to anyone reading the policy later.

Quoted 20 lines
Quoted 4 lines

See my reply to Peter elsewhere in the thread. I agree with your

Quoted 3 lines

concerns for both docs and discretion, but I had specific uses in mind that I'd like to allow.

Quoted 8 lines
Quoted 2 lines

For docs:
- create tutorials and/or feature documentation based on functional tests

That doesn't sound too appealing to me. Reverse engineering docs or tutorials from our functional tests is exactly the kind of thing that feels likely to result in volumous text of marginal value which will have a large burden on reviewers.

At the same time this can be helpful for maintainers themselves? Let's also look at this from the point of view of producing better output, not just from that of being on the receiving end of slop. Especially for docs I have a hard time imagining people sending out whole new "manuals"... The bugfixes rule ironically seems the most dangerous to me from the Dunning-Krueger point of view.

Quoted 4 lines

My question is: do we want disclosure for anything is created with the help of LLMs, even if only small parts survive untouched? I think so, because a lot more, even if edited, would still be originally from AI. But then it's important to have rules allowing it and a way to track it.

IMHO need unconditional disclosure, because the use of the LLM impacts the license of the code. QEMU is traditionally expected to be GPLv2+ licensed for all new code, but there's the train of thought that LLM code is public domain. If it gets human editting afterwards we can consider that the human edits are GPLv2+ licensed, but IMHO we still want to know the origins.

Quoted 6 lines

It would definitely be intended for merge. There's a lot of boilerplate code in the Rust bindings, for example, that is voluminous but *mostly* lacks creativity---the creative part basically can be described by the spec/docs and should already clear the low bar required for originality, even if the code is automatically generated. I included a couple examples in my reply to Peter.

So we know there are examples which are probably low risk from a license POV, but which are massively larger than 20 lines of code. This just makes me more uncomfortable with the 20 line rule as the definition of the policy - we know that rule is wrong / undesirable from the start and needs this exception to make it viable.

Quoted 23 lines

The talk about experimenting with LLMS for larger changes emphasizes

Quoted 5 lines

experimentation and use of PRs in order to trigger the run of tools from their review pipeline.

That doesn't explicitly say whether such "experiments" are permissible to be merged though

There is a part that mentions "pre-arranged, non-critical, high-quality, well-tested, and well-reviewed code changes that are originally created by an LLM", "to experiment with LLMs to inform future policies".

They mention a private channel where maintainers can discuss whether the PRs pass the standards required of LLM changes. The mention of a higher standard strongly suggests that they intend to accept them, otherwise why would you have people do the work for nothing.

Likewise, they say that for CI runs no disclosure is needed while "if a PR is no longer marked as clearly experimental, at that point disclosure is required". The no-longer-experimental PRs fall under the previous rule, and IMO this sentence also supports my reading that they are intended for merging.

Quoted 3 lines

This is what I would like to have in QEMU as well, so that people are able to learn. We need to trust maintainers to understand the spirit---which does mean we need to write it down, though. :)

I'm mostly concerned with the likelihood of inconsistency across areas of QEMU if we leave it upto individual maintainers' discretion. This doesn't give non-regular contributors a good impression of what's allowed and what's not, across the codebase as a whole IMHO.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#21 lore raw
Quoted 51 lines · Daniel P. Berrangé
Quoted 14 lines · Paolo Bonzini

Il mer 3 giu 2026, 19:54 Daniel P. Berrangé <[email protected]> ha scritto:

Quoted 4 lines

The AI policy should just
make a point that we expect to be communicating with people not bots pretending to be people.

Yes, it's better to have that stated clearly.

Quoted 4 lines

True but we also need a rule. The spirit is better explained elsewhere

Quoted 2 lines

(and also, building consensus on spirit vs. a rule are two different things).

Quoted 7 lines
Quoted 2 lines

Do we have a better elsewhere in this case ? It is a point specifically about intent of the AI policy rule.

The rule in this draft says 20 lines, tests, mechanical changes and docs. The spirit is what is in the commit message, basically to maximize the benefit and limit the possible damage?

Putting "the spirit" in the commit message is essentially /dev/null to anyone reading the policy later.

Quoted 20 lines
Quoted 4 lines

See my reply to Peter elsewhere in the thread. I agree with your

Quoted 3 lines

concerns for both docs and discretion, but I had specific uses in mind that I'd like to allow.

Quoted 8 lines
Quoted 2 lines

For docs:
- create tutorials and/or feature documentation based on functional tests

That doesn't sound too appealing to me. Reverse engineering docs or tutorials from our functional tests is exactly the kind of thing that feels likely to result in volumous text of marginal value which will have a large burden on reviewers.

At the same time this can be helpful for maintainers themselves? Let's also look at this from the point of view of producing better output, not just from that of being on the receiving end of slop. Especially for docs I have a hard time imagining people sending out whole new "manuals"... The bugfixes rule ironically seems the most dangerous to me from the Dunning-Krueger point of view.

Quoted 4 lines

My question is: do we want disclosure for anything is created with the help of LLMs, even if only small parts survive untouched? I think so, because a lot more, even if edited, would still be originally from AI. But then it's important to have rules allowing it and a way to track it.

Quoted 7 lines

IMHO need unconditional disclosure, because the use of the LLM impacts the license of the code. QEMU is traditionally expected to be GPLv2+ licensed for all new code, but there's the train of thought that LLM code is public domain.
If it gets human editting afterwards we can
consider that the human edits are GPLv2+ licensed, but IMHO we still want to know the origins.

Wait that's a big ask.

DOC explicitly does not ask if code might be available anywhere else under any other license. Just that contributor can contribute under GPL. If it's public domain then the human can license is under GPL.

Quoted 9 lines
Quoted 8 lines

It would definitely be intended for merge. There's a lot of boilerplate code in the Rust bindings, for example, that is voluminous but *mostly* lacks creativity---the creative part basically can be described by the spec/docs and should already clear the low bar required for originality, even if the code is automatically generated. I included a couple examples in my reply to Peter.

Quoted 5 lines

So we know there are examples which are probably low risk from a license POV, but which are massively larger than 20 lines of code. This just makes me more uncomfortable with the 20 line rule as the definition of the policy - we know that rule is wrong / undesirable from the start and needs this exception to make it viable.

So 20 lines or mechanical changes? what is considered mechanical will be decided by maintainers, contributor should check with them up front.

Quoted 29 lines
Quoted 25 lines

The talk about experimenting with LLMS for larger changes emphasizes

Quoted 5 lines

experimentation and use of PRs in order to trigger the run of tools from their review pipeline.

That doesn't explicitly say whether such "experiments" are permissible to be merged though

There is a part that mentions "pre-arranged, non-critical, high-quality, well-tested, and well-reviewed code changes that are originally created by an LLM", "to experiment with LLMs to inform future policies".

They mention a private channel where maintainers can discuss whether the PRs pass the standards required of LLM changes. The mention of a higher standard strongly suggests that they intend to accept them, otherwise why would you have people do the work for nothing.

Likewise, they say that for CI runs no disclosure is needed while "if a PR is no longer marked as clearly experimental, at that point disclosure is required". The no-longer-experimental PRs fall under the previous rule, and IMO this sentence also supports my reading that they are intended for merging.

Quoted 3 lines

This is what I would like to have in QEMU as well, so that people are able to learn. We need to trust maintainers to understand the spirit---which does mean we need to write it down, though. :)

Quoted 7 lines

I'm mostly concerned with the likelihood of inconsistency across areas of QEMU if we leave it upto individual maintainers' discretion. This doesn't give non-regular contributors a good impression of what's allowed and what's not, across the codebase as a whole IMHO.

With regards,
Daniel

Always the case in many other areas :) People are inconsistent.

Quoted 4 lines
Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#22 lore raw
Quoted 60 lines · Michael S. Tsirkin
Quoted 51 lines · Daniel P. Berrangé
Quoted 14 lines · Paolo Bonzini

Il mer 3 giu 2026, 19:54 Daniel P. Berrangé <[email protected]> ha scritto:

Quoted 4 lines

The AI policy should just
make a point that we expect to be communicating with people not bots pretending to be people.

Yes, it's better to have that stated clearly.

Quoted 4 lines

True but we also need a rule. The spirit is better explained elsewhere

Quoted 2 lines

(and also, building consensus on spirit vs. a rule are two different things).

Quoted 7 lines
Quoted 2 lines

Do we have a better elsewhere in this case ? It is a point specifically about intent of the AI policy rule.

The rule in this draft says 20 lines, tests, mechanical changes and docs. The spirit is what is in the commit message, basically to maximize the benefit and limit the possible damage?

Putting "the spirit" in the commit message is essentially /dev/null to anyone reading the policy later.

Quoted 20 lines
Quoted 4 lines

See my reply to Peter elsewhere in the thread. I agree with your

Quoted 3 lines

concerns for both docs and discretion, but I had specific uses in mind that I'd like to allow.

Quoted 8 lines
Quoted 2 lines

For docs:
- create tutorials and/or feature documentation based on functional tests

That doesn't sound too appealing to me. Reverse engineering docs or tutorials from our functional tests is exactly the kind of thing that feels likely to result in volumous text of marginal value which will have a large burden on reviewers.

At the same time this can be helpful for maintainers themselves? Let's also look at this from the point of view of producing better output, not just from that of being on the receiving end of slop. Especially for docs I have a hard time imagining people sending out whole new "manuals"... The bugfixes rule ironically seems the most dangerous to me from the Dunning-Krueger point of view.

Quoted 4 lines

My question is: do we want disclosure for anything is created with the help of LLMs, even if only small parts survive untouched? I think so, because a lot more, even if edited, would still be originally from AI. But then it's important to have rules allowing it and a way to track it.

Quoted 7 lines

IMHO need unconditional disclosure, because the use of the LLM impacts the license of the code. QEMU is traditionally expected to be GPLv2+ licensed for all new code, but there's the train of thought that LLM code is public domain.
If it gets human editting afterwards we can
consider that the human edits are GPLv2+ licensed, but IMHO we still want to know the origins.

Quoted 5 lines

Wait that's a big ask.

DOC explicitly does not ask if code might be available anywhere else under any other license. Just that contributor can contribute under GPL. If it's public domain then the human can license is under GPL.

For new files, in checkpatch we validate that SPDX-License-Identifier is explicitly set as GPL-2.0-or-later. Contributors are expected to justify any divergence in the commit message.

I've seen guidance that SPDX-License-Identifier for AI output code should NOT state a license, under the theory it is public domain.

If it is human editted though, I would expect it to overrule this guidance and explicitly state GPL-2.0-or-later in the SPDX tag unless the contributor wants to explicitly put their own edits under public domain too.

Ultimately QEMU is a copyleft project as a whole and IMHO we should prioritize retaining that for as large a portion of the codebase is is practical.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

It would definitely be intended for merge. There's a lot of boilerplate code in the Rust bindings, for example, that is voluminous but *mostly* lacks creativity---the creative part basically can be described by the spec/docs and should already clear the low bar required for originality, even if the code is automatically generated. I included a couple examples in my reply to Peter.

Quoted 8 lines
Quoted 5 lines

So we know there are examples which are probably low risk from a license POV, but which are massively larger than 20 lines of code. This just makes me more uncomfortable with the 20 line rule as the definition of the policy - we know that rule is wrong / undesirable from the start and needs this exception to make it viable.

So 20 lines or mechanical changes? what is considered mechanical will be decided by maintainers, contributor should check with them up front.

If we are wanting to allow mechanical changes / boilerplate, then we should express that in the policy such that the policy can be reasonably understood without having to ask permission / questions ahead of time.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#23 lore raw
Quoted 67 lines · Daniel P. Berrangé
Quoted 60 lines · Michael S. Tsirkin
Quoted 51 lines · Daniel P. Berrangé
Quoted 14 lines · Paolo Bonzini

Il mer 3 giu 2026, 19:54 Daniel P. Berrangé <[email protected]> ha scritto:

Quoted 4 lines

The AI policy should just
make a point that we expect to be communicating with people not bots pretending to be people.

Yes, it's better to have that stated clearly.

Quoted 4 lines

True but we also need a rule. The spirit is better explained elsewhere

Quoted 2 lines

(and also, building consensus on spirit vs. a rule are two different things).

Quoted 7 lines
Quoted 2 lines

Do we have a better elsewhere in this case ? It is a point specifically about intent of the AI policy rule.

The rule in this draft says 20 lines, tests, mechanical changes and docs. The spirit is what is in the commit message, basically to maximize the benefit and limit the possible damage?

Putting "the spirit" in the commit message is essentially /dev/null to anyone reading the policy later.

Quoted 20 lines
Quoted 4 lines

See my reply to Peter elsewhere in the thread. I agree with your

Quoted 3 lines

concerns for both docs and discretion, but I had specific uses in mind that I'd like to allow.

Quoted 8 lines
Quoted 2 lines

For docs:
- create tutorials and/or feature documentation based on functional tests

That doesn't sound too appealing to me. Reverse engineering docs or tutorials from our functional tests is exactly the kind of thing that feels likely to result in volumous text of marginal value which will have a large burden on reviewers.

At the same time this can be helpful for maintainers themselves? Let's also look at this from the point of view of producing better output, not just from that of being on the receiving end of slop. Especially for docs I have a hard time imagining people sending out whole new "manuals"... The bugfixes rule ironically seems the most dangerous to me from the Dunning-Krueger point of view.

Quoted 4 lines

My question is: do we want disclosure for anything is created with the help of LLMs, even if only small parts survive untouched? I think so, because a lot more, even if edited, would still be originally from AI. But then it's important to have rules allowing it and a way to track it.

Quoted 7 lines

IMHO need unconditional disclosure, because the use of the LLM impacts the license of the code. QEMU is traditionally expected to be GPLv2+ licensed for all new code, but there's the train of thought that LLM code is public domain.
If it gets human editting afterwards we can
consider that the human edits are GPLv2+ licensed, but IMHO we still want to know the origins.

Quoted 5 lines

Wait that's a big ask.

DOC explicitly does not ask if code might be available anywhere else under any other license. Just that contributor can contribute under GPL. If it's public domain then the human can license is under GPL.

Quoted 6 lines

For new files, in checkpatch we validate that SPDX-License-Identifier is explicitly set as GPL-2.0-or-later. Contributors are expected to justify any divergence in the commit message.

I've seen guidance that SPDX-License-Identifier for AI output code should NOT state a license, under the theory it is public domain.

Not state a license? Recommended by a lawyer? Seen where? Why?

Quoted 5 lines

If it is human editted though, I would expect it to overrule this guidance and explicitly state GPL-2.0-or-later in the SPDX tag unless the contributor wants to explicitly put their own edits under public domain too.

Yes. So far we just asked:

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

this:
unless I am permitted to submit under a different license
applies to public domain works.

Quoted 3 lines

Ultimately QEMU is a copyleft project as a whole and IMHO we should prioritize retaining that for as large a portion of the codebase is is practical.

But of course. We can make this explicit too: that contributing it should be under GPL and/or implies licensing it under GPL.

Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

It would definitely be intended for merge. There's a lot of boilerplate code in the Rust bindings, for example, that is voluminous but *mostly* lacks creativity---the creative part basically can be described by the spec/docs and should already clear the low bar required for originality, even if the code is automatically generated. I included a couple examples in my reply to Peter.

Quoted 8 lines
Quoted 5 lines

So we know there are examples which are probably low risk from a license POV, but which are massively larger than 20 lines of code. This just makes me more uncomfortable with the 20 line rule as the definition of the policy - we know that rule is wrong / undesirable from the start and needs this exception to make it viable.

So 20 lines or mechanical changes? what is considered mechanical will be decided by maintainers, contributor should check with them up front.

Quoted 6 lines

If we are wanting to allow mechanical changes / boilerplate, then we should express that in the policy such that the policy can be reasonably understood without having to ask permission / questions ahead of time.

With regards,
Daniel

Indeed but what is mechanical is a matter of taste.

Quoted 4 lines
Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#24 lore raw
Quoted 68 lines · Michael S. Tsirkin
Quoted 67 lines · Daniel P. Berrangé
Quoted 65 lines · Michael S. Tsirkin
Quoted 51 lines · Daniel P. Berrangé
Quoted 14 lines · Paolo Bonzini

Il mer 3 giu 2026, 19:54 Daniel P. Berrangé <[email protected]> ha scritto:

Quoted 4 lines

The AI policy should just
make a point that we expect to be communicating with people not bots pretending to be people.

Yes, it's better to have that stated clearly.

Quoted 4 lines

True but we also need a rule. The spirit is better explained elsewhere

Quoted 2 lines

(and also, building consensus on spirit vs. a rule are two different things).

Quoted 7 lines
Quoted 2 lines

Do we have a better elsewhere in this case ? It is a point specifically about intent of the AI policy rule.

The rule in this draft says 20 lines, tests, mechanical changes and docs. The spirit is what is in the commit message, basically to maximize the benefit and limit the possible damage?

Putting "the spirit" in the commit message is essentially /dev/null to anyone reading the policy later.

Quoted 20 lines
Quoted 4 lines

See my reply to Peter elsewhere in the thread. I agree with your

Quoted 3 lines

concerns for both docs and discretion, but I had specific uses in mind that I'd like to allow.

Quoted 8 lines
Quoted 2 lines

For docs:
- create tutorials and/or feature documentation based on functional tests

That doesn't sound too appealing to me. Reverse engineering docs or tutorials from our functional tests is exactly the kind of thing that feels likely to result in volumous text of marginal value which will have a large burden on reviewers.

At the same time this can be helpful for maintainers themselves? Let's also look at this from the point of view of producing better output, not just from that of being on the receiving end of slop. Especially for docs I have a hard time imagining people sending out whole new "manuals"... The bugfixes rule ironically seems the most dangerous to me from the Dunning-Krueger point of view.

Quoted 4 lines

My question is: do we want disclosure for anything is created with the help of LLMs, even if only small parts survive untouched? I think so, because a lot more, even if edited, would still be originally from AI. But then it's important to have rules allowing it and a way to track it.

Quoted 7 lines

IMHO need unconditional disclosure, because the use of the LLM impacts the license of the code. QEMU is traditionally expected to be GPLv2+ licensed for all new code, but there's the train of thought that LLM code is public domain.
If it gets human editting afterwards we can
consider that the human edits are GPLv2+ licensed, but IMHO we still want to know the origins.

Wait that's a big ask.

DOC explicitly does not ask if code might be available anywhere else under any other license. Just that contributor can contribute under GPL. If it's public domain then the human can license is under GPL.

Quoted 8 lines
Quoted 6 lines

For new files, in checkpatch we validate that SPDX-License-Identifier is explicitly set as GPL-2.0-or-later. Contributors are expected to justify any divergence in the commit message.

I've seen guidance that SPDX-License-Identifier for AI output code should NOT state a license, under the theory it is public domain.

Not state a license? Recommended by a lawyer? Seen where? Why?

https://www.redhat.com/en/blog/ai-assisted-development-and-open-source-navigating-legal-issues

"The harder case is when an entire source file, or even
an entire repository, is generated by AI. Here, adding a copyright and license notice may be inappropriate unless and until human contributions transform the file into a copyrightable work. "

I interpret that to suggest we should not automatically use
SPDX-License-Identifier: GPL-2.0-or-later on LLM generated code, unless subsequent human editting was non-trivial.

Quoted 6 lines
Quoted 3 lines

Ultimately QEMU is a copyleft project as a whole and IMHO we should prioritize retaining that for as large a portion of the codebase is is practical.

But of course. We can make this explicit too: that contributing it should be under GPL and/or implies licensing it under GPL.

The subtlety is that generally when changing an existing file, you assume the edits are under the same licence as the initial code being editted.

If the initial code is LLM generated & thus presumed public domain, it might be inferred that human edits are public domain too. I don't think we want to have that interpretation and should be explicit that human edits to LLM code in code are assumed to be GPL-2.0-or-later licensed unless explicitly stated to the contrary.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 8 lines

It would definitely be intended for merge. There's a lot of boilerplate code in the Rust bindings, for example, that is voluminous but *mostly* lacks creativity---the creative part basically can be described by the spec/docs and should already clear the low bar required for originality, even if the code is automatically generated. I included a couple examples in my reply to Peter.

So we know there are examples which are probably low risk from a license POV, but which are massively larger than 20 lines of code. This just makes me more uncomfortable with the 20 line rule as the definition of the policy - we know that rule is wrong / undesirable from the start and needs this exception to make it viable.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

So 20 lines or mechanical changes? what is considered mechanical will be decided by maintainers, contributor should check with them up front.

If we are wanting to allow mechanical changes / boilerplate, then we should express that in the policy such that the policy can be reasonably understood without having to ask permission / questions ahead of time.

Indeed but what is mechanical is a matter of taste.

I really don't think it can/should be left to a matter of personal taste.

Something is "mechanical" if it can be assumed that any reasonable contributor / maintainer would look at it and agree with that idea.

If there is any significant (liklihood of) disagreement on whether it is mechanical or not, then IMHO we should assume it is NOT mechanical.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#25 lore raw
Quoted 96 lines · Daniel P. Berrangé
Quoted 68 lines · Michael S. Tsirkin
Quoted 67 lines · Daniel P. Berrangé
Quoted 65 lines · Michael S. Tsirkin
Quoted 51 lines · Daniel P. Berrangé
Quoted 14 lines · Paolo Bonzini

Il mer 3 giu 2026, 19:54 Daniel P. Berrangé <[email protected]> ha scritto:

Quoted 4 lines

The AI policy should just
make a point that we expect to be communicating with people not bots pretending to be people.

Yes, it's better to have that stated clearly.

Quoted 4 lines

True but we also need a rule. The spirit is better explained elsewhere

Quoted 2 lines

(and also, building consensus on spirit vs. a rule are two different things).

Quoted 7 lines
Quoted 2 lines

Do we have a better elsewhere in this case ? It is a point specifically about intent of the AI policy rule.

The rule in this draft says 20 lines, tests, mechanical changes and docs. The spirit is what is in the commit message, basically to maximize the benefit and limit the possible damage?

Putting "the spirit" in the commit message is essentially /dev/null to anyone reading the policy later.

Quoted 20 lines
Quoted 4 lines

See my reply to Peter elsewhere in the thread. I agree with your

Quoted 3 lines

concerns for both docs and discretion, but I had specific uses in mind that I'd like to allow.

Quoted 8 lines
Quoted 2 lines

For docs:
- create tutorials and/or feature documentation based on functional tests

That doesn't sound too appealing to me. Reverse engineering docs or tutorials from our functional tests is exactly the kind of thing that feels likely to result in volumous text of marginal value which will have a large burden on reviewers.

At the same time this can be helpful for maintainers themselves? Let's also look at this from the point of view of producing better output, not just from that of being on the receiving end of slop. Especially for docs I have a hard time imagining people sending out whole new "manuals"... The bugfixes rule ironically seems the most dangerous to me from the Dunning-Krueger point of view.

Quoted 4 lines

My question is: do we want disclosure for anything is created with the help of LLMs, even if only small parts survive untouched? I think so, because a lot more, even if edited, would still be originally from AI. But then it's important to have rules allowing it and a way to track it.

Quoted 7 lines

IMHO need unconditional disclosure, because the use of the LLM impacts the license of the code. QEMU is traditionally expected to be GPLv2+ licensed for all new code, but there's the train of thought that LLM code is public domain.
If it gets human editting afterwards we can
consider that the human edits are GPLv2+ licensed, but IMHO we still want to know the origins.

Wait that's a big ask.

DOC explicitly does not ask if code might be available anywhere else under any other license. Just that contributor can contribute under GPL. If it's public domain then the human can license is under GPL.

Quoted 8 lines
Quoted 6 lines

For new files, in checkpatch we validate that SPDX-License-Identifier is explicitly set as GPL-2.0-or-later. Contributors are expected to justify any divergence in the commit message.

I've seen guidance that SPDX-License-Identifier for AI output code should NOT state a license, under the theory it is public domain.

Not state a license? Recommended by a lawyer? Seen where? Why?

https://www.redhat.com/en/blog/ai-assisted-development-and-open-source-navigating-legal-issues

"The harder case is when an entire source file, or even
an entire repository, is generated by AI. Here, adding a copyright and license notice may be inappropriate unless and until human contributions transform the file into a copyrightable work. "

I interpret that to suggest we should not automatically use
SPDX-License-Identifier: GPL-2.0-or-later on LLM generated code, unless subsequent human editting was non-trivial.

Quoted 6 lines
Quoted 3 lines

Ultimately QEMU is a copyleft project as a whole and IMHO we should prioritize retaining that for as large a portion of the codebase is is practical.

But of course. We can make this explicit too: that contributing it should be under GPL and/or implies licensing it under GPL.

Quoted 8 lines

The subtlety is that generally when changing an existing file, you assume the edits are under the same licence as the initial code being editted.

If the initial code is LLM generated & thus presumed public domain, it might be inferred that human edits are public domain too. I don't think we want to have that interpretation and should be explicit that human edits to LLM code in code are assumed to be GPL-2.0-or-later licensed unless explicitly stated to the contrary.

Oh intresting! Thanks! So maybe we should decline whole new files for now unless it's a reorg of existing code so it inherits SPDX.

Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

It would definitely be intended for merge. There's a lot of boilerplate code in the Rust bindings, for example, that is voluminous but *mostly* lacks creativity---the creative part basically can be described by the spec/docs and should already clear the low bar required for originality, even if the code is automatically generated. I included a couple examples in my reply to Peter.

Quoted 8 lines
Quoted 5 lines

So we know there are examples which are probably low risk from a license POV, but which are massively larger than 20 lines of code. This just makes me more uncomfortable with the 20 line rule as the definition of the policy - we know that rule is wrong / undesirable from the start and needs this exception to make it viable.

So 20 lines or mechanical changes? what is considered mechanical will be decided by maintainers, contributor should check with them up front.

If we are wanting to allow mechanical changes / boilerplate, then we should express that in the policy such that the policy can be reasonably understood without having to ask permission / questions ahead of time.

Quoted 7 lines
Quoted 1 line

Indeed but what is mechanical is a matter of taste.

I really don't think it can/should be left to a matter of personal taste.

Something is "mechanical" if it can be assumed that any reasonable contributor / maintainer would look at it and agree with that idea.

Oh I agree. So "clearly mechanical" or "obviously mechanical". And some examples.

Quoted 3 lines

If there is any significant (liklihood of) disagreement on whether it is mechanical or not, then IMHO we should assume it is NOT mechanical.

Right.

Quoted 6 lines

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#26 lore raw
Quoted 100 lines · Michael S. Tsirkin
Quoted 99 lines · Daniel P. Berrangé
Quoted 68 lines · Michael S. Tsirkin
Quoted 67 lines · Daniel P. Berrangé
Quoted 65 lines · Michael S. Tsirkin
Quoted 51 lines · Daniel P. Berrangé
Quoted 14 lines · Paolo Bonzini

Il mer 3 giu 2026, 19:54 Daniel P. Berrangé <[email protected]> ha scritto:

Quoted 4 lines

The AI policy should just
make a point that we expect to be communicating with people not bots pretending to be people.

Yes, it's better to have that stated clearly.

Quoted 4 lines

True but we also need a rule. The spirit is better explained elsewhere

Quoted 2 lines

(and also, building consensus on spirit vs. a rule are two different things).

Quoted 7 lines
Quoted 2 lines

Do we have a better elsewhere in this case ? It is a point specifically about intent of the AI policy rule.

The rule in this draft says 20 lines, tests, mechanical changes and docs. The spirit is what is in the commit message, basically to maximize the benefit and limit the possible damage?

Putting "the spirit" in the commit message is essentially /dev/null to anyone reading the policy later.

Quoted 20 lines
Quoted 4 lines

See my reply to Peter elsewhere in the thread. I agree with your

Quoted 3 lines

concerns for both docs and discretion, but I had specific uses in mind that I'd like to allow.

Quoted 8 lines
Quoted 2 lines

For docs:
- create tutorials and/or feature documentation based on functional tests

That doesn't sound too appealing to me. Reverse engineering docs or tutorials from our functional tests is exactly the kind of thing that feels likely to result in volumous text of marginal value which will have a large burden on reviewers.

At the same time this can be helpful for maintainers themselves? Let's also look at this from the point of view of producing better output, not just from that of being on the receiving end of slop. Especially for docs I have a hard time imagining people sending out whole new "manuals"... The bugfixes rule ironically seems the most dangerous to me from the Dunning-Krueger point of view.

Quoted 4 lines

My question is: do we want disclosure for anything is created with the help of LLMs, even if only small parts survive untouched? I think so, because a lot more, even if edited, would still be originally from AI. But then it's important to have rules allowing it and a way to track it.

Quoted 7 lines

IMHO need unconditional disclosure, because the use of the LLM impacts the license of the code. QEMU is traditionally expected to be GPLv2+ licensed for all new code, but there's the train of thought that LLM code is public domain.
If it gets human editting afterwards we can
consider that the human edits are GPLv2+ licensed, but IMHO we still want to know the origins.

Wait that's a big ask.

DOC explicitly does not ask if code might be available anywhere else under any other license. Just that contributor can contribute under GPL. If it's public domain then the human can license is under GPL.

Quoted 8 lines
Quoted 6 lines

For new files, in checkpatch we validate that SPDX-License-Identifier is explicitly set as GPL-2.0-or-later. Contributors are expected to justify any divergence in the commit message.

I've seen guidance that SPDX-License-Identifier for AI output code should NOT state a license, under the theory it is public domain.

Not state a license? Recommended by a lawyer? Seen where? Why?

https://www.redhat.com/en/blog/ai-assisted-development-and-open-source-navigating-legal-issues

"The harder case is when an entire source file, or even
an entire repository, is generated by AI. Here, adding a copyright and license notice may be inappropriate unless and until human contributions transform the file into a copyrightable work. "

I interpret that to suggest we should not automatically use
SPDX-License-Identifier: GPL-2.0-or-later on LLM generated code, unless subsequent human editting was non-trivial.

Quoted 6 lines
Quoted 3 lines

Ultimately QEMU is a copyleft project as a whole and IMHO we should prioritize retaining that for as large a portion of the codebase is is practical.

But of course. We can make this explicit too: that contributing it should be under GPL and/or implies licensing it under GPL.

The subtlety is that generally when changing an existing file, you assume the edits are under the same licence as the initial code being editted.

Quoted 8 lines
Quoted 5 lines

If the initial code is LLM generated & thus presumed public domain, it might be inferred that human edits are public domain too. I don't think we want to have that interpretation and should be explicit that human edits to LLM code in code are assumed to be GPL-2.0-or-later licensed unless explicitly stated to the contrary.

Oh intresting! Thanks! So maybe we should decline whole new files for now unless it's a reorg of existing code so it inherits SPDX.

I think the "new file" case is probably relevant for Paolo's example though of using an LLM for some Rust boilerplate, and then editting afterwards.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#27 lore raw
In reply to Daniel P. Berrangé
Quoted 7 lines · Daniel P. Berrangé
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

IMHO need unconditional disclosure, because the use of the LLM impacts the license of the code. QEMU is traditionally expected to be GPLv2+ licensed for all new code, but there's the train of thought that LLM code is public domain.
If it gets human editting afterwards we can
consider that the human edits are GPLv2+ licensed, but IMHO we still want to know the origins.

I agree - but then we need to allow certain kind of documentation generation in the policy.

Quoted 3 lines

I interpret that to suggest we should not automatically use
SPDX-License-Identifier: GPL-2.0-or-later on LLM generated code, unless subsequent human editting was non-trivial.

I don't think we will have anytime soon LLM generated files with no human editing. Maybe for tests, but even then I expect _some_ kind of nontrivial editing to be there.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

It would definitely be intended for merge. There's a lot of boilerplate code in the Rust bindings, for example, that is voluminous but *mostly* lacks creativity---the creative part basically can be described by the spec/docs and should already clear the low bar required for originality, even if the code is automatically generated. I included a couple examples in my reply to Peter.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

So we know there are examples which are probably low risk from a license POV, but which are massively larger than 20 lines of code. This just makes me more uncomfortable with the 20 line rule as the definition of the policy - we know that rule is wrong / undesirable from the start and needs this exception to make it viable.

The 20 lines proposal applies only to bugfixes, which have a higher creative content. The other categories currently under discussions are:

                creativity    size      risk    removal/replacement
mech. changes   LOW/NONE      LARGE     **      one way to do it
boilerplate*    LOW/NONE      LARGE     LOW     mostly one way to do it
docs            ***           LARGE     LOW     EASY
tests           MID           LARGE     MID     EASY
bugfixes        HIGH          SMALL     ??      ??

* under discussion, not in draft
** copyrightability of these changes is debatable altogether, since they would/could/should be doable with tools even in the absence of AI *** depends, but generally the more creative uses would need large cooperation/rework from a human

and it's clear that bugfixes stand out. Which is why I added the (arbitrary, I concede) 20 line rule only for them. I can remove them.

(There's another category that is a can of worms and that I left out, which is the "fancy stackoverflow" category sitting between simple autocomplete and full generation).

Quoted 9 lines

I really don't think it can/should be left to a matter of personal taste.

Something is "mechanical" if it can be assumed that any reasonable contributor / maintainer would look at it and agree with that idea.

If there is any significant (liklihood of) disagreement on whether it is mechanical or not, then IMHO we should assume it is NOT mechanical.

Fair enough---for now, since I don't see us adding more blanket categories, can we say that individual exceptions are possible but need to be discussed on the list?

Paolo

#28 lore raw
In reply to Daniel P. Berrangé
Quoted 86 lines · Daniel P. Berrangé
Quoted 68 lines · Michael S. Tsirkin
Quoted 67 lines · Daniel P. Berrangé
Quoted 65 lines · Michael S. Tsirkin
Quoted 51 lines · Daniel P. Berrangé
Quoted 14 lines · Paolo Bonzini

Il mer 3 giu 2026, 19:54 Daniel P. Berrangé <[email protected]> ha scritto:

Quoted 4 lines

The AI policy should just
make a point that we expect to be communicating with people not bots pretending to be people.

Yes, it's better to have that stated clearly.

Quoted 4 lines

True but we also need a rule. The spirit is better explained elsewhere

Quoted 2 lines

(and also, building consensus on spirit vs. a rule are two different things).

Quoted 7 lines
Quoted 2 lines

Do we have a better elsewhere in this case ? It is a point specifically about intent of the AI policy rule.

The rule in this draft says 20 lines, tests, mechanical changes and docs. The spirit is what is in the commit message, basically to maximize the benefit and limit the possible damage?

Putting "the spirit" in the commit message is essentially /dev/null to anyone reading the policy later.

Quoted 20 lines
Quoted 4 lines

See my reply to Peter elsewhere in the thread. I agree with your

Quoted 3 lines

concerns for both docs and discretion, but I had specific uses in mind that I'd like to allow.

Quoted 8 lines
Quoted 2 lines

For docs:
- create tutorials and/or feature documentation based on functional tests

That doesn't sound too appealing to me. Reverse engineering docs or tutorials from our functional tests is exactly the kind of thing that feels likely to result in volumous text of marginal value which will have a large burden on reviewers.

At the same time this can be helpful for maintainers themselves? Let's also look at this from the point of view of producing better output, not just from that of being on the receiving end of slop. Especially for docs I have a hard time imagining people sending out whole new "manuals"... The bugfixes rule ironically seems the most dangerous to me from the Dunning-Krueger point of view.

Quoted 4 lines

My question is: do we want disclosure for anything is created with the help of LLMs, even if only small parts survive untouched? I think so, because a lot more, even if edited, would still be originally from AI. But then it's important to have rules allowing it and a way to track it.

Quoted 7 lines

IMHO need unconditional disclosure, because the use of the LLM impacts the license of the code. QEMU is traditionally expected to be GPLv2+ licensed for all new code, but there's the train of thought that LLM code is public domain.
If it gets human editting afterwards we can
consider that the human edits are GPLv2+ licensed, but IMHO we still want to know the origins.

Wait that's a big ask.

DOC explicitly does not ask if code might be available anywhere else under any other license. Just that contributor can contribute under GPL. If it's public domain then the human can license is under GPL.

Quoted 8 lines
Quoted 6 lines

For new files, in checkpatch we validate that SPDX-License-Identifier is explicitly set as GPL-2.0-or-later. Contributors are expected to justify any divergence in the commit message.

I've seen guidance that SPDX-License-Identifier for AI output code should NOT state a license, under the theory it is public domain.

Not state a license? Recommended by a lawyer? Seen where? Why?

https://www.redhat.com/en/blog/ai-assisted-development-and-open-source-navigating-legal-issues

"The harder case is when an entire source file, or even
an entire repository, is generated by AI. Here, adding a copyright and license notice may be inappropriate unless and until human contributions transform the file into a copyrightable work. "

Quoted 3 lines

I interpret that to suggest we should not automatically use
SPDX-License-Identifier: GPL-2.0-or-later on LLM generated code, unless subsequent human editting was non-trivial.

The presumtion that LLM generated code is public domain is dubious. If you tell it to regenerate part of QEMU source after it has seen the GPL sources and it comes up with something equivalent does that make the generated version public domain? If so people could just rewrite GPL code and make it proprietary. This can't be right as the generated code will likely contain parts copied from the original so still fall under GPL. What if I just tell LLM to rewrite QEMU in C++? Will that make a public domain version that I can then make closed source even though it still contains large parts of GPL code? I don't think so. The code generated by LLM comes from somewhere but nobody can tell where from so also nobody knows what licence it is. If you're lucky it comes from examples or other sources with a free licence but could be anything even some open source code not compatible with GPL or proprietary code. The idea of public domain probably comes from that there's no human to hold the copyright but what about cases of copying copyleft code by LLM that should not make it public domain. This is similar to the case when somebody who worked on a proprietary code before then writes some open source code that does similar things or vice versa. What is the legal status of those cases? Can the other party claim copyright for the code? Probably only if the person recalls whole parts that resemble each other closely which could happen. The risk is probably the same with LLMs and thus the handling of this should be similar probably. This seems more complex than assuming anthing from an LLM is public domain.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Ultimately QEMU is a copyleft project as a whole and IMHO we should prioritize retaining that for as large a portion of the codebase is is practical.

But of course. We can make this explicit too: that contributing it should be under GPL and/or implies licensing it under GPL.

Quoted 8 lines

The subtlety is that generally when changing an existing file, you assume the edits are under the same licence as the initial code being editted.

If the initial code is LLM generated & thus presumed public domain, it might be inferred that human edits are public domain too. I don't think we want to have that interpretation and should be explicit that human edits to LLM code in code are assumed to be GPL-2.0-or-later licensed unless explicitly stated to the contrary.

The LICENSE file in QEMU says that sources without a licence are GPL-2.0-or-later so if you add public domain code, it will be that licence as part of QEMU and won't retain original public domain status.

Regards,
BALATON Zoltan

#29 lore raw
Quoted 54 lines · BALATON Zoltan
Quoted 35 lines · Daniel P. Berrangé
Quoted 17 lines · Michael S. Tsirkin
Quoted 16 lines · Daniel P. Berrangé
Quoted 14 lines · Michael S. Tsirkin
Quoted 7 lines · Daniel P. Berrangé

IMHO need unconditional disclosure, because the use of the LLM impacts the license of the code. QEMU is traditionally expected to be GPLv2+ licensed for all new code, but there's the train of thought that LLM code is public domain.
If it gets human editting afterwards we can
consider that the human edits are GPLv2+ licensed, but IMHO we still want to know the origins.

Wait that's a big ask.

DOC explicitly does not ask if code might be available anywhere else under any other license. Just that contributor can contribute under GPL. If it's public domain then the human can license is under GPL.

Quoted 8 lines
Quoted 6 lines

For new files, in checkpatch we validate that SPDX-License-Identifier is explicitly set as GPL-2.0-or-later. Contributors are expected to justify any divergence in the commit message.

I've seen guidance that SPDX-License-Identifier for AI output code should NOT state a license, under the theory it is public domain.

Not state a license? Recommended by a lawyer? Seen where? Why?

https://www.redhat.com/en/blog/ai-assisted-development-and-open-source-navigating-legal-issues

"The harder case is when an entire source file, or even
an entire repository, is generated by AI. Here, adding a copyright and license notice may be inappropriate unless and until human contributions transform the file into a copyrightable work. "

Quoted 3 lines

I interpret that to suggest we should not automatically use
SPDX-License-Identifier: GPL-2.0-or-later on LLM generated code, unless subsequent human editting was non-trivial.

The presumtion that LLM generated code is public domain is dubious. If you tell it to regenerate part of QEMU source after it has seen the GPL sources and it comes up with something equivalent does that make the generated version public domain? If so people could just rewrite GPL code and make it proprietary. This can't be right as the generated code will likely contain parts copied from the original so still fall under GPL. What if I just tell LLM to rewrite QEMU in C++? Will that make a public domain version that I can then make closed source even though it still contains large parts of GPL code? I don't think so. The code generated by LLM comes from somewhere but nobody can tell where from so also nobody knows what licence it is. If you're lucky it comes from examples or other sources with a free licence but could be anything even some open source code not compatible with GPL or proprietary code. The idea of public domain probably comes from that there's no human to hold the copyright but what about cases of copying copyleft code

Quoted 8 lines

by LLM that should not make it public domain. This is similar to the case when somebody who worked on a proprietary code before then writes some open source code that does similar things or vice versa. What is the legal status of those cases? Can the other party claim copyright for the code? Probably only if the person recalls whole parts that resemble each other closely which could happen. The risk is probably the same with LLMs and thus the handling of this should be similar probably. This seems more complex than assuming anthing from an LLM is public domain.

Yes, I should have clarified my comments better. I did not mean to imply that everything/anything from an LLM is public domain.

The "public domain" argument does indeed come from the idea that only humans can own copyright, and IMHO can apply *only* in the case where you can credibly consider it to NOT be a direct derived work of an existing licensed work.

If you're instructing an AI to clone QEMU into a different language there's a strong argument the result would be a derived work.

If you're instructing an AI to write a non-trivial feature with creative work and that is following a non-trivial design pattern that is common in other areas of QEMU, there's also a decent argument that the result would be a derived work and thus also liable to be GPL.

This is not the kind of usage that's being proposed for QEMU though. The kind of scenarios being considered are borderline for creativity and thus questionable whether they would meet the threshold for copyrightability even for a human author.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#30 lore raw
In reply to Paolo Bonzini
Quoted 5 lines · Paolo Bonzini

Hi Daniel,

Thanks for the review. It will take a while to incorporate everything and I'll wait for more feedback, in the meantime just a couple things I can confirm or add...

I mean you could just let the LLM handle it ;-)

AI-used-for: collecting comments and updating patch

I only include this by way of an experiment. I think the new text does cover the discussion although I think it has taken a fair amount of verbatim text from the source messages that were commentary rather than suggestions.

--8<---------------cut here---------------start------------->8---

---
 docs/devel/ai-usage.rst        | 149 +++++++++++++++++++++++++++++++++
 docs/devel/code-provenance.rst | 115 ++-----------------------
 docs/devel/index-process.rst   |   1 +
 3 files changed, 159 insertions(+), 106 deletions(-)
 create mode 100644 docs/devel/ai-usage.rst
docs/devel/ai-usage.rst new file +149 -0
new file mode 100644
index 00000000000..99533c92050
@@ -0,0 +1,149 @@
+.. _ai-usage:
+
+Use of AI-assisted tools
+========================
+
+The increasing prevalence of AI-assisted software development, and especially
+the use of content generated by `Large Language Models
+<https://en.wikipedia.org/wiki/Large_language_model>`__ (LLMs), poses a number
+of difficult questions and risks for open-source projects.
+
+Risks to open-source projects include maintainer burnout from an increased
+volume of low-quality contributions, as well as the risk of unintentional
+inclusion of copyrighted material. While the likelihood of legal issues arising
+from LLM-generated code may appear low, copyright infringement is a "slow burn"
+risk where legal complications can accumulate over time and may not be litigated
+immediately.
+
+In order to mitigate these risks, the QEMU project maintains strict boundaries on
+where and how AI-assisted tools can be used to generate contributions, emphasizing
+transparency, human accountability, and human-to-human collaboration.
+
+Collaboration and Human Trust
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+At its core, QEMU development is built on trust, peer interaction, and
+long-term relationships between human developers. AI tools should be viewed
+strictly as productivity aids, not as peer contributors.
+
+Accountability for every change always remains entirely with the human authors
+and reviewers. In keeping with this principle:
+
+* **Review conversations must be human-to-human.** If a reviewer gives feedback
+  on your patch, you must not simply feed their comments into an LLM and
+  copy-paste its response back to the mailing list. Your replies should reflect
+  your own understanding, reasoning, and technical judgment.
+* **Reviewers must be transparent.** If you use AI-assisted tools to help review
+  a patch, you must be transparent and clearly disclose if any part of the
+  feedback was derived from a model's output.
+* **Identities must be genuine.** QEMU welcomes pseudonyms, but they must
+  reflect a real human contributor. AI agents must not be given pseudonymous
+  human identities to submit or discuss code.
+
+Signed-off-by and Developer Certificate of Origin
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Only humans can legally certify the Developer Certificate of Origin (DCO).
+Under no circumstances may an AI tool or automated agent add a
+``Signed-off-by`` tag to a commit or submit a patch on behalf of a human.
+The human submitter is responsible for:
+
+* Reviewing and thoroughly understanding all AI-generated code.
+* Ensuring compliance with licensing and code provenance requirements.
+* Manually adding their own ``Signed-off-by`` tag to certify the DCO.
+* Taking full responsibility for the contribution.
+
+Permitted AI-assisted Scenarios
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+QEMU allows using AI/LLM tools to produce patches in a limited set of scenarios:
+
+**Mechanical changes**
+  If you can use a deterministic tool or script, it is preferred that you use it
+  and not replace it with AI. If you don't know how to do the change
+  deterministically, you can ask the AI for help.
+
+**Small bug fixes**
+  These should be limited to 20 lines of code or less, not including tests.
+  The rationale for this limit is two-fold: such changes are usually unlikely to
+  meet the threshold for copyrightability, and if they do turn out to have legal
+  or technical issues, they are small enough that the consequences of reverting
+  them are negligible. They are also usually tightly coupled to the specific existing
+  state of QEMU's codebase, making them highly original. Even for small fixes, you
+  are still expected to fully understand the change and the reasoning behind it.
+
+**Documentation and code comments**
+  AI is extremely helpful for non-native English speakers to perform grammar and
+  spelling checks, or to translate their own draft text. However, AI should
+  NOT be used to write or draft prose documentation from scratch without a detailed
+  human-written outline.
+
+  As a general rule, AI-assisted content is much more acceptable for inline API
+  documentation or code comments (where the code itself provides strong guardrails)
+  than for prose documentation under ``docs/``. High-level human oversight is always
+  required: pay close attention to the organization and flow of any generated text,
+  and strictly fact-check all technical details as LLMs are prone to being
+  confidently wrong.
+
+**Tests**
+  Note that you must still confirm that each test actually exercises the
+  intended behavior including, for regression tests, that it fails without the
+  code under test and passes for the right reason.
+
+These boundaries do not apply to "background" uses of AI, such as researching
+APIs or algorithms, static analysis, or debugging, provided the model's output
+is not directly included in contributions.
+
+Large-scale AI-assisted changes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you wish to submit larger volumes of AI-generated changes, or any other
+contribution not falling into the permitted categories above, you must consult
+the relevant subsystem maintainers and the wider community on the ``qemu-devel``
+mailing list *before* starting the work.
+
+Such contributions may be treated as carefully bounded experiments, by broad
+consensus of the project, with no prior obligation to accept them. Individual
+maintainers should not unilaterally accept large-scale AI-authored code that
+bypasses the general policy guidelines.
+
+Commit Messages for AI-assisted Changes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AI tools **must not be used to write commit messages**. The act of summarizing and
+explaining the reasoning for your changes is a critical demonstration of the human
+author's understanding of the commit. However, it is entirely permissible to use
+an AI tool to check and correct grammar and spelling in your own drafts.
+
+When AI/LLM tools produce or substantively shape the content of the submitted patch,
+add an ``AI-used-for:`` tag before ``Signed-off-by``, as a reminder of your DCO
+obligations and a guide to reviewers. The text is one or more of ``code``, ``tests``,
+``docs``, ``research``, possibly followed by an explanation in parentheses:
+
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as autocomplete,
+spell-checking, or obtaining an initial pre-review of the patch.
+
+Including prompt text or summarizing your exact conversation with the AI in the commit
+message is generally discouraged, as it often adds clutter. The commit message should
+instead focus on a clear, human-authored explanation of the change's design and intent.
+
+However, if a patch is being submitted under an agreed-upon experiment (e.g., generating
+complex Rust procedural macro parsing code), or if you believe sharing a highly specific,
+constraint-based prompt is genuinely useful for the reviewer to verify the code's
+boundaries, you may include it in the commit message or cover letter.
+
+QEMU explicitly **forbids** the use of ``Assisted-by``, ``Co-authored-by``, or
+``Generated-by`` tags to attribute AI models or tools. To avoid providing unintended
+advertising for commercial AI services and maintain clean project metadata, only the
+``AI-used-for:`` tag should be used.
+
+Deterministic tooling (such as ``sed``, Coccinelle, or code formatters) is out of
+scope for the ``AI-used-for:`` tag, but should be mentioned in the commit message.
docs/devel/code-provenance.rst +9 -106

128 lines not on this page · raw message

docs/devel/index-process.rst +1 -0
index 5807752d704..1aa86e9e43e 100644
@@ -14,6 +14,7 @@ Notes about how to interact with the community and how and where to submit patch
    style
    submitting-a-patch
    code-provenance
+   ai-usage
    trivial-patches
    stable-process
    submitting-a-pull-request
Signature · 45 lines
2.47.3
--8<---------------cut here---------------end--------------->8---

For completeness bellow is the LLM's summary of what it did:

I have thoroughly reviewed the mailing list discussion regarding the proposed relaxed AI policy and have successfully implemented the requested modifications. 

To achieve this, the policy has been split into a dedicated document, and we have integrated the critical feedback regarding social expectations, human-centric trust, explicit prohibitions on AI-generated commit messages and sign-offs, and project-wide consensus on experiments.

Here is a summary of how each reviewer's comments and suggestions from the discussion thread were addressed:

### 1. Structure & Organization (Daniel P. Berrangé / Paolo Bonzini)
* **Separate Document (`docs/devel/ai-usage.rst`):** As suggested by Daniel and agreed upon by Paolo, the AI policy has been extracted from `code-provenance.rst` into its own file, `ai-usage.rst`. This avoids cluttering the main code provenance pages and allows direct linking.
* **TOC Registration:** Added `ai-usage` to the main developer process index (`docs/devel/index-process.rst`).
* **Agent Guidelines (`AGENTS.md`):** Updated QEMU agent directives in `AGENTS.md` to reference the new policy document (`docs/devel/ai-usage.rst`) at the correct location.

### 2. Social Expectations & Human Trust (Daniel P. Berrangé)
* **Human-to-Human Collaboration:** Added a dedicated section emphasizing that QEMU is built on trust and peer relationships between human developers.
* **No Bot Conversations:** Explicitly prohibited feeding review comments into an LLM and copy-pasting the output back to the mailing list.
* **Transparency in Review:** Required reviewers who use AI tools to disclose that part of their feedback comes from a model.
* **Identity Authenticity:** Prohibited using pseudonyms to hide automated AI agents pretending to be human contributors.

### 3. Signed-off-by and DCO (Daniel P. Berrangé)
* **Human-Only Sign-off:** Reinforced that *only humans can legally certify the DCO*. 
* **Explicit Prohibition of Automated Signatures:** Explicitly stated that AI agents and tools must not add a `Signed-off-by` tag to commits.
* **Double Placement:** Integrated this restriction both in the general `code-provenance.rst` tag section and the new `ai-usage.rst` document.

### 4. Technical Constraints on Scenarios (Peter Maydell / Daniel P. Berrangé / Alex Bennée / BALATON Zoltan)
* **Deterministic Tooling:** Under "Mechanical changes," changed "deterministic tool" to "deterministic tool or script" as requested by Alex.
* **Small Bug Fixes Rationale:** Elaborated the "why" behind the 20-line limit (low copyright risk, easy to revert, tight coupling to specific QEMU code ensures originality), addressing Daniel's concern.
* **Documentation & Prose Slop:** Addressed Peter and Daniel's concerns by clarifying that AI should **not** write prose documentation from scratch. It is permitted for spelling/grammar checks of human-written drafts, translation, or inline API comments/docs where the surrounding code provides guardrails.
* **Stray Typography:** Corrected the stray `**` in the warning box found by Alex.
* **Tags vs. Trailers:** Unified terminology across the documents, preferring "tags" to "trailers" as noted by Zoltan.

### 5. Commit Messages & Prompts (Alex Bennée / Daniel P. Berrangé)
* **Prohibition on AI-written Commit Messages:** Added an explicit statement that AI must not be used to write commit messages, but can check/correct grammar of a human-authored draft (addressing both Alex and Michael S. Tsirkin's inputs).
* **Prompt Discretion:** Addressed Daniel's concern by actively discouraging the inclusion of prompts in standard commit messages to avoid clutter. Prompts are permitted only in highly specific, agreed-upon cases (e.g., experimental code generation like Rust procedural macros).
* **AI Attribute Tags:** Explicitly banned the use of `Assisted-by`, `Co-authored-by`, and `Generated-by` tags for AI models to prevent commercial advertising. Only the custom `AI-used-for:` tag is permitted.

### 6. Subsystem Maintainer Discretion (Peter Maydell / Daniel P. Berrangé)
* **Community Consensus for Exceptions:** Rephrased the guidelines to state that larger-scale AI-assisted contributions must be discussed on `qemu-devel` with maintainers and the wider community *before* the work is begun. Individual maintainers cannot unilaterally accept large-scale AI-authored changes outside the policy guidelines.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
#31 lore raw
Quoted 10 lines · Alex Bennée
Quoted 5 lines · Paolo Bonzini

Hi Daniel,

Thanks for the review. It will take a while to incorporate everything and I'll wait for more feedback, in the meantime just a couple things I can confirm or add...

I mean you could just let the LLM handle it ;-)

Quoted 7 lines

AI-used-for: collecting comments and updating patch

I only include this by way of an experiment. I think the new text does cover the discussion although I think it has taken a fair amount of verbatim text from the source messages that were commentary rather than suggestions.

Most importantly it has applied no critical thought to the review comments, seemingly treated them all as mostly equally important and incorporated them. The resulting text is more volumous than Paolo's, has poor structure and in places is verging on what I'd class as slop.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#32 lore raw
Quoted 19 lines · Daniel P. Berrangé
Quoted 10 lines · Alex Bennée
Quoted 5 lines · Paolo Bonzini

Hi Daniel,

Thanks for the review. It will take a while to incorporate everything and I'll wait for more feedback, in the meantime just a couple things I can confirm or add...

I mean you could just let the LLM handle it ;-)

Quoted 7 lines

AI-used-for: collecting comments and updating patch

I only include this by way of an experiment. I think the new text does cover the discussion although I think it has taken a fair amount of verbatim text from the source messages that were commentary rather than suggestions.

Quoted 5 lines

Most importantly it has applied no critical thought to the review comments, seemingly treated them all as mostly equally important and incorporated them. The resulting text is more volumous than Paolo's, has poor structure and in places is verging on what I'd class as slop.

Well there is no "thought", although its pretty good at text extraction from the mailing thread. I guess that's the "attention" part of the model.

It wasn't helped by the fact there was a full lift and shift of the AI section to a new document. In my other experiments with documentation I've let the model do the changes and then I can review each hunk and reword as I go.

For code changes I've found it pretty good - enough so that it might replace my hand-rolled mechanism for saving review comments:
https://github.com/stsquad/my-emacs-stuff/blob/master/my-org.el#L176

Quoted 4 lines

With regards,
Daniel

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#33 lore raw
In reply to Alex Bennée
Quoted 9 lines · Alex Bennée
Quoted 5 lines · Paolo Bonzini

Hi Daniel,

Thanks for the review. It will take a while to incorporate everything and I'll wait for more feedback, in the meantime just a couple things I can confirm or add...

I mean you could just let the LLM handle it ;-)

One has to like that )

#34 lore raw
In reply to Paolo Bonzini

Am 03.06.2026 um 17:35 hat Paolo Bonzini geschrieben:

Quoted 11 lines
Quoted 10 lines

docs/devel/code-provenance.rst content generators below. · line 316

Quoted 4 lines
docs/devel/code-provenance.rst +4 -0
+**Small bug fixes**
+  These should be limited to 20 lines of code or less, not including
+  tests.  You are still expected to :ref:`understand and explain your changes
+  <write_a_meaningful_commit_message>` and the rationale behind them.

I think the "20 lines or less" is not going a good job at expressing the intent behind this point. I'd like us to emphasize between the "why" of this point, as that helps contributors & reviewers make a decision of whether a change is "within the spirit" or the rule of not.

Quoted 3 lines

True but we also need a rule. The spirit is better explained elsewhere (and also, building consensus on spirit vs. a rule are two different things).

But "20 lines or less" is still not a good rule because it measures something that isn't really what we're after. The rule is "trivial code", and yes, there is no good way to measure that. But that's not a good reason to replace it with a metric as good as defining productivity of an engineer by lines of code added.

Can we turn this just into an example, and also be a bit more specific? Like "20 lines of low complexity code"? (Or is it more like "moderate complexity" that you have in mind?) But it's definitely possible to write 20 lines that aren't trivial at all, so the rule shouldn't allow that.

Quoted 8 lines
Quoted 4 lines

Docs is an area I'm more wary of from the social expectation side rather than the technical or legal side. I don't feeel like "pay attention to the organization and flow" really mitigates to the tendancy to production of vast reams of convincing sounding slop.

Reviewers have no obligation to review. The good thing about slop is that saying no takes about the same effort as the author put into the creation of the change.

Just saying "no, because I don't feel like reviewing this" is actually a new thing for most of us, and doesn't feel very comfortable. We may need to get used to it, but I don't think it's easy.

Quoted 10 lines
Quoted 6 lines

docs/devel/code-provenance.rst content generators below. · line 368

Quoted 3 lines
docs/devel/code-provenance.rst +3 -0
+There is no requirement to include your prompts or summarize the
+conversation in the commit message or cover letter, but you may do so
+if you think it helps a reviewer judge the result.  For example:

IMHO we should actively discourage the inclusion of prompts entirely as it is the wrong information to provide.

Why? I think it helps especially in the case where we're asking for maintainers to apply their discretion, and for reproducibility. It may not be always applicable, but it can also help.

Not sure how much reproducibility there can possibly be with LLMs. :-)

Kevin

#35 lore raw
Quoted 33 lines · Kevin Wolf

Am 03.06.2026 um 17:35 hat Paolo Bonzini geschrieben:

Quoted 11 lines
Quoted 10 lines

docs/devel/code-provenance.rst content generators below. · line 316

Quoted 4 lines
docs/devel/code-provenance.rst +4 -0
+**Small bug fixes**
+  These should be limited to 20 lines of code or less, not including
+  tests.  You are still expected to :ref:`understand and explain your changes
+  <write_a_meaningful_commit_message>` and the rationale behind them.

I think the "20 lines or less" is not going a good job at expressing the intent behind this point. I'd like us to emphasize between the "why" of this point, as that helps contributors & reviewers make a decision of whether a change is "within the spirit" or the rule of not.

Quoted 3 lines

True but we also need a rule. The spirit is better explained elsewhere (and also, building consensus on spirit vs. a rule are two different things).

But "20 lines or less" is still not a good rule because it measures something that isn't really what we're after. The rule is "trivial code", and yes, there is no good way to measure that. But that's not a good reason to replace it with a metric as good as defining productivity of an engineer by lines of code added.

Can we turn this just into an example, and also be a bit more specific? Like "20 lines of low complexity code"? (Or is it more like "moderate complexity" that you have in mind?) But it's definitely possible to write 20 lines that aren't trivial at all, so the rule shouldn't allow that.

Quoted 5 lines
Quoted 4 lines

Docs is an area I'm more wary of from the social expectation side rather than the technical or legal side. I don't feeel like "pay attention to the organization and flow" really mitigates to the tendancy to production of vast reams of convincing sounding slop.

Quoted 7 lines
Quoted 3 lines

Reviewers have no obligation to review. The good thing about slop is that saying no takes about the same effort as the author put into the creation of the change.

Just saying "no, because I don't feel like reviewing this" is actually a new thing for most of us, and doesn't feel very comfortable. We may need to get used to it, but I don't think it's easy.

If someone repeatedly sends me slop, defined as code/text they did not read, I will warn them and eventually start ignoring them. We can mention it's something maintainers can do.

Quoted 14 lines
Quoted 10 lines
Quoted 6 lines

docs/devel/code-provenance.rst content generators below. · line 368

Quoted 3 lines
docs/devel/code-provenance.rst +3 -0
+There is no requirement to include your prompts or summarize the
+conversation in the commit message or cover letter, but you may do so
+if you think it helps a reviewer judge the result.  For example:

IMHO we should actively discourage the inclusion of prompts entirely as it is the wrong information to provide.

Why? I think it helps especially in the case where we're asking for maintainers to apply their discretion, and for reproducibility. It may not be always applicable, but it can also help.

Not sure how much reproducibility there can possibly be with LLMs. :-)

Kevin

#36 lore raw
In reply to Paolo Bonzini

Am 29.05.26 um 11:46 schrieb Paolo Bonzini:

Quoted 5 lines
docs/devel/code-provenance.rst +0 -5
-Exceptions do not remove the need for authors to comply with all other
-requirements for contribution.  In particular, the "Signed-off-by"
-label in a patch submission is a statement that the author takes
-responsibility for the entire contents of the patch, including any parts
-that were generated or assisted by AI tools or other tools.

docs/devel/code-provenance.rst content generators below. · line 364

Quoted 10 lines
docs/devel/code-provenance.rst +10 -0
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.

So what about using AI for security scanning? So how do we want to treat a patch from a human that is based on an AI report.
And if ok, would we then add something like

Reported-by Claude, chatgpt whatever?
#37 lore raw
Quoted 11 lines · Christian Borntraeger

Am 29.05.26 um 11:46 schrieb Paolo Bonzini:

Quoted 10 lines
docs/devel/code-provenance.rst +5 -5
-Exceptions do not remove the need for authors to comply with all other
-requirements for contribution.  In particular, the "Signed-off-by"
-label in a patch submission is a statement that the author takes
-responsibility for the entire contents of the patch, including any parts
-that were generated or assisted by AI tools or other tools.
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
Quoted 8 lines

docs/devel/code-provenance.rst content generators below. · line 364

Quoted 5 lines
docs/devel/code-provenance.rst +5 -0
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.

So what about using AI for security scanning? So how do we want to treat a patch from a human that is based on an AI report.

This is ok by the current policy, too.

Quoted 3 lines

And if ok, would we then add something like

Reported-by Claude, chatgpt whatever?
Signature · 1 line
MST
#38 lore raw
In reply to Christian Borntraeger
Quoted 21 lines · Christian Borntraeger

Am 29.05.26 um 11:46 schrieb Paolo Bonzini:

Quoted 5 lines
docs/devel/code-provenance.rst +0 -5
-Exceptions do not remove the need for authors to comply with all other
-requirements for contribution.  In particular, the "Signed-off-by"
-label in a patch submission is a statement that the author takes
-responsibility for the entire contents of the patch, including any parts
-that were generated or assisted by AI tools or other tools.

docs/devel/code-provenance.rst content generators below. · line 364

Quoted 10 lines
docs/devel/code-provenance.rst +10 -0
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.

So what about using AI for security scanning? So how do we want to treat a patch from a human that is based on an AI report.
And if ok, would we then add something like

Quoted 1 line
Reported-by Claude, chatgpt whatever?

I see no need to provide advertizing for these tools.

Our security disclosure rules require that the submitter acknowledge they have reviewed any LLM output themselves before reporting. So from that POV it is the human who gave us the report and whom deserves the credit, not any tool or vendor.

FWIW, although pretty much every security report recently smells strongly of LLM (highly structured markdown with headings that look the same from all reporters), almost none of them credit the specific tool used anyway.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#39 lore raw
Quoted 31 lines · Daniel P. Berrangé
Quoted 21 lines · Christian Borntraeger

Am 29.05.26 um 11:46 schrieb Paolo Bonzini:

Quoted 5 lines
docs/devel/code-provenance.rst +0 -5
-Exceptions do not remove the need for authors to comply with all other
-requirements for contribution.  In particular, the "Signed-off-by"
-label in a patch submission is a statement that the author takes
-responsibility for the entire contents of the patch, including any parts
-that were generated or assisted by AI tools or other tools.

docs/devel/code-provenance.rst content generators below. · line 364

Quoted 10 lines
docs/devel/code-provenance.rst +10 -0
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.

So what about using AI for security scanning? So how do we want to treat a patch from a human that is based on an AI report.
And if ok, would we then add something like

Quoted 1 line
Reported-by Claude, chatgpt whatever?

I see no need to provide advertizing for these tools.

Our security disclosure rules require that the submitter acknowledge they have reviewed any LLM output themselves before reporting. So from that POV it is the human who gave us the report and whom deserves the credit, not any tool or vendor.

Quoted 4 lines

FWIW, although pretty much every security report recently smells strongly of LLM (highly structured markdown with headings that look the same from all reporters), almost none of them credit the specific tool used anyway.

We have created a new label Audit Tooling: AI in the issues but the most interesting thing about that is to see how AI does compared to existing fuzzing and static analysis techniques. The underlying model isn't super interesting here.

Quoted 3 lines

With regards,
Daniel

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#40 lore raw
In reply to Christian Borntraeger

Am 16.06.2026 um 19:06 hat Christian Borntraeger geschrieben:

Quoted 21 lines

Am 29.05.26 um 11:46 schrieb Paolo Bonzini:

Quoted 5 lines
docs/devel/code-provenance.rst +0 -5
-Exceptions do not remove the need for authors to comply with all other
-requirements for contribution.  In particular, the "Signed-off-by"
-label in a patch submission is a statement that the author takes
-responsibility for the entire contents of the patch, including any parts
-that were generated or assisted by AI tools or other tools.

docs/devel/code-provenance.rst content generators below. · line 364

Quoted 10 lines
docs/devel/code-provenance.rst +10 -0
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.

So what about using AI for security scanning? So how do we want to treat a patch from a human that is based on an AI report.
And if ok, would we then add something like

Quoted 1 line
Reported-by Claude, chatgpt whatever?

I think it's effectively the same as Coverity, which we don't acknowledge with a Reported-by tag, though we often mention it in the commit message text. The same practice would make sense to me here.

(Though of course for Coverity, we have the CID, which obviously doesn't exist for things found with a one-off LLM run, so there is some difference there.)

Kevin

#41 lore raw
Quoted 24 lines · Kevin Wolf

Am 16.06.2026 um 19:06 hat Christian Borntraeger geschrieben:

Quoted 21 lines

Am 29.05.26 um 11:46 schrieb Paolo Bonzini:

Quoted 5 lines
docs/devel/code-provenance.rst +0 -5
-Exceptions do not remove the need for authors to comply with all other
-requirements for contribution.  In particular, the "Signed-off-by"
-label in a patch submission is a statement that the author takes
-responsibility for the entire contents of the patch, including any parts
-that were generated or assisted by AI tools or other tools.

docs/devel/code-provenance.rst content generators below. · line 364

Quoted 10 lines
docs/devel/code-provenance.rst +10 -0
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.

So what about using AI for security scanning? So how do we want to treat a patch from a human that is based on an AI report.
And if ok, would we then add something like

Quoted 1 line
Reported-by Claude, chatgpt whatever?
Quoted 7 lines

I think it's effectively the same as Coverity, which we don't acknowledge with a Reported-by tag, though we often mention it in the commit message text. The same practice would make sense to me here.

(Though of course for Coverity, we have the CID, which obviously doesn't exist for things found with a one-off LLM run, so there is some difference there.)

Incidentally does any ever find the CID to be useful in the commit message ?

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#42 lore raw

Am 17.06.2026 um 10:49 hat Daniel P. Berrangé geschrieben:

Quoted 29 lines · Kevin Wolf
Quoted 28 lines

Am 16.06.2026 um 19:06 hat Christian Borntraeger geschrieben:

Quoted 21 lines

Am 29.05.26 um 11:46 schrieb Paolo Bonzini:

Quoted 5 lines
docs/devel/code-provenance.rst +0 -5
-Exceptions do not remove the need for authors to comply with all other
-requirements for contribution.  In particular, the "Signed-off-by"
-label in a patch submission is a statement that the author takes
-responsibility for the entire contents of the patch, including any parts
-that were generated or assisted by AI tools or other tools.

docs/devel/code-provenance.rst content generators below. · line 364

Quoted 10 lines
docs/devel/code-provenance.rst +10 -0
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.

So what about using AI for security scanning? So how do we want to treat a patch from a human that is based on an AI report.
And if ok, would we then add something like

Quoted 1 line
Reported-by Claude, chatgpt whatever?

I think it's effectively the same as Coverity, which we don't acknowledge with a Reported-by tag, though we often mention it in the commit message text. The same practice would make sense to me here.

Quoted 6 lines
Quoted 3 lines

(Though of course for Coverity, we have the CID, which obviously doesn't exist for things found with a one-off LLM run, so there is some difference there.)

Incidentally does any ever find the CID to be useful in the commit message ?

I've occasionally looked it up during review, but not sure if I ever made use of the permanent record in the git history.

Kevin

#43 lore raw
Quoted 7 lines · Kevin Wolf

Am 17.06.2026 um 10:49 hat Daniel P. Berrangé geschrieben:

Quoted 2 lines

Incidentally does any ever find the CID to be useful in the commit message ?

I've occasionally looked it up during review, but not sure if I ever made use of the permanent record in the git history.

I have probably used it occasionally -- the Coverity web UI lets you look at issues which are marked as "fix submitted", which means "somebody posted a patch to the list". Issues that linger on in that state either need the patch to be refound and pinged/reworked/picked up, or else the patch did get into git but the change wasn't enough to make Coverity happy. In either case it's convenient to be able to re-find commits and patches which were trying to address the issue by searching for the number.

But it's not something I do all the time as a habitual workflow.

(As a side note, the coverity scan website seems to have been offline for about a month now...)

-- PMM

#44 lore raw
In reply to Paolo Bonzini
Quoted 5 lines · Paolo Bonzini

Until now QEMU's code provenance policy declined any contribution believed to include or derive from AI-generated content. A blanket ban was easy to maintain while LLM output was rarely usable on its own, but as the tools improved an absolute prohibition has become harder to justify.

In the hope to move this forward, here's an attempt to get all feedback in one place. GPT-5.4. Unreliable of course but we have the contributors here after all ). Guys, anyone feels any of his feedback got missed or misstated?

## Alex Bennée

- Pointed out two text nits in the patch: a stray closing ** and the wording deterministic tool, suggesting deterministic tool or script.
- Wanted an explicit rule that AI must not write commit messages, because writing the summary and rationale is part of demonstrating that the human author understands the change.
- Was okay with AI helping only with grammar and spelling correction of human-written commit messages.
- Later posted an experimental AI-generated rewrite that:
- split the AI policy into a dedicated ai-usage.rst,
- added explicit human-accountability language,
- made Signed-off-by human-only,
- discouraged prompt dumping in commit messages,
- and banned AI-attribution tags other than AI-used-for:.
- Noted that the model was good at extracting text from the discussion but was not applying real judgment, so he normally prefers to review and reword AI-generated documentation hunks by hand.
- In the later security-report side discussion, said the interesting part is whether AI audit tooling finds useful issues compared to fuzzing/static analysis, not which model/vendor produced the report.

## BALATON Zoltan

- Said the terminology around trailers was confusing because elsewhere in the docs these are referred to as tags; that mismatch made the draft harder to follow.
- Otherwise thought the revised wording was clearer.
- Later objected to treating LLM output as presumptively public domain:
- generated output may still contain copied or derived GPL code,
- or code originating from incompatible or proprietary sources,
- so "no human copyright holder" does not automatically make the result safe or public domain.
- Also noted that code added to QEMU without an explicit license is still governed by QEMU's licensing rules, so simplistic public-domain assumptions are risky.

## Peter Maydell

- Objected to allowing an individual maintainer to decide that larger AI-generated contributions are acceptable:
- if the project concern is legal/provenance blast radius, that should be a project-wide rule,
- not something that varies by maintainer preference.
- Was especially skeptical of allowing AI-generated documentation and comments:
- code at least has compile/test guardrails,
- prose docs have only human review,
- and documentation/comments are supposed to reflect intended behavior, not auto-generated explanations.
- Drew a distinction between:
- acceptable assistance such as grammar correction or translation of human-authored text,
- versus asking AI to draft documentation from scratch, which he was much less happy with.
- In the later Coverity-style discussion, said issue identifiers can occasionally be useful for refinding patches/commits, though not as part of an everyday workflow.

## Stefan Hajnoczi

- Flagged one sentence in the proposal as potentially suggesting that submitters no longer need to understand the code they send.
- Wanted the policy to stay firmly in the model where the human contributor still understands and is responsible for the submission.
- Suggested wording along the lines of "since the risk of bugs not discovered by the submitter increases".
- Suggested moving the AI policy into a separate document and referencing it from AGENTS.md, so coding agents operating in-tree are explicitly told to refuse tasks that violate the policy.

## Daniel P. Berrangé

- Objected to using "projects accepting AI-assisted content have not run into serious legal trouble so far" as reassuring evidence:
- copyright risk is a slow-burn issue,
- lack of lawsuits so far is not strong evidence that the legal risk is low.
- Said small bug fixes does not line up well with the separate concern about core code:
- the real policy goal is closer to low originality / low copyrightability risk / easy reversibility,
- not "bug fix" as a category.
- Strongly preferred putting the AI rules into a dedicated ai-usage document for easier linking and clarity.
- Wanted the policy to cover social expectations as well as legal/technical ones:
- QEMU collaboration should remain human-to-human,
- contributors should not feed review mail into an LLM and paste the answer back,
- reviewers using AI should disclose that fact,
- and contributor identities should still represent real humans even when pseudonymous.
- Said the policy's "spirit" needs to live in the policy text itself, not only in a commit message, because later readers of the policy will never see the commit message rationale.
- Wanted stronger and earlier wording that only a human may add Signed-off-by, and pointed to Linux kernel wording as a model.
- Wanted explicit human authorship of commit messages and cover letters where non-trivial explanation is required.
- Liked AI-used-for: because it gives reviewers useful information without advertising a vendor.
- Wanted shape your patch tightened to something like shape the content of the submitted patch, so background AI use is excluded more clearly.
- Wanted unconditional disclosure of AI use, because provenance matters even when the surviving AI-generated portion is small.
- Thought prompts generally should not be included:
- if the information matters to reviewers, it belongs in the human-written commit message,
- otherwise it just adds clutter.
- Thought QEMU does not use Assisted-by / Co-authored-by / Generated-by was too weak:
- if those tags are unwanted, the policy should explicitly forbid them,
- and possibly enforce that in checkpatch.pl.
- Said the general tag rules should also be documented earlier in the provenance docs, not only in the AI section.
- Was especially wary of prose documentation under docs/:
- AI prose can become convincing-sounding slop,
- review of prose is already expensive,
- and non-expert contributors may not actually be able to fact-check the text.
- Proposed handling documentation more incrementally:
- start with a tightly constrained initial docs policy,
- then relax it later only if experience shows that broader allowances are worth it.
- Was more comfortable with inline API docs/comments than with prose documentation.
- Opposed leaving larger exceptions to individual maintainer discretion because that would create inconsistent standards across subsystems and confuse contributors.
- Repeatedly pushed back on the 20 lines rule:
- it is not measuring the right thing,
- and if there are already larger low-risk categories like mechanical or boilerplate code, the rule is the wrong policy center.
- Raised licensing concerns around AI-generated new files and SPDX handling:
- some guidance suggests whole-file AI output should not automatically get a license header unless human edits make it copyrightable,
- but QEMU should still make clear that human edits to AI-generated code are assumed GPL-2.0-or-later unless explicitly stated otherwise.
- Also clarified that any "public domain" argument for LLM output only makes sense when the output is not credibly a derived work:
- cloning QEMU into another language would likely still be a derived work,
- and some non-trivial feature code that follows established QEMU design patterns could also plausibly still be GPL-derived.
- Rejected the idea that "mechanical" should be left to personal taste:
- if reasonable people might disagree whether a change is mechanical,
- the policy should assume it is not mechanical.
- Said that if mechanical changes or boilerplate are allowed, the policy should define them clearly enough that contributors can understand what is allowed without having to ask permission in advance.
- In the later security-report side discussion, argued against giving AI tools Reported-by credit:
- the accountable party is the human reporter,
- and the project should not provide free advertising to tool vendors.
- When Alex posted an AI-generated rewrite of the policy, said it had incorporated comments too indiscriminately, become more verbose, lost structure, and was drifting toward slop.

## Kevin Wolf

- Said 20 lines or less is a poor proxy for what the project is actually trying to allow:
- the real target is trivial or low-complexity code,
- and it is easy to write 20 lines that are not trivial at all.
- Suggested line count could at most be an example, not the entire rule.
- Noted that "just say no to slop" is easy to say but not especially comfortable in practice for maintainers.
- Was skeptical that LLM workflows are meaningfully reproducible anyway.
- In the later security-report discussion, said AI-found issues feel analogous to Coverity:
- they generally do not deserve a Reported-by trailer,
- but mention in commit-message prose can make sense if useful.

## Michael S. Tsirkin

- Suggested explicitly allowing AI to correct grammar and spelling in text the contributor already wrote, as long as AI is not writing the text from scratch.
- Argued there are cases where a maintainer may reasonably judge generated code to be so QEMU-specific or so tightly coupled to the current tree that accidental copying risk is negligible.
- Repeatedly emphasized that AI is especially useful for helping non-native English speakers.
- Questioned how effective the 20 lines rule would be if many small AI-assisted contributions simply accumulate over time.
- Later suggested that if mechanical changes are allowed, the policy should say clearly mechanical or obviously mechanical and include examples.
- Also suggested that for borderline mechanical changes, contributors should check with maintainers up front because what counts as mechanical is still a maintainer judgment.
- In the licensing discussion, argued that if something truly is public domain, a human can still submit it under GPL terms, and that the policy could explicitly say contributing it to QEMU implies appropriate GPL licensing.
- Floated declining whole new AI-generated files for now unless they are just reorganizations of existing code that already inherit SPDX/licensing context.
- Also suggested maintainers can warn and eventually ignore repeat slop submitters.
- In response to the later security-report question, said AI-assisted security scanning was already allowed under the current policy.

## Christian Borntraeger

- Asked how the policy should treat a human-submitted patch that is based on an AI-generated security report.
- Asked whether, if such reports are allowed, the project should add something like Reported-by: Claude or Reported-by: ChatGPT.

#45 lore raw
In reply to Paolo Bonzini
Quoted 46 lines · Paolo Bonzini

Until now QEMU's code provenance policy declined any contribution believed to include or derive from AI-generated content. A blanket ban was easy to maintain while LLM output was rarely usable on its own, but as the tools improved an absolute prohibition has become harder to justify.

The concern that motivated the policy is unchanged, and it is worth stating
precisely: the DCO is about whether the submitter has the legal right to contribute the code, not about "creative expression". While the status of LLM output seems to be converging towards non-copyrightability, questions around unintentional reproduction of copyrighted code are still open. What has shifted is the balance of risk:

- projects accepting AI-assisted content have not run into serious legal trouble so far, which suggests the probability of the risk materializing is not high;

- other organizations, such as Red Hat[1], have assessed the risk as acceptable -- though a community of individual developers does not have the legal backing of a company, and even an unfounded dispute would be a long-lasting distraction from work on QEMU.

Nevertheless, even Red Hat mentions that "the possibility of occasional replication cannot be ignored". In QEMU's view, attentiveness and oversight are not a practical way to address this; yet as a copyleft project, copyright and code provenance are of utmost importance to us. Therefore, it remains prudent to only permit AI assistance where the ramifications of copyright violations are at least easy to revert and unlikely to spread: tests, documentation, mechanical changes, and small bug fixes. Core code that other things depend on, and that cannot simply be thrown away once a problem is noticed long after the fact, stays off-limits without prior agreement from a maintainer.

Related to this, and already visible in the incredible uptick in security reports, is the question of maintainer burnout and the shift in effort from the author to the reviewer of the code. AI lowers the cost of producing a patch but does nothing to lower the cost of understanding and reviewing one; if anything it raises it, since a reviewer can no longer assume that the submitter has reasoned through every line. The limits above work just as much to keep the volume of review work sustainable.

Revise the policy according to the above considerations, and introduce the "AI-used-for:" trailer as a record of where AI was used. The standard is slightly different from the more usual "Assisted-by"; the intention is for the metadata to provide more information for reviewers to judge the result.

Quoted 7 lines

In any case, use of AI does not relax any other contribution requirement:
authors still comply with the DCO and take responsibility for the whole patch via Signed-off-by.

[Commit message largely based on
https://lore.kernel.org/qemu-devel/[email protected]/, by Kevin Wolf. - Paolo]

So GCC has now decided that 15 lines or so is ok, if a maintainer decides so, and that one
should only count significantly different changes, what they call, following the gnu maintainer guidelines "legally significant contributions":

A change of just a few lines (less than 15 or so) is not legally significant for copyright. A regular series of repeated changes, such as renaming a symbol, is not legally significant even if the symbol has to be renamed in many places.

I note that the gnu project maintainer guidelines follow this with " Keep in mind, however, that a series of minor changes by the same person can add up to a significant contribution. What counts is the total contribution of the person; it is irrelevant which parts of it were contributed when."

which I guess would be hard to apply to AI generated code, so they don't try.

GCC also makes an exception for tests and I guess we could make an exception for internal developer docs?

Quoted 188 lines

[1] https://www.redhat.com/en/blog/ai-assisted-development-and-open-source-navigating-legal-issues

---
 docs/devel/code-provenance.rst | 142 ++++++++++++++++++++++-----------
 1 file changed, 94 insertions(+), 48 deletions(-)
docs/devel/code-provenance.rst +94 -48
index 65b8f232a08..857588c43ba 100644
@@ -1,7 +1,7 @@
 .. _code-provenance:
 
-Code provenance
-===============
+Code provenance and AI usage
+============================
 
 Certifying patch submissions
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -288,62 +288,108 @@ content generators below.
 Use of AI-generated content
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-TL;DR:
+.. warning::
 
-  **Current QEMU project policy is to DECLINE any contributions which are
-  believed to include or derive from AI generated content. This includes
-  ChatGPT, Claude, Copilot, Llama and similar tools.**
+   Please read the below policy before using AI to contribute code or
+   documentation to QEMU.  This applies to ChatGPT, Claude, Copilot,
+   Llama, and similar tools.**
 
-  **This policy does not apply to other uses of AI, such as researching APIs
-  or algorithms, static analysis, or debugging, provided their output is not
-  included in contributions.**
+The increasing prevalence of AI-assisted software development,
+and especially the use of content generated by `Large Language Models
+<https://en.wikipedia.org/wiki/Large_language_model>`__ (LLMs),
+poses a number of difficult questions.
 
-The increasing prevalence of AI-assisted software development results in a
-number of difficult legal questions and risks for software projects, including
-QEMU.  Of particular concern is content generated by `Large Language Models
-<https://en.wikipedia.org/wiki/Large_language_model>`__ (LLMs).
+Risks to open source projects include maintainer burnout from an
+increased number of contributions, as well as the risk to the project
+from unintentional inclusion of copyrighted material in the LLM's output.
+In order to mitigate these risks, the QEMU project currently allows
+using AI/LLM tools to produce patches in a limited set of scenarios:
 
-The QEMU community requires that contributors certify their patch submissions
-are made in accordance with the rules of the `Developer's Certificate of
-Origin (DCO) <dco>`.
+**Mechanical changes**
+  If you can use a deterministic tool, it is preferred that you use it
+  and not replace it with AI. If you don't know how to do the change
+  deterministically, you can ask the AI for help.
 
-To satisfy the DCO, the patch contributor has to fully understand the
-copyright and license status of content they are contributing to QEMU. With AI
-content generators, the copyright and license status of the output is
-ill-defined with no generally accepted, settled legal foundation.
+**Small bug fixes**
+  These should be limited to 20 lines of code or less, not including
+  tests.  You are still expected to :ref:`understand and explain your changes
+  <write_a_meaningful_commit_message>` and the rationale behind them.
 
-Where the training material is known, it is common for it to include large
-volumes of material under restrictive licensing/copyright terms. Even where
-the training material is all known to be under open source licenses, it is
-likely to be under a variety of terms, not all of which will be compatible
-with QEMU's licensing requirements.
+**Documentation and code comments**
+  While AI can help draft text, it still requires significant human
+  oversight.  Pay attention to the organization and flow of the generated
+  text, and strictly fact-check all technical details as LLMs are prone
+  to being confidently wrong.
 
-How contributors could comply with DCO terms (b) or (c) for the output of AI
-content generators commonly available today is unclear.  The QEMU project is
-not willing or able to accept the legal risks of non-compliance.
+**Tests**
+  Note that you must still confirm that each test actually exercises
+  the intended behavior including, for regression tests, that it
+  fails without the code under test and passes for the right reason.
 
-The QEMU project thus requires that contributors refrain from using AI content
-generators on patches intended to be submitted to the project, and will
-decline any contribution if use of AI is either known or suspected.
+These boundaries do not apply to other uses of AI, such as researching
+APIs or algorithms, static analysis, or debugging, provided the model's
+output is not included in contributions.
 
-Examples of tools impacted by this policy includes GitHub's CoPilot, OpenAI's
-ChatGPT, Anthropic's Claude, and Meta's Code Llama, and code/content
-generation agents which are built on top of such tools.
+If you wish to send large amounts of AI-generated changes, or any other
+contribution not in the above categories, please get in touch with the
+maintainer beforehand.  These can be treated as experiments, at the
+discretion of the maintainer and the community, with no obligation
+to accept them.
 
-This policy may evolve as AI tools mature and the legal situation is
-clarified.
+**Use of AI does not remove the need for authors to comply with all
+other requirements for contribution.**  In particular, the
+``Signed-off-by`` label in a patch submission is a statement that
+the author takes responsibility for the entire contents of the patch,
+certifying that their patch submission is made in accordance with the
+rules of the `Developer's Certificate of Origin (DCO) <dco>`.
 
-Exceptions
-^^^^^^^^^^
+Commit messages for AI-assisted changes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-The QEMU project welcomes discussion on any exceptions to this policy,
-or more general revisions. This can be done by contacting the qemu-devel
-mailing list with details of a proposed tool, model, usage scenario, etc.
-that is beneficial to QEMU, while still mitigating issues around compliance
-with the DCO.  After discussion, any exception will be listed below.
+When AI/LLM tools produce or substantively shape your patch, add an
+``AI-used-for:`` line before ``Signed-off-by``, as a reminder of your
+DCO obligations and a guide to reviewers.  The text is one or more of
+``code``, ``tests``, ``docs``, ``research``, possibly followed by an
+explanation in parentheses:
 
-Exceptions do not remove the need for authors to comply with all other
-requirements for contribution.  In particular, the "Signed-off-by"
-label in a patch submission is a statement that the author takes
-responsibility for the entire contents of the patch, including any parts
-that were generated or assisted by AI tools or other tools.
+.. code-block:: none
+
+     AI-used-for: tests, docs
+     AI-used-for: code
+     AI-used-for: code (refactoring)
+     AI-used-for: code (prototype)
+     AI-used-for: research
+
+``AI-used-for`` should not be included for "background" usage such as
+autocomplete or obtaining a pre-review of the patch.
+
+There is no requirement to include your prompts or summarize the
+conversation in the commit message or cover letter, but you may do so
+if you think it helps a reviewer judge the result.  For example:
+
+**Helpful prompts**
+  These describe concrete constraints or instructions, making it easy for a
+  reviewer to see how the tool's output was guided:
+
+  * "move field ``foo`` from ``struct aa`` to ``struct bb``.  If a
+    function already has a local variable or parameter of type ``struct
+    bb``, use it instead of accessing ``aa.bb``"
+
+  * "add an implementation of the trait for ``Mutex<T: MyTrait>``; it
+    takes the lock around the calls and forwards to ``T``"
+
+**Unhelpful prompts**
+  These are too generic to provide meaningful context.  You can of course
+  use them in the context of a complex interaction with the LLM, but they
+  should not be included in the commit message:
+
+  * "write user-facing documentation for the new tool"
+
+  * "write testcases for the new functions"
+
+QEMU does *not* use ``Assisted-by``, ``Co-authored-by`` or ``Generated-by``
+trailers to indicate AI usage.  In particular, it is not necessary to
+specify the exact AI model or tool used to create the commit.
+
+Deterministic tooling (sed, coccinelle, formatters) is out of scope for
+the trailer, but should be mentioned in the commit message.
Signature · 1 line
2.54.0
#46 lore raw
Quoted 9 lines · Michael S. Tsirkin

So GCC has now decided that 15 lines or so is ok, if a maintainer decides so, and that one
should only count significantly different changes, what they call, following the gnu maintainer guidelines "legally significant contributions":

A change of just a few lines (less than 15 or so) is not legally significant for copyright. A regular series of repeated changes, such as renaming a symbol, is not legally significant even if the symbol has to be renamed in many places.

That is more that the GNU project already had a level they defined as legally significant, because they wanted it to determine whether they needed copyright assignment or not. So it's natural for GCC to use it also in their AI policy.

Quoted 2 lines

GCC also makes an exception for tests and I guess we could make an exception for internal developer docs?

I don't think we should have AI generated docs, including developer docs, as I noted somewhere up thread. That's not for any particular copyright reasons, it's because we need actual humans to be understanding and writing the documentation, because it can't be easily cross-checked by tests.

-- PMM

#47 lore raw
Quoted 11 lines · Peter Maydell
Quoted 9 lines · Michael S. Tsirkin

So GCC has now decided that 15 lines or so is ok, if a maintainer decides so, and that one
should only count significantly different changes, what they call, following the gnu maintainer guidelines "legally significant contributions":

A change of just a few lines (less than 15 or so) is not legally significant for copyright. A regular series of repeated changes, such as renaming a symbol, is not legally significant even if the symbol has to be renamed in many places.

Quoted 4 lines

That is more that the GNU project already had a level they defined as legally significant, because they wanted it to determine whether they needed copyright assignment or not. So it's natural for GCC to use it also in their AI policy.

None the less that is an interesting benchmark.

A key challenge we've always had in these discussions is how to draw a line on what "legally signicant" means in practice.

The fact that the GNU project has used the "15 lines" rule for copyright assignment is quite a useful benchmark to take in to account precisely because they've used that for years (presumably decades?). To me the longevity gives it weight because it isn't something made up recently to suit the needs of those pushing use AI/LLM tools, and has had long term practical application in many real world OSS projects.

Quoted 8 lines
Quoted 2 lines

GCC also makes an exception for tests and I guess we could make an exception for internal developer docs?

I don't think we should have AI generated docs, including developer docs, as I noted somewhere up thread. That's not for any particular copyright reasons, it's because we need actual humans to be understanding and writing the documentation, because it can't be easily cross-checked by tests.

IME, it is by writing docs for a feature, that you come to learn about the flaws / gaps in the thing that is implemented, which feeds back to improve the code. Generating docs you're just going get text that reflects the state of the code without the learning & improvement experiance.

I don't think we should have an exception for tests either. If we have code in the tests directory that is generalized to become part of the broader codebase, we shouldn't have to think about the history of whether the tests code was AI generated.

The boundary between docs and code is also not entirely clear cut and intermingled in areas like command line help, QAPI inline docs, API doc comments,and so on.

IMHO all content in the repository should be treated the equivalently and held to a common standard. IOW, *if* we decide it is reasonable to allow limited AI/LLM usage in some manner, prefer to do that universally rather than trying to be very selective across sub-directories/files.

Simplicity & clarity of rules makes it more likely that people will actually be able to follow them.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#48 lore raw
Quoted 1 line · Daniel P. Berrangé

On Fri, Aug 07, 2026 at 01:39:32PM +0100, Peter Maydell wrote:

[...]

Quoted 11 lines
Quoted 5 lines

I don't think we should have AI generated docs, including developer docs, as I noted somewhere up thread. That's not for any particular copyright reasons, it's because we need actual humans to be understanding and writing the documentation, because it can't be easily cross-checked by tests.

IME, it is by writing docs for a feature, that you come to learn about the flaws / gaps in the thing that is implemented, which feeds back to improve the code. Generating docs you're just going get text that reflects the state of the code without the learning & improvement experiance.

100%. Attempting to write contracts for crap I wrote has made me recognize it as crap so many times.

Quoted 9 lines

I don't think we should have an exception for tests either. If we have code in the tests directory that is generalized to become part of the broader codebase, we shouldn't have to think about the history of whether the tests code was AI generated.

The boundary between docs and code is also not entirely clear cut and intermingled in areas like command line help, QAPI inline docs, API doc comments,and so on.

Quoted 7 lines

IMHO all content in the repository should be treated the equivalently and held to a common standard. IOW, *if* we decide it is reasonable to allow limited AI/LLM usage in some manner, prefer to do that universally rather than trying to be very selective across sub-directories/files.

Simplicity & clarity of rules makes it more likely that people will actually be able to follow them.

Also reduces rules-lawyering temptation.

#49 lore raw

GCC, Conservancy and Rust AI documents (was Re: [PATCH v2] docs/devel: relax policy on AI-generated contributions)

In reply to Daniel P. Berrangé
Quoted 9 lines · Daniel P. Berrangé

None the less that is an interesting benchmark.

A key challenge we've always had in these discussions is how to draw a line on what "legally signicant" means in practice.

The fact that the GNU project has used the "15 lines" rule for copyright assignment is quite a useful benchmark to take in to account precisely because they've used that for years (presumably decades?).

True, but it's only superficially the same that they've used. The GNU "15 lines rule", as defined at https://www.gnu.org/prep/maintain/html_node/Legally-Significant.html, is that "what counts is the total contribution of the person; it is irrelevant which parts of it were contributed when"; whereas the GCC AI policy treats each contribution from LLMs as independent.

Presumably this is because they consider the likelihood of copyright infringement to be independent across LLM outputs, but it's nevertheless a different rule. If so, their reasoning is similar to the one discussed earlier in the thread, and they simply picked the same threshold that was already in place.

Quoted 10 lines

IME, it is by writing docs for a feature, that you come to learn about the flaws / gaps in the thing that is implemented, which feeds back to improve the code. Generating docs you're just going get text that reflects the state of the code without the learning & improvement experiance.

I don't think we should have an exception for tests either. If we have code in the tests directory that is generalized to become part of the broader codebase, we shouldn't have to think about the history of whether the tests code was AI generated.

No one is going to agree 100% with everyone else; the only possible equilibrium is going to be the current "no AI for code generation" policy. The problem with it is that it is hard both to comply with and to enforce. Contribution to a community is based on some kind of honor system, but the reality of LLM operation makes it very hard to use them even for tasks that are considered acceptable. In that sense, the policy hinders the honor system instead of helping it.

For example, our policy says that you can use AI for review. You get a review like this (it's Linux but you get the idea):

kvm_put_kvm() now runs under sev_mirror_lock. The put is inside the critical section [...] If that's the last reference it drags all of kvm_destroy_vm() under the mutex. It's easy to keep it a leaf:

	mutex_lock(&sev_mirror_lock);
	sev->enc_context_owner = NULL;
	mutex_unlock(&sev_mirror_lock);
	kvm_put_kvm(owner_kvm);

Should I apply the change?

Am I supposed to say no and swap the last two lines myself? This case is probably fine, but where do I draw the line?

In other cases, during review the LLM will sometimes write testcases even without asking. Recently, one model came up with this exponential-time testcase while I was trying to understand some Meson code:

project('t', 'c')
pkg = import('pkgconfig')
l0 = static_library('l0', 'x.c', install: true)
l1 = static_library('l1', 'x.c', link_with: l0, install: true) l2 = static_library('l2', 'x.c', link_with: [l1, l0], install: true) l3 = static_library('l3', 'x.c', link_with: [l2, l1], install: true) l4 = static_library('l4', 'x.c', link_with: [l3, l2], install: true) l5 = static_library('l5', 'x.c', link_with: [l4, l3], install: true)

   # ...
   pkg.generate(l22, filebase: 'top')

If I decide that this is a good regression test, how do I (in the context of a policy like QEMU's) even rewrite a testcase like this for inclusion? Do I have to rewrite it as a loop:

project('t', 'c')
pkg = import('pkgconfig')
a = static_library('l0', 'x.c', install: true)
b = static_library('l1', 'x.c', link_with: a, install: true) foreach i : range(2, 23)
t = a
a = b
b = static_library(f'l@i@', 'x.c', link_with: [t,a], install: true)
endforeach
pkg.generate(b, filebase: 'top')

? Is this actually an improvement? Maybe in a test the repetitive text is actually clearer. If I decide the loop shape is worse, or in cases where there simply isn't another way to write it, the current policy doesn't even let me be honest.

"Use it only for study or review" is a fig leaf. We *won't* be able to catch all AI contributions, whether to code, tests or documentation. A no-agents/no-copy-and-paste policy is clearly enforceable because the LLMs' (unbearable) mannerisms jump out instantly. But if we're talking about AI code written by someone who already knows what they want to get, who knows the surroundings and has a design in their mind that informs the discussion with the LLM, the result is practically (or completely) indistinguishable from human-written code; the requirement to split the change into logically independent patches alone imposes a large amount of human-like structure.

So, the no-AI policy is an equilibrium only because it's stable, not because it's good. I would like to point out two recently released documents, one more philosophical and one more practical, hoping that this can help finding an alternative.

The first is Conservancy's own recommendations for generative AI (https://sfconservancy.org/llm-gen-ai/llm-backed-generative-ai-recommendations.html).
While I believe we wouldn't follow all of them (for example the
recommendation to treat chat logs as artifacts to be conserved is not practical), there are some useful points to consider, with respect to the copyright infringement risks that drove the current policy and to the general recommended attitude on both ends:

The FOSS community should support, not just tolerate, those who outright reject LLM-gen-AI systems. [...] FOSS projects should not shun contributors who choose to use LLM-gen-AI systems.

Before submission, FOSS Contributors must invest substantial time reviewing LLM-gen-AI -assisted and/or -generated contributions.

“Copyleft Everything” remains the best viable and safest approach Certainly those who want to release FOSS under non-copyleft licenses have more to worry about when using these tools. [...]

When LLM-gen-AI systems (including proprietary ones) can massively accelerate FOSS improvements, use of such tools is an appropriate strategic compromise [...]

Second, the Rust project came up with a different way to approach the issue: require disclosure of LLM-assisted changes and hold them to a higher bar. The policy is summarized as follows (https://blog.rust-lang.org/inside-rust/2026/08/05/rust-langrust-is-adopting-an-llm-policy/):

It's fine to use LLMs to answer questions, analyze, distill, refine, check, suggest, review. But not to create. [...]

Pre-arranged, non-critical, high-quality, well-tested, and well- reviewed code changes that are originally created by an LLM are allowed, with disclosure.

I would replace "are originally created by an LLM" with "include substantial amounts of code written by an LLM" (maybe GCC's 15 line of code threshold?), but that's it.

I understand that this may not be a particularly popular position in the QEMU community, and that is completely different from what even I wrote last June. But these two are new and recent developments, and it happens that I find them to strike the right middle ground.

Thanks,

Paolo

#50 lore raw

Re: GCC, Conservancy and Rust AI documents (was Re: [PATCH v2] docs/devel: relax policy on AI-generated contributions)

Quoted 3 lines · Paolo Bonzini

No one is going to agree 100% with everyone else; the only possible equilibrium is going to be the current "no AI for code generation" policy.

Also, I'm not sure we even have consensus on what the goals of an AI policy should be. At least, in my own mind I am not sure about that. We might care about, to different degrees:

- the possibility that AI contributions might later be found to be copyright-infringing or otherwise legally encumbered, and need to be removed again
- poor quality of resulting generated code
- that a large number of individually OK-looking changes might pile up to result in design messes and degeneration of the codebase into "big ball of mud" architecture (you can argue we already have this difficulty without AI :-))
- that our already very limited code-review ability gets overwhelmed if we allow AI-generated patchsets (there are already human-generated patchsets which go unreviewed and ignored as it is)
- that we don't think one-shot AI-generated changes are likely to be a pathway by which new contributors join the community in the longer term
- various non-technical aspects like those the Rust policy drafters labelled as "out of scope for discussion" under the "ethics" label

(and probably others that I have forgotten).

The current policy being "no AI" on a fairly narrow legal ground had the advantage for me that I didn't need to consider my views on all the rest of this. If we relax that strong position then what kinds of relaxation we're OK with depends on what goals we are trying to achieve and what problems we're trying to defend against.

Quoted 3 lines

Second, the Rust project came up with a different way to approach the
issue: require disclosure of LLM-assisted changes and hold them to a higher bar.

That's not really the way the Rust policy came over to me. I read it more as "no AI for codegen, but with an 'experimental' back door for limited use". But that comes down to how much "experimental" really means that to them and how much it's "not actually experimental but the label made it easier to get the policy agreed"...

I do think the "pre-agreement and pre-finding-a-reviewer" parts are worth thinking about; to the extent that we've allowed some AI-assisted work already, it's had that kind of "pre-agreement and done by somebody we already trust as a contributor" aspect.

Also, I would be more in favour of uses of AI in the project that made my life / job easier. "More and larger and more frequent patch submissions that I have to review" isn't that, so I am not super enthusiastic about permitting LLM assisted contributions. ("Deluge of not very interesting autogenerated bug reports" isn't great either, for that matter.)

-- PMM

#51 lore raw

Re: GCC, Conservancy and Rust AI documents (was Re: [PATCH v2] docs/devel: relax policy on AI-generated contributions)

Quoted 28 lines · Peter Maydell
Quoted 3 lines · Paolo Bonzini

No one is going to agree 100% with everyone else; the only possible equilibrium is going to be the current "no AI for code generation" policy.

Also, I'm not sure we even have consensus on what the goals of an AI policy should be. At least, in my own mind I am not sure about that. We might care about, to different degrees:

- the possibility that AI contributions might later be found to be copyright-infringing or otherwise legally encumbered, and need to be removed again
- poor quality of resulting generated code
- that a large number of individually OK-looking changes might pile up to result in design messes and degeneration of the codebase into "big ball of mud" architecture (you can argue we already have this difficulty without AI :-))
- that our already very limited code-review ability gets overwhelmed if we allow AI-generated patchsets (there are already human-generated patchsets which go unreviewed and ignored as it is)
- that we don't think one-shot AI-generated changes are likely to be a pathway by which new contributors join the community in the longer term
- various non-technical aspects like those the Rust policy drafters labelled as "out of scope for discussion" under the "ethics" label

Quoted 1 line

(and probably others that I have forgotten).

Well the 15 line limit helps with these too, to a degree.

Quoted 31 lines

The current policy being "no AI" on a fairly narrow legal ground had the advantage for me that I didn't need to consider my views on all the rest of this. If we relax that strong position then what kinds of relaxation we're OK with depends on what goals we are trying to achieve and what problems we're trying to defend against.

Quoted 3 lines

Second, the Rust project came up with a different way to approach the
issue: require disclosure of LLM-assisted changes and hold them to a higher bar.

That's not really the way the Rust policy came over to me. I read it more as "no AI for codegen, but with an 'experimental' back door for limited use". But that comes down to how much "experimental" really means that to them and how much it's "not actually experimental but the label made it easier to get the policy agreed"...

I do think the "pre-agreement and pre-finding-a-reviewer" parts are worth thinking about; to the extent that we've allowed some AI-assisted work already, it's had that kind of "pre-agreement and done by somebody we already trust as a contributor" aspect.

Also, I would be more in favour of uses of AI in the project that made my life / job easier. "More and larger and more frequent patch submissions that I have to review" isn't that, so I am not super enthusiastic about permitting LLM assisted contributions. ("Deluge of not very interesting autogenerated bug reports" isn't great either, for that matter.)

-- PMM

#52 lore raw

Re: GCC, Conservancy and Rust AI documents (was Re: [PATCH v2] docs/devel: relax policy on AI-generated contributions)

In reply to Paolo Bonzini
Quoted 11 lines · Paolo Bonzini
Quoted 9 lines · Daniel P. Berrangé

None the less that is an interesting benchmark.

A key challenge we've always had in these discussions is how to draw a line on what "legally signicant" means in practice.

The fact that the GNU project has used the "15 lines" rule for copyright assignment is quite a useful benchmark to take in to account precisely because they've used that for years (presumably decades?).

Quoted 6 lines

True, but it's only superficially the same that they've used. The GNU "15 lines rule", as defined at
https://www.gnu.org/prep/maintain/html_node/Legally-Significant.html, is that "what counts is the total contribution of the person; it is irrelevant which parts of it were contributed when"; whereas the GCC AI policy treats each contribution from LLMs as independent.

I'm unclear whether that's total contribution over time & eternity, or total contribution at a point in time.

eg difference between a person sending

a. 1 patch in all time that is 15 lines of code
b. 5 patches in one day each of which are 15 lines of code c. 5 patches spread over 10 years each of which is 15 lines of code

IIUC, the GCC AI policy allows all three, but the the GNU copyright assignment policy allows (a), definitely NOT (b), and possibly not (c) ?

Quoted 5 lines

Presumably this is because they consider the likelihood of copyright infringement to be independent across LLM outputs, but it's nevertheless a different rule. If so, their reasoning is similar to the one discussed earlier in the thread, and they simply picked the same threshold that was already in place.

Also the context is different. I would think the purpose of the copyright assignment exception is to facilitate trivial bug fixes from random one time only contributors, while capturing anyone who is likely to be a repeat contributor.

Quoted 6 lines
Quoted 6 lines

IME, it is by writing docs for a feature, that you come to learn about the flaws / gaps in the thing that is implemented, which feeds back to improve the code. Generating docs you're just going get text that reflects the state of the code without the learning & improvement experiance.

Quoted 8 lines
Quoted 4 lines

I don't think we should have an exception for tests either. If we have code in the tests directory that is generalized to become part of the broader codebase, we shouldn't have to think about the history of whether the tests code was AI generated.

No one is going to agree 100% with everyone else; the only possible equilibrium is going to be the current "no AI for code generation" policy. The problem with it is that it is hard both to comply with and to enforce.

Enforce, I'm not very bothered with. OSS has always relied on the honesty of contributors as there is never any practical way to enforce non-technical constraints.

We should assume honest contributors as the baseline. If there are malicious people, no rules will ever solve that - they just have to be dealt with as special cases

So the practicality of compliance is what matters.

Quoted 12 lines

Contribution to a community is based on some kind of honor system, but the reality of LLM operation makes it very hard to use them even for tasks that are considered acceptable. In that sense, the policy hinders the honor system instead of helping it.

For example, our policy says that you can use AI for review. You get a review like this (it's Linux but you get the idea):

kvm_put_kvm() now runs under sev_mirror_lock. The put is inside the critical section [...] If that's the last reference it drags all of kvm_destroy_vm() under the mutex. It's easy to keep it a leaf:

Quoted 6 lines
	mutex_lock(&sev_mirror_lock);
	sev->enc_context_owner = NULL;
	mutex_unlock(&sev_mirror_lock);
	kvm_put_kvm(owner_kvm);

Should I apply the change?

Even with our current AI policy that forbids all contributors, personally I consider it still leaves (unwritten) scope for the contributor to take AI output *if* the person can be confident in asserting the output did NOT meet the threshold for copyrightability/originality.

IOW, I consider the current AI policy only bans contributions which meet the threshold for copyright. We left that unsaid as we didn't want to have to then explicitly define where that threshold lies.

Quoted 2 lines

Am I supposed to say no and swap the last two lines myself? This case is probably fine, but where do I draw the line?

Yes, drawing the lines is precisely the hard bit.

The unwritten "leave it to the discretion of the contributor" is our current unsatisfactory answer.

The "15 lines of code" guide is the suggested alternate unsatisfactory answer.

By issuing explicit guidance in policy we put a little more liability onto the project by blessing a specific interpretation.

Quoted 15 lines

In other cases, during review the LLM will sometimes write testcases even without asking. Recently, one model came up with this exponential-time testcase while I was trying to understand some Meson code:

   project('t', 'c')
   pkg = import('pkgconfig')
   l0 = static_library('l0', 'x.c', install: true)
   l1 = static_library('l1', 'x.c', link_with: l0, install: true)
   l2 = static_library('l2', 'x.c', link_with: [l1, l0], install: true)
   l3 = static_library('l3', 'x.c', link_with: [l2, l1], install: true)
   l4 = static_library('l4', 'x.c', link_with: [l3, l2], install: true)
   l5 = static_library('l5', 'x.c', link_with: [l4, l3], install: true)
   # ...
   pkg.generate(l22, filebase: 'top')
Quoted 3 lines

If I decide that this is a good regression test, how do I (in the context of a policy like QEMU's) even rewrite a testcase like this for inclusion? Do I have to rewrite it as a loop:

We see this with many security disclosures coming with giant test cases. Most of these I would consider to be copyrightable and thus forbidden by our currwent policy, and likely also forbidden by the "15 lines of code" policy since they are often much longer than 15 lines.

IMHO users have to accept that they cannot use these LLM code outputs in most / many cases, with our current policy and this new proposed policy.

If the tool is incapable of complying with our legal policy, this doesn't mean we should just change policy to accept whatever, it implies the tool is not satisfactory to use as is.

Quoted 11 lines
   project('t', 'c')
   pkg = import('pkgconfig')
   a = static_library('l0', 'x.c', install: true)
   b = static_library('l1', 'x.c', link_with: a, install: true)
   foreach i : range(2, 23)
     t = a
     a = b
     b = static_library(f'l@i@', 'x.c', link_with: [t,a], install: true)
   endforeach
   pkg.generate(b, filebase: 'top')
Quoted 4 lines

? Is this actually an improvement? Maybe in a test the repetitive text is actually clearer. If I decide the loop shape is worse, or in cases where there simply isn't another way to write it, the current policy doesn't even let me be honest.

It is arguably still a derived work of the LLM output, just one that has been deliberately obfuscating its origins for malicious compliance with the policy. This isn't a unique problem to LLMs though. It is the dilema people have always faced when finding useful code snippets (on StackOverflow or 3rd party project repos) and then using that as a starting point for a QEMU contribution. There's always the incentive to obfuscate the origins in this manner and have to hope people don't take that path.

Quoted 9 lines

"Use it only for study or review" is a fig leaf. We *won't* be able to catch all AI contributions, whether to code, tests or documentation. A no-agents/no-copy-and-paste policy is clearly enforceable because the LLMs' (unbearable) mannerisms jump out instantly. But if we're talking about AI code written by someone who already knows what they want to get, who knows the surroundings and has a design in their mind that informs the discussion with the LLM, the result is practically (or completely) indistinguishable from human-written code; the requirement to split the change into logically independent patches alone imposes a large amount of human-like structure.

A significant problem with our AI policy is that we still do not have an AGENTS.md file commited to give more detailed/explicit guidance to the agents.

If we really don't want our contributors to face this dilema, we should look at an AGENTS.md file that strongly instructs/insists that the agents do NOT generate code snippets, or to strictly limit them to short snippets or psuedo-code, not exact complete end-to-end programs / test files... or whatever constraint we feel is the best tradeoff in this area.

AGENTS.md is by no means foolproof, but it ought to be a significant improvement over having none at all.

Quoted 4 lines

The first is Conservancy's own recommendations for generative AI (https://sfconservancy.org/llm-gen-ai/llm-backed-generative-ai-recommendations.html).
While I believe we wouldn't follow all of them (for example the
recommendation to treat chat logs as artifacts to be conserved is not
practical), there are some useful points to consider, with respect to the

More than impractical, I'd class the "chat logs preservation" point as inappropriate to request of contributors. It is like asking to see the contributors' full "git reflog" - way too invasive.

Quoted 6 lines

copyright infringement risks that drove the current policy and to the general recommended attitude on both ends:

The FOSS community should support, not just tolerate, those who outright reject LLM-gen-AI systems. [...] FOSS projects should not shun contributors who choose to use LLM-gen-AI systems.

The biggest challenge I see is in regards to our long term pipeline of future contributors, an increasing number of whom will have never known a world without assistance from LLM agents.

Quoted 15 lines

Before submission, FOSS Contributors must invest substantial time reviewing LLM-gen-AI -assisted and/or -generated contributions.

“Copyleft Everything” remains the best viable and safest approach Certainly those who want to release FOSS under non-copyleft licenses have more to worry about when using these tools. [...]

When LLM-gen-AI systems (including proprietary ones) can massively accelerate FOSS improvements, use of such tools is an appropriate strategic compromise [...]

Second, the Rust project came up with a different way to approach the issue:
require disclosure of LLM-assisted changes and hold them to a higher bar.
The policy is summarized as follows (https://blog.rust-lang.org/inside-rust/2026/08/05/rust-langrust-is-adopting-an-llm-policy/):

Quoted 6 lines

It's fine to use LLMs to answer questions, analyze, distill, refine, check, suggest, review. But not to create. [...]

Pre-arranged, non-critical, high-quality, well-tested, and well- reviewed code changes that are originally created by an LLM are allowed, with disclosure.

I find the Rust policy quite interesting as it is more expansive beyond just code contribution questions. In particular it specifically emphasizes that collaboration is between humans.

"No one except the author is required to read LLM output unless
they choose to: LLM output isn't allowed in public docs, PR descriptions, or Github comments unless it's clearly marked; reviewers aren't required to look at LLM PRs if they don't want to."

At the same time I find the Rust policy there somewhat at odds with itself. "reviewers aren't required to read LLM output" is nice in theory, but at the same time explicitly allows them. This feels like it splits the community in half. If you're working in a bug wrangler role and don't want to read LLM output how do you practically keep doing your bug wrangler job without leaving an ever increasing mountain of bugs ignored ?

A while back we added the note to the bug template that contributors are required to assert that they have analysed any AI output and independently reproduced the findings. On the positive side we've had had 100's of bugs/securit disclosures which openly admit they come from an LLM, with a 1 sentence disclosure that the submitter confirmed the output.

On the negative side, I'm increasingly of the opinion that a significant subset of these acknowledgements are either lies or meaningless. I feel like either the LLM is simply adding the boilerplate "I've reviewed the LLM output" message itself, or the author has reviewed it but failed to but what the LLM said was beyond their capabilities and so haven't actually identified the that the LLM was simply wrong. This doesn't feel easily solvable.

Quoted 8 lines

I would replace "are originally created by an LLM" with "include substantial amounts of code written by an LLM" (maybe GCC's 15 line of code threshold?), but that's it.

I understand that this may not be a particularly popular position in the QEMU community, and that is completely different from what even I wrote last June. But these two are new and recent developments, and it happens that I find them to strike the right middle ground.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|