top | item 44250582

(no title)

markb139 | 8 months 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

discuss

order

IshKebab|8 months ago

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).

markb139|8 months ago

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.

EForEndeavour|8 months ago

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?

markb139|8 months ago

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.