introducing KAISEN AI system - autonomous loops with deterministic testing

hello everybody,

since November 2025 i've been working on an genetic algorithm that uses local LLMs as a mutation factor to continuously iterate over a single C program in order to improve its performance.

this system proved extremely effective at reaching my performance goals by bruteforcing thousands of generations then measuring the results passing the generated programs through a test suite that the LLM has no access to (so it cannot cheat, but it's gonna try!). Every new found best becomes the basis for the next generations and guardrails are in place so that most dangerous code doesn't get tested.

since this system served me well and gave me results with gpt oss 20b that i couldn't get with frontier models in full reasoning mode (and with a lot of interaction by me), i opened an AI lab and started working on a generic version that is able to work with any program (22 languages and counting) and to build the test pipeline autonomously. for the nerds: part of the reason small models punch above their weight here are a deterministic autofix ladder, compiler-hint fixes, linter fixes, then one LLM repair pass fed the real compiler error, and every candidate is re-verified for real before it gets counted as valid. you can use it as humans with a gui that helps you step by step or you can point your agent at the KAISEN folder and tell it to use the kai protocol to start tests on its own (works very well with llms using the omp and deepseek harness)

right now you can check out the alpha version of KAISEN here: https://github.com/RAZZULLIX/KAISEN

tldr

KAISEN lets you use local LLMs to improve software performance by iterating thousands of little changes and keeping the new best as basis for the next generations. it has a GUI, your harness can spawn it as a sidecar, and it speaks a small-model-friendly protocol (KAI) so an LLM agent itself can drive it over stdio or http. every program it generates runs guarded by default. read the manual to know everything it can do, or ask here.

P.S.

i expect A LOT of bugs and problems, most of the tests i did were done through deepseek v4 using OMP and deepseek harness calling KAISEN through the kai protocol (KAISEN was hooked to 6 instances of gpt oss 20b) and it actually worked quite nice. please let me know everything you find by opening an issue or asking here, this is my job now so i'll do my best to fix everything you need fixed and make sure KAISEN becomes a useful tool in every LLM user toolbox.

reddit.com
u/andreabarbato — 1 day ago

what are the best coding models for a RTX3090?

hi there!

in this case i'm talking about kernel-level coding and primitive algorithms in straight c, no web-dev stuff at all. i need at least 64k context, preferably more, working on llama.cpp

i'm still having a hard time finding anything that can reliably beat gpt-oss 20b on code quality, especially at that speed, so i'm asking the community to see if y'all know something better.

these are the ones i use daily that give me the best results and run smooth on my 3090:

gpt-oss 20b (q4 or q6): still my go to. very fast and really smart, but it does get lost in loops sometimes (like 5-10% of the time).

qwen 3.6 27b (q4 or q5): super reliable, never really see it looping out on me, but it doesn't push the limits quite like gpt-oss does (and it's way slower!).

devstral small 2 24b instruct (q4): honestly surprised how good the code it spits out can be, but it's slower at generation than gpt-oss 20b.

gemma 4 and glm flash 4.7 work too, but the code they write rarely cuts it for me... i'm also testing phi 4 but i just started using it so i don't really know.

soo what do you guys suggest for this use case? let's try to keep it inside the 24gb vram constraint. rare custom models are welcome.

thanks bye!

reddit.com
u/andreabarbato — 2 months ago

do you love Jesus?

today we were thinking about the "I never knew you" part here:

"And then will I declare to them, ‘I never knew you; depart from me, you workers of lawlessness.’" Matthew 7:23 (ESV)

since it seems like many will say to Him: "Lord, Lord" in that day:

"Not everyone who says to me, ‘Lord, Lord,’ will enter the kingdom of heaven, but the one who does the will of my Father who is in heaven. Many will say to me in that day, 'Lord, Lord,'..." Matthew 7:21-22a (ESV)

...how can Jesus not know them?

🤔

but somewhere else it's written:

"But if anyone loves God, he is known by God." 1 Corinthians 8:3 (ESV)

so these guys cannot be the ones to hear "I never knew you". and in another place the words of Jesus:

"If you love me, you will keep my commandments." John 14:15 (ESV)

so if you are known by Him (love Him) you will keep His commandments, and again:

"And this is the judgment: the light has come into the world, and people loved the darkness rather than the light because their works were evil." John 3:19 (ESV)

finally: when the Lord will say to those who kept sinning after receiving the knowledge of the truth "I never knew you!" becomes by equation "you never loved Me!"

do you agree? do you love the Lord according to the Scriptures? do you think i'm tripping? i'm open to analyze conflicting verses!

reddit.com
u/andreabarbato — 3 months ago
▲ 3 r/LocalLLM+1 crossposts

i’ve been iterating on this algorithm for quite a while. the original goal was to beat numpy.sort 100% of the time; that turned out to be unrealistic with the current state of local models, but this implementation is already often faster on a wide range of inputs.

all of the code was 100% AI‑generated, so if you spot bugs or suspicious benchmark behavior, please tell me in a comment, open an issue or PR instead of silently judging. constructive feedback is very welcome!

here are some benchmarks against numpy.sort:

array size 100

https://preview.redd.it/bbtdz319bbzg1.png?width=925&format=png&auto=webp&s=18587a434ecb5045253ac56b4ff92cbfb916d14f

array size 10000

https://preview.redd.it/vh3v5mucbbzg1.png?width=923&format=png&auto=webp&s=28b159ec16e0e58117a40c92c2cfe572c138d751

you can try it out yourself here:
https://github.com/RAZZULLIX/super_fast_sort/

reddit.com
u/andreabarbato — 4 months ago

i've been seeing some confusion and hate towards the word "works". it's almost as if Christians, once they are freely justified by faith in Jesus Christ, already received salvation and are safe in whatever sinful state they're in, and need to avoid at all costs to do other things because that would show lack of faith in the finished work of Jesus Christ.

for this reason i compiled a list of verses that talk about works and why we should do them and specifically why we should do the righteous one and stop doing the evil ones.

i only listed verses that have the word "works" in them and show they are necessary and the basis of judgement; because we all seem to already agree that no work is necessary to receive the grace of God and it comes by faith.

my point is that the walk of the Christian isn't over when grace is received and works are a part of the Christian life and, if you deny this, you're denying each and every verse contained in the list below.

i hope more than anything that this can be an useful study tool for the ones who wants to investigate the matter further.

according to the Scriptures:

Matthew 5:16 Let your light so shine before men, that they may see your good works and glorify your Father in heaven.

Matthew 16:27 For the Son of Man will come in the glory of His Father with His angels, and then He will reward each according to his works.

John 6:28-29 Then they said to Him, “What shall we do, that we may work the works of God?” Jesus answered and said to them, “This is the work of God, that you believe in Him whom He sent.”

John 7:7 The world cannot hate you, but it hates Me because I testify of it that its works are evil.

John 10:37 If I do not do the works of My Father, do not believe Me;

John 14:10-11 Do you not believe that I am in the Father, and the Father in Me? The words that I speak to you I do not speak on My own authority; but the Father who dwells in Me does the works. Believe Me that I am in the Father and the Father in Me, or else believe Me for the sake of the works themselves.

Acts 10:35 But in every nation whoever fears Him and works righteousness is accepted by Him.

Romans 13:3 For rulers are not a terror to good works, but to evil. Do you want to be unafraid of the authority? Do what is good, and you will have praise from the same.

Romans 13:12 The night is far spent, the day is at hand. Therefore let us cast off the works of darkness, and let us put on the armor of light.

1 Corinthians 12:11 But one and the same Spirit works all these things, distributing to each one individually as He wills.

2 Corinthians 11:13-15 For such are false apostles, deceitful workers, transforming themselves into apostles of Christ. And no wonder! For Satan himself transforms himself into an angel of light. Therefore it is no great thing if his ministers also transform themselves into ministers of righteousness, whose end will be according to their works.

Ephesians 2:10 For we are His workmanship, created in Christ Jesus for good works, which God prepared beforehand that we should walk in them.

Ephesians 5:11 And have no fellowship with the unfruitful works of darkness, but rather expose them.

Philippians 2:12-13 Therefore, my beloved, as you have always obeyed, not as in my presence only, but now much more in my absence, work out your own salvation with fear and trembling; for it is God who works in you both to will and to do for His good pleasure.

Colossians 1:21-23 And you, who once were alienated and enemies in your mind by wicked works, yet now He has reconciled in the body of His flesh through death, to present you holy, and blameless, and above reproach in His sight— if indeed you continue in the faith, grounded and steadfast, and are not moved away from the hope of the gospel which you heard, which was preached to every creature under heaven, of which I, Paul, became a minister.

1 Thessalonians 2:13 For this reason we also thank God without ceasing, because when you received the word of God which you heard from us, you welcomed it not as the word of men, but as it is in truth, the word of God, which also effectively works in you who believe.

1 Timothy 2:8-10 I desire therefore that the men pray everywhere, lifting up holy hands, without wrath and doubting; in like manner also, that the women adorn themselves in modest apparel, with propriety and moderation, not with braided hair or gold or pearls or costly clothing, but, which is proper for women professing godliness, with good works.

1 Timothy 5:24-25 Some men’s sins are clearly evident, preceding them to judgment, but those of some men follow later. Likewise, the good works of some are clearly evident, and those that are otherwise cannot be hidden.

1 Timothy 6:17-19 Command those who are rich in this present age not to be haughty, nor to trust in uncertain riches but in the living God, who gives us richly all things to enjoy. Let them do good, that they be rich in good works, ready to give, willing to share, storing up for themselves a good foundation for the time to come, that they may lay hold on eternal life.

2 Timothy 4:14 Alexander the coppersmith did me much harm. May the Lord repay him according to his works.

Titus 1:15-16 To the pure all things are pure, but to those who are defiled and unbelieving nothing is pure; but even their mind and conscience are defiled. They profess to know God, but in works they deny Him, being abominable, disobedient, and disqualified for every good work.

Titus 2:6-8 Likewise, exhort the young men to be sober-minded, in all things showing yourself to be a pattern of good works; in doctrine showing integrity, reverence, incorruptibility, sound speech that cannot be condemned, that one who is an opponent may be ashamed, having nothing evil to say of you.

Titus 2:11-14 For the grace of God that brings salvation has appeared to all men, teaching us that, denying ungodliness and worldly lusts, we should live soberly, righteously, and godly in the present age, looking for the blessed hope and glorious appearing of our great God and Savior Jesus Christ, who gave Himself for us, that He might redeem us from every lawless deed and purify for Himself His own special people, zealous for good works.

Titus 3:8 This is a faithful saying, and these things I want you to affirm constantly, that those who have believed in God should be careful to maintain good works. These things are good and profitable to men.

Titus 3:14 And let our people also learn to maintain good works, to meet urgent needs, that they may not be unfruitful.

Hebrews 6:1-2 Therefore, leaving the discussion of the elementary principles of Christ, let us go on to perfection, not laying again the foundation of repentance from dead works and of faith toward God, of the doctrine of baptisms, of laying on of hands, of resurrection of the dead, and of eternal judgment.

Hebrews 9:13-14 For if the blood of bulls and goats and the ashes of a heifer, sprinkling the unclean, sanctifies for the purifying of the flesh, how much more shall the blood of Christ, who through the eternal Spirit offered Himself without spot to God, cleanse your conscience from dead works to serve the living God?

Hebrews 10:24-25 And let us consider one another in order to stir up love and good works, not forsaking the assembling of ourselves together, as is the manner of some, but exhorting one another, and so much the more as you see the Day approaching.

James 2:14-26 What does it profit, my brethren, if someone says he has faith but does not have works? Can faith save him? If a brother or sister is naked and destitute of daily food, and one of you says to them, “Depart in peace, be warmed and filled,” but you do not give them the things which are needed for the body, what does it profit? Thus also faith by itself, if it does not have works, is dead. But someone will say, “You have faith, and I have works.” Show me your faith without your works, and I will show you my faith by my works. You believe that there is one God. You do well. Even the demons believe—and tremble! But do you want to know, O foolish man, that faith without works is dead? Was not Abraham our father justified by works when he offered Isaac his son on the altar? Do you see that faith was working together with his works, and by works faith was made perfect? And the Scripture was fulfilled which says, “Abraham believed God, and it was accounted to him for righteousness.” And he was called the friend of God. You see then that a man is justified by works, and not by faith only. Likewise, was not Rahab the harlot also justified by works when she received the messengers and sent them out another way? For as the body without the spirit is dead, so faith without works is dead also.

James 3:13 Who is wise and understanding among you? Let him show by good conduct that his works are done in the meekness of wisdom.

1 Peter 2:11-12 Beloved, I beg you as sojourners and pilgrims, abstain from fleshly lusts which war against the soul, having your conduct honorable among the Gentiles, that when they speak against you as evildoers, they may, by your good works which they observe, glorify God in the day of visitation.

1 John 3:8-12 He who sins is of the devil, for the devil has sinned from the beginning. For this purpose the Son of God was manifested, that He might destroy the works of the devil. Whoever has been born of God does not sin, for His seed remains in him; and he cannot sin, because he has been born of God. In this the children of God and the children of the devil are manifest: Whoever does not practice righteousness is not of God, nor is he who does not love his brother. For this is the message that you heard from the beginning, that we should love one another, not as Cain who was of the wicked one and murdered his brother. And why did he murder him? Because his works were evil and his brother’s righteous.

Revelation 2:5 Remember therefore from where you have fallen; repent and do the first works, or else I will come to you quickly and remove your lampstand from its place—unless you repent.

Revelation 2:20-23 Nevertheless I have a few things against you, because you allow that woman Jezebel, who calls herself a prophetess, to teach and seduce My servants to commit sexual immorality and eat things sacrificed to idols. And I gave her time to repent of her sexual immorality, and she did not repent. Indeed I will cast her into a sickbed, and those who commit adultery with her into great tribulation, unless they repent of their deeds. I will kill her children with death, and all the churches shall know that I am He who searches the minds and hearts. And I will give to each one of you according to your works.

Revelation 2:26-28 And he who overcomes, and keeps My works until the end, to him I will give power over the nations— ‘He shall rule them with a rod of iron; They shall be dashed to pieces like the potter’s vessels’— as I also have received from My Father; and I will give him the morning star.

Revelation 9:20 But the rest of mankind, who were not killed by these plagues, did not repent of the works of their hands, that they should not worship demons, and idols of gold, silver, brass, stone, and wood, which can neither see nor hear nor walk.

Revelation 14:13 Then I heard a voice from heaven saying to me, “Write: ‘Blessed are the dead who die in the Lord from now on.’ ” “Yes,” says the Spirit, “that they may rest from their labors, and their works follow them.”

Revelation 18:6 Render to her just as she rendered to you, and repay her double according to her works; in the cup which she has mixed, mix double for her.

Revelation 20:12-15 And I saw the dead, small and great, standing before God, and books were opened. And another book was opened, which is the Book of Life. And the dead were judged according to their works, by the things which were written in the books. The sea gave up the dead who were in it, and Death and Hades delivered up the dead who were in them. And they were judged, each one according to his works. Then Death and Hades were cast into the lake of fire. This is the second death. And anyone not found written in the Book of Life was cast into the lake of fire.

reddit.com
u/andreabarbato — 4 months ago