← Back to context

Comment by markb139

3 days ago

I tried code gen for the first time recently. The generated code look great, was commented and ran perfectly. The results were completely wrong. The code was to calculate the cpu temperature from the Raspberry Pi RP2350 in python. The initial value look about right, then I put my finger on the chip and the temp went down! I assume the model had been trained on broken code. This lead me to think how do they validate code does what it says

Nobody is saying that you don't have to read and check the code. Especially for things like numerical constants. Those are very frequently hallucinated (unless it's something super common like pi).

  • I’ve now retired from professional programming and I’m now in hobby mode. I learn nothing from reading AI generated code. I might as well read the stack overflow questions myself and learn.

    • You aren't supposed to learn anything. Nobody is using AI to do stuff they couldn't do themselves. AI just does it much much faster.

Did you review the code itself, or test the code beyond just putting your finger on the chip? Is it possible that your finger was actually cooler than the chip and acted as a heat sink upon contact?

  • The code looked fine. And I don’t think my finger is colder than the chip - I’m not the iceman. The error is the analog value read by the ADC gets lower as the temperature rises.