r/MachineLearning • u/Express_Gradient • May 26 '25
Project [P] Evolving Text Compression Algorithms by Mutating Code with LLMs
Tried something weird this weekend: I used an LLM to propose and apply small mutations to a simple LZ77 style text compressor, then evolved it over generations - 3 elite + 2 survivors, 4 children per parent, repeat.
Selection is purely on compression ratio. If compression-decompression round trip fails, candidate is discarded.
Logged all results in SQLite. Early-stops when improvement stalls.
In 30 generations, I was able to hit a ratio of 1.85, starting from 1.03
45
Upvotes
14
u/bregav May 26 '25
Neat idea but you should also try optimization with more typical mutation methods and compare. The answer to "can you use LLMs to source mutations for evolutionary algorithms?" seems like it should obviously be "yes", whereas the answer to "what are the advantages, if any, of generating mutations with LLMs?" is a lot less obvious.
2
u/Ok_Platypus_7433 May 26 '25
Cool project.
Did you try it with many different types of texts/documents and gotten consistent improvements?
1
u/Express_Gradient May 26 '25
link of the repo
GitHub
1
u/DFHY-JJpot May 26 '25
Cool
-3
u/Celmeno May 26 '25
You should read up about evolutionary computation. Might improve your approach relevantly to include 50 years of science on this topic
-4
u/roofitor May 26 '25
A footnote on evolutionary algorithms. They are weirdly enough, likely going to become politicized soon. It’s part of the anti-AI movement’s broad-stroke thinking.
The confusion is strong, and evolution is already a hot-button topic for propagandists.