5 ms·
I had a related episode at work when my coworker asked me why his seemingly trivial 10 line piece of code was misbehaving inexplicably. It turned out he had tw
by alexeiz 2y ago
I had a related episode at work when my coworker asked me why his seemingly trivial 10 line piece of code was misbehaving inexplicably. It turned out he had two variables `file_name` and `filename` and used one in place of another. I asked him how he ended up with such code, he said he used copilot to create it. Using code from a generative AI without understanding what it does is never a good idea.
- berniedurfee 2y agoI burned a couple hours debugging some generated code only to finally realize copilot was referencing a variable as ‘variableO1’. Artificial Incompetence indeed!
- FanaHOVA 2y agoCopilot wouldn't make a typo. He just made that up and / or broke the code himself.
- brigadier132 2y agoYou are getting downvoted but you are right, a typo in a variable that already exists in a file like this is not the failure mode for LLMs. The failure mode is logic bugs, making up methods / functions.
- varjag 2y agoNo, you can get variable names "mutated" on follow up requests. The thing is like sculpting with toothpaste.
- brigadier132 2y agoI've been using copilot for as long as it has existed and what you are describing has not happened to me once. Literally on in the background 8 hours a day. Excuse me for not trusting the internet hivemind that hates everything that is hyped just a little bit.
- varjag 2y agoMy goto check of AI assistants is asking to write a function calculating the first N digits of Pi in Common Lisp. On at least two attempts when prompted to fix its code the model would change one of the variable names to T, which is a reserved symbol. So yeah pretty sure it does happen.
- deleted 2y ago[deleted]
- creesch 2y agoLOL, are you kidding me? LLMs including the gpt family copilot uses are very good at sneaking in these sorts of thing.
- FanaHOVA 2y agoShow me 1 example.
- creesch 2y agoShow me that copilot never makes a mistake or introduces variables that never have been initialized...
- brigadier132 2y agoThis is a strawman, he never said it didn't make mistakes.
- creesch 2y agoOh for crying out loud, I obviously mean these specific mistakes. If you have worked in any capacity with LLMs like this you would have seen them variables or suddenly switch up the convention of how they're written. Certainly if you are in a conversation mode after a few back and forths this happens from time to time. I am just not going to spend my time digging to previous prompts of code I might not want to share just to satisfy a random internet person .
- brigadier132 2y agoThe models I've used don't make typos on variable names that already exist in the context. Typos are not the failure mode, this is literally the easiest text prediction task they can do.
- sixfiveotwo 2y agoWhat you guys probably want to do instead is get to a common definition of what a typo is. Personally, I understand it as a typographic error, which is a fancy way of saying a spelling mistake (a mistake on a letter), not a mistake where one use a word for another. Maybe you meant the latter?
- fragmede 2y agowould someone invent that and bother the author with that? I mean I suppose it's possible, but that seems like such a waste of time to me that I find that more unlikely. and while it's a typo, it's not fleinaem or something that's totally wrong, just a choice in breaking up the word filename. having written file handling code, the various permutations of filename and path and dirname get to be a bit much sometimes.
- brigadier132 2y agoPeople are unhinged about AI so yes I think someone would invent a scenario like this for internet points
- wredue 2y ago>people are unhinged about AI. Well. We definitely agree on that.
- nope1000 2y agoI don't know about copilot but I've seen typos from ChatGPT (although it was english, not code)
- boredhedgehog 2y agoWhat likely happened is that he asked the AI two separate questions and fused the answers himself.
- frumper 2y agoI knew a guy that made a good living as a freelance web developer decades ago. He would pretty much just copy and paste code from tutorials or stack overflow and had no real idea how anything worked. Using code without understanding it is never a good idea, it doesn’t need to be from AI for that to be true.
- Laakeri 2y agoBut he made a good living out of it, so in the end it was a good idea?
- emseetech 2y agoIt certainly puts a ceiling on a career. And I'd argue it probably gave him a pretty rough shelf life. At some point he has to understand what he's doing. Unless he's so good at selling his services he can consistently find new clients. And if that's the case, he'd probably kill it in sales.
- fragmede 2y agosales engineer is quite a lucrative career. don't have to be really good at it, just enough to be useful.
- snoxy 2y agoSales engineers have to be good enough to bluff their way through the layers of hyperbole/minor exaggeration/utter bullshit (delete as applicable) the sales team have spun. Whether their conscience gets involved before the deal closes, different question.
- gizmo686 2y agoNot at my work. Around here sales engineers just say "this is a proof of concept, X will be different in the final version". Then, after they close the deal, they give us their half implemented feature they developed that none of us heard about before, and tell ys that we need to finish it and include it in the next release.
- mooreds 2y ago> Using code from a generative AI without understanding what it does is never a good idea. Hear hear! I feel like genAI is turning devs from authors to editors. Anyone who thinks the latter is lesser than the former has not performed both functions. Editing properly, to elevate the meaning of the author, is a worthy and difficult endeavor.
- Glyptodon 2y agoAt least for me stupid bugs like this turn out to be some of the most time wasting to debug, no AI involved. Like accidentally have something quoted somewhere, or add an 's' to a variable by accident and I may not even correctly process what the error message is reporting at first. Always feel a bit silly after.
- Noumenon72 2y agoThese kinds of problems are often avoidable by linters or asking ChatGPT what is wrong, though I was just tearing my hair wondering why TSC_COMPILE_ERROR wasn't skipping TypeScript because I spelled it TSX_COMPILE_ERROR in my environment variable.
- Glyptodon 2y agoSubtle typos easily misread are
- viraptor 2y agoNot only asking ChatGPT what is wrong, but also using an agent which does self-reflection by default. I'm sad every time I see people using the bare chat interface to generate code. We've got API tools which are so much better at it today. Use Aider at the very least.
- floydnoel 2y agodoes aider have an executable installer yet? i tried installing it but the python experience is terrible. last time i messed with python installs on my mac everything worked like shit until o reinstalled the OS.
- viraptor 2y agopython -mvenv aider aider/bin/pip install aider-chat aider/bin/aider And you're done. There's also a docker version https://aider.chat/docs/install/docker.html https://aider.chat/docs/install/docker.html Just don't mess with the system-wide installed version of python and it will be fine. This isn't a python specific issue though.
- EVa5I7bHFq9mnYK 2y agoSounds like javascript "code". A normal language with proper type system would not allow that.
- CalRobert 2y agoI don’t see how typing relates to this.
- mkl 2y agoProbably one of the variables is undefined, and static typing could catch that.
- timeon 2y agoAlso warning for unused variable.
- normie3000 2y agoIs it the compiler that would catch it?
- mkl 2y agoYes. This would be caught by the compiler in C, C++, Java, Rust, Haskell, etc.: https://stackoverflow.com/questions/1517582/what-is-the-difference-between-statically-typed-and-dynamically-typed-languages#1517670 https://stackoverflow.com/questions/1517582/what-is-the-diff... Many statically typed languages do have escape hatches to do some dynamic typing at runtime, but this is not the default (hence the classification), and it requires some additional effort to use.
- zo1 2y agoIt's not the language, it's the IDE and laziness. They're doing this in notepad or maybe VSCode and don't have anything configured for highlighting or checking. Heck they probably don't even know how to interpret the error message saying "file_name is not declared". I'm the first to bash JS, but this is not a JS issue. It's 100% a "bad and lazy" human actor that is throwing spaghetti on the wall to see what sticks. In this case, they have a minigun cannon called ChatGPT/CoPilot that is letting them do more of it than what they used to.
- delusional 2y agoWe hired a new guy at work. In one of his first tasks he had chosen to write some bash, and it was pure nonsense. I mean it contained things like: if [ -z "${Var}+x" ] Where I can see what the author was trying to do, but the code is just wrong. I dont mind people not knowing stuff, especially when it's essentially Bash trivia. But what broke my heart was when I pointed out the problem, linked to the documentation, but recieved the response "I dont know what it means, I just used copilot" followed by him just removing the code. What a waste of a learning opportunity.
- woctordho 2y agoEveryone working with shell scripts should know shellcheck
- swah 2y agoAnd Python...
- rwmj 2y agoAnd you didn't sack him?
- delusional 2y agoI don't have hiring privileges. Either way. I like the guy, and I'd rather work to build him up. That doesn't mean it's not frustrating, but I have a process that seems to build a pretty good culture.
- OJFord 2y agoAnd of a salary...
- steelframe 2y agoWait until a manager who's evaluating a technical decision you're making copies and pastes ChatGPT's "analysis" of your proposal and asks you to respond to it.
- 2y ago
- Tainnor 2y agoAnd any decent IDE will highlight a variable that is declared but unused. We already have "artificial intelligence" in the form of IDEs, linters, compilers, etc. but some people apparently think we should just throw it all away now that we have LLMs.
- tomrod 2y agoNo need for quotes, the best AI integrations are the ones you see as just part of the tech stack like spell check and linters.
- hayley-patton 2y agoRight, your static analysis tools will likely use Abstract Interpretation.
- wiseowise 2y agoBut that’s WoOoOrK. These stupid sobs want magic that does everything automatically.
- tomrod 2y agoYes, labor costs aren't magically replaced by trained AI models, MBA protestations aside
- cqqxo4zV46cp 2y agoI trust that you’re all done patting each other on the back now, yes?
- tomrod 2y agoTherefore, what?
- sa-code 2y agoUnless you're using Python and said variable was meant to be reassigned, but you used a different name instead. E.g. file_name = 1 filename = 2
- ben_w 2y ago> Using code from a generative AI without understanding what it does is never a good idea. True, but the anecdote doesn't prove the point. It's easy to miss that kind of difference even if you wrote the code yourself.
- latexr 2y ago> It's easy to miss that kind of difference even if you wrote the code yourself. The developer in the story had no idea what the code did, hence they would not have written it themselves, making it impossible for them to “miss” anything.
- planb 2y agoIn my experience this is exactly the kind of mistake an AI would not make.
- yawnxyz 2y agoClaude gave me something similar, except these were both used, and somehow global variables, and it got confused about when to use which one. Asking it to refactor / fix it made it worse bc it'd get confused, and merge them into a single variable — the problem was they had slightly different uses, which broke everything I had to step through the code line by line to fix it. Using Claude's still faster for me, as it'd probably take a week for me to write the code in the first place. BUT there's a lot of traps like this hidden everywhere probably, and those will rear their ugly heads at some point. Wish there was a good test generation tool to go with the code generation tool...
- danenania 2y agoOne thing I've found in doing a lot of coding with LLMs is that you're often better off updating the initial prompt and starting fresh rather than asking for fixes. Having mistakes in context seems to 'contaminate' the results and you keep getting more problems even when you're specifically asking for a fix. It does make some sense as LLMs are generally known to respond much better to positive examples than negative examples. If an LLM sees the wrong way, it can't help being influenced by it, even if your prompt says very sternly not to do it that way. So you're usually better off re-framing what you want in positive terms. I actually built an AI coding tool to help enable the workflow of backing up and re-prompting: https://github.com/plandex-ai/plandex https://github.com/plandex-ai/plandex
- withinboredom 2y agoAs someone who uses LLMs on my hobby projects to write code, I’ve found the opposite. I usually fix the code, then send it in saying it is a refactor to clarify things. It seems to work well enough. If it is rather complex, I will paste the broken code into another conversation and ask it to refactor/explain what is going on.
- danenania 2y agoFixing the mistake yourself and then sending the code back is a positive example, since you're demonstrating the correct way rather than asking for a fix. But in my experience, if you continue iterating from that point, there's still a risk that parts of the original broken code can leak back into the output again later on since the broken code is still in context. Ymmv of course and it definitely depends a lot on the complexity of what you're doing.
- bckr 2y ago> Using code from a generative AI without understanding what it does is never a good idea. Yes. AI as a faster way to type: Great! AI as a way to discover capabilities: OK. Faster way to think and solve problems: Actively harmful.
- morgango 2y agoInterestingly, a great application for GenAI is to copy and paste code and ask it, "Why is this not working?". It works even better if you give it the specific error you are getting (and it is a well understood system).