Guidelines for code obtained with help of AI tools

While checking pull requests I noticed a discussion about the use of AI tools for supporting coding:

Personally, I think AI is a great tool, but the implications are not clear.

Since no direct correlation can be found between proposed source code and material used for training, it’s literally impossible (as of today) to relate the code generated with any specific training material, and therefore its license.

Most jurisdictions (US, EU, UK) require human authorship for copyright. If code is generated entirely by an AI with minimal human creativity, it typically cannot be copyrighted.

Once a human performs editing/modifications, review and further detailed guidance to the tool, preparation of submission, … the human contribution can be copyrighted.

When code comprises copyrighted snippets, in that case (provided the snippets are substantially representative and not generic like variable += increment !) the original copyright applies. Is this practically possible, or common? no idea.

@koconnor I think the contributing guidelines should be amended no matter the direction Klipper decides to take.

Personally I would explicitly request a mention of AI-aided coding when AI is used as a tool to support development, and signing off by the human who defined the requirements/goals for the AI, performed the review after automatic generation, adaptation upon need of the AI-generated code, and who submitted the commits and pull request .
Explicitly forbid only fully automatic code generation and submission, where no human contributed to the final pull request, which is a grey area … of a darker shade of grey, so to say.

(I’m using likely wrong terminology for pulls and commits, you get the idea)

All commits must include a Signed-off-by line:

Signed-off-by: Your Name your@email.com

By signing off on a commit, you certify that:

  1. You have the right to submit the work under the project license.

  2. The contribution is your original work or appropriately licensed.

  3. The contribution does not knowingly violate third-party intellectual property rights.

Use of AI-assisted tools

AI-assisted development tools (e.g. code generation systems) may be used as long as at least some human intervention takes place from the definition of the features to the final pull request.

Contributors are responsible for the code they submit.

When using AI-generated code, you must ensure that:

• The code has been reviewed and understood by the contributor
• The code does not contain copied material from third-party sources with incompatible licenses
• The contributor has verified that the generated code is appropriate for the project

Maintainers may request modifications or removal of generated code if licensing or originality concerns arise.

This should protect Klipper to a sufficient extent for several years.

There isn’t currently an official policy on the use of AI tools with the Klipper code.

I don’t see an issue in using these types of tools to analyze or audit the code.

For code generated using these tools, I’d almost certainly look to follow the policies of other popular open source projects. Alas, it doesn’t seem like there is much of a consensus at this time. I think for the time being, we should continue to monitor what other major projects do.

In case anyone is curious, I did some quick searches and found some existing policies:

-Kevin

3 Likes

Perfect, I only thought it was important to raise the point.

By the way I don’t agree with the reasoning by QEMU

Assuming that Continuous bed mesh scanning with binary inductive probe by mairas · Pull Request #7224 · Klipper3d/klipper · GitHub is at the moment blocked from review due to the content being partially generated using agentic coding: what changes would I have to make in the PR to clear the blocking issue?

I would also add FreeCAD’s policy, and forgejo:

I particularly like FreeCAD’s perspective.

There isn’t much of a consensus, because corporations are really attracted to the quantity of cheap work.

But there is kind of a consensus in respected non-profits. AI is loved by speculative investors and evil corporations. Non-profits, like the ones mentioned, all seem to agree that it’s not so good. Some less than others, but I would have to say that firefox is not as non-profit as it could be (the defaults in the browser are horrible)

AI generates quantity, not quality. It is slop. It is expensive. It takes a lot of electricity. It steals jobs. It steals copyrighted material. It is used to mass-spy on people. It is a corpo’s wet dream, and the night mare of someone who cares about human rights and consumer protection.

This is the moment in history where companies show their true colors. A fork in the road. Software as a Service, vs Slop as a Service. Let’s make sure to stay on the right side.

And now for a personal opinion: To me, programming is not just a means to an end. To me, it’s an art form. I’m sure many of you who are software developers have looked at old code and seen a certain beauty in it. It’s about engineering, about problem solving, about design; not about pumping out as much as possible to satisfy the shareholders.

To answer @/mairas’s question: Further develop your skills as a software engineer, and write code with the only large language model you require: your brain. If you require an AI, then you still have some self education left to do before considering contributing to an open-source codebase.

2 Likes

Welcome mixusminimax,

Indeed, interesting to read. I agree. Thanks for the link.

2 Likes

I find FreeCAD’s approach only partly reasonable.

I can agree on the “understand what you propose, don’t submit untested code” which is reasonable enough (even if I generated a perfectly working and useful HA integration and I advanced significantly another integration which was basically abandoned, while understanding it only partially… but I tested it) , but the section “Concerns over AI” are from ridiculous (privilege! exploitation of workers!) to plainly wrong (water usage for example: compare a data center divided by the number of users with the water usage of a programmer which has to study for years to be on par with AI).

Also the issue with copyright is 100% theoretical, it has never been challenged and there is no solid basis to support it. It’s speculation, it might…

Only the increased burden on maintainers is a real issue if people start submitting en masse code they didn’t develop and test. I’m guilty myself on this one, since after seeing an OpenWRT bug reported several times without patches I fired Fable 5 and I provided a patch to make it more visible and so that someone could test it… Which in fact turned out just fine.

1st paragraph
is one large sentence.
Could you write that more structured? There are many “arguments” to discuss.

2nd paragraph
I’m very sure that it takes just a few years (max. 2) to come to such a challenge. Of course, just my personal opinion.

3rd paragraph.
Hopefully you mentioned the use of Fable 5, when you provided the patch.

2 Likes

Wait a second. Are you seriously treating the need to drink as a human as a similar topic to water usage by data centers? Have we come this far? May I remind you that any and all technology exists purely to serve humanity, life on this planet, and the planet itself. What’s the point of giving resources to machines meant to serve humans if humans are being cast by the wayside. That’s seriously dystopian.

A programmer that isn’t hired as a programmer still consumes water. Your argument only makes sense if we kill the programmer and replace them with an AI, it wouldn’t be enough to just fire them.

The point is that when calculating the power usage of a data center, you can’t subtract the water used by the people it replaces. Because it only replaces them in the work force, not on the planet itself. Unless, as I said, you’re suggesting to replace the people on the planet as well.

I second the points raised by hcet14.

Of course.

And I was very clear about providing it only so that people able to test but not to code could maybe solve their issue.

And that’s how it went, but it’s not approved yet.

In general I would say that is essential that code is tested and understood. Whether it’s generated by a LLM or fully by a person it’s less relevant since LLM might have some issues but if it helps to have a good idea implemented, it’s a win.

I have found a new (to me) programming language called Zig, maybe you guys know it, they have the strictest policy I’ve seen so far:

https://codeberg.org/ziglang/zig#strict-no-llm-no-ai-policy

I’ll continue to look for more policies set by other projects. If it ever comes to a vote at klipper, we should probably write a more comprehensive list of respected opinions before that.

Edit: looking for clarification on the policy

Edit 2: Found it. It is even more clear here: https://ziglang.org/code-of-conduct/#strict-no-llm-no-ai-policy. It seems like I have found my people.

Thanks for sharing the links, but I think we may be veering a bit off-topic here. Lets keep the focus on 3d printing, the language “family friendly”, and a positive tone.

Cheers,
-Kevin

I think everybody behaved. The language used was in my eyes modest.

This is more or less a thread of two people involved. My impression is, they have very opposing points of view.

There came some “arguments” up in this tread I would like to discuss with the person in a bar tete-a-tete while enjoying some beers, but possibly impossible.

All I can say this thread was overdue. Thank you OP.

Klipper needs guidelines regarding AI. Moderators of discourse and all engaged developers need it.

1 Like