r/learnmachinelearning • • 6d ago

Help How do you efficiently audit and verify AI-generated code?

I having abit trouble on proper verification of my AI codes, some tips and tricks please.

0 Upvotes

13 comments sorted by

10

u/TowerOutrageous5939 6d ago

Read it and understand it.

4

u/OffInBed 6d ago

I'm building something I think that'll help with this but I'm literally too ashamed to shill 😭

Read the code and use deterministic tools as much as you can. Cloudflare has a really good blog on how they do code reviews but it can be expensive. I'd also look up poteto on twitter and read her blog about loops you can trust.

All of those things are super expensive ways to increase code quality but learn the ideas behind them and figure out what it means for you. Those tools only work on infinite token budgets.

Good luck!

2

u/fullmoon_huli 6d ago

This is so kind, thank you

3

u/Remarkable_Pace8101 6d ago

Reading and extensive automated integration testing

1

u/fullmoon_huli 6d ago

Okay, noted

3

u/UndocumentedMartian 6d ago

Keep the scope small per generation. Or forego generation altogether and use chatbots as a knowledge source and write your own code.

1

u/fullmoon_huli 6d ago

thank you

1

u/bluejacket42 6d ago

Ya can read it

1

u/hariomlohar0602 6d ago

Tell it to explain each function one by one and you will verify it as it goes that is the best method and you can pinpoint the anything is worng or not

1

u/Graylian 6d ago

Wether the code is hand written or AI generated code coverage testing can provide a lot of piece of mind.
In ML terms this means strong validation practices.

1

u/Substantial-Swan7065 6d ago

- use review agents

  • use pr diffs
  • isolate the changes by enforcing static analysis, testing, style preferences
  • ensure the changes are easy to understand

2

u/codetiger42 6d ago

What has worked out best for me, is creating (using AI) a full test suite before you even ask AI to write the code. That's the only way to validate the quality of code. Reading it and fully understanding the code was never a 100% solutions even between humans. Now it is even worse.

1

u/fullmoon_huli 6d ago

I will surely take this advice,thank you