cd /news/large-language-models/rewriting-code-with-ai · home topics large-language-models article
[ARTICLE · art-65664] src=dotnetperls.com ↗ pub= topic=large-language-models verified=true sentiment=· neutral

Rewriting Code With AI

A developer used AI agents Gemma 4 12B and Qwen 3.6 35B to rewrite Rust code without doc-comments, but found direct rewriting unreliable. Instead, the developer had Qwen 3.6 generate a Python script that successfully rewrote 43 Rust files, missing only about 20 multi-line function cases, concluding that using an LLM to write a script is more reliable and faster than direct code rewriting.

read1 min views2 publishedJul 13, 2026

It has become trendy to rewrite code using AI agents. In my ongoing quest to become more trendy myself, I decided to try to fix a nagging issue in my Rust code base. I had written the Rust code without doc-comments; for some reason I just used inline comments instead.

I tried to use Gemma 4 12B and Qwen 3.6 35B to rewrite the code directly. With recent changes in llama-cpp

, this worked fairly well, but files were too large and the AI agents made mistakes.

Eventually, I changed my approach.

• I had Qwen 3.6 generate a Python script that would perform all the rewrites.

• The script, as Qwen 3.6 wrote it, used line-by-line parsing of Rust files to move comments and edit them.

• The script worked correctly on all 43 Rust files, although it missed about 20 multi-line function cases.

This task made me realize that using an LLM to rewrite code directly is not always the best approach. Instead, it might be better to have the LLM write a Python script that rewrites code files. This may be more reliable, and much faster.

── more in #large-language-models 4 stories · sorted by recency
── more on @gemma 4 12b 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/rewriting-code-with-…] indexed:0 read:1min 2026-07-13 ·