4 ms·
Jeez a classic "the register" article full of "concerns", but no solutions. To be honest I'm growing tired of all these "AI will cause problems with X" articles
by Roark66 3y ago
Jeez a classic "the register" article full of "concerns", but no solutions. To be honest I'm growing tired of all these "AI will cause problems with X" articles that don't present any kind of solution.
We all know the issues with AI generated code. Unless you're doing absolute boilerplate code (getters/setters in java, defining interfaces for existing implementations etc) AI is worse than useless... Why is it worse than useless? Because it pretends to solve your problem while introducing hidden failure modes. Lete give you an example.
I wanted to evaluate Chatgpt so I asked it the following question (paraphrasing)
- "can one set up alerting based on url request retrieval result in aws without servers".
- It answers "certainly, you just need to create an aws lambda function, then register It with synthetic canary feature of cloud watch, set up alarm and it's done (a list of exact steps follows)".
On the surface this sounds plausible so I decided to go along. I tell it to provide the code for the lambda function in python. It did produce basic code that retrieves a url and exits returning true/false. However, one can't register existing AWS Lambda functions using just python with synthetic canary. One has to open synthetic canary setup and create a new function there that uses a special execution environment that includes a chromium browser, selenium (For web Use automation) etc. This was contrary to the instructions. So that's a fail no 1. Also if I can run a much cheaper pure python env. Why would I use selenium/chromium.
So I ask it, "adjust your recommendation not to use synthetic canary feature". It responds "certainly, you just have to alert on the metric, here is a new python code that submits a metric, remember to update your IAM role to give it permission to put cloud watch metrics". Wow, I think, that's a pretty nice comprehensive answer.
But then I look at the code and it basically requests the url, has a timing thing surrounding it(I asked to include latency metric) then submits two metrics, latency and "worked" that is 1 if we get http 200,and 0 on anything else. Theoretically fine, but what if the website disappeared completely? Well then the lambda function would just timeout never submitting it's result and the alert chatgpt proposed wouldn't catch it as it was configured to treat missing data as missing. When I point that out and ask for max latency timeout Chatgpt says "sorry, you're 100% correct,let me adjust my answer" and it does putting a try/catch around it handling the error and timeout.
So following that I wonder how many people could be caught causing huge problems to themselves by putting such code into use without understanding how it works.
Does it make lives of people that know how to code, but would have to Google first how to do some specific thing? I'm not sure. I'd rather see a stackoverflow answer with an example code doing something similar, then make my own than get an answer that contains such obvious bugs.
Still I'm a big fan of using AI, just not for writing code.