8 ms·
I've got a lot of hallucinations like that from LLMs. I really don't get how so many people can get LLMs to code most of their tasks without those issues perman
by andix 2y ago
I've got a lot of hallucinations like that from LLMs. I really don't get how so many people can get LLMs to code most of their tasks without those issues permanently popping up.
- pinoy420 2y agoA good prompt. You don’t just ask it. You tell it how to behave and give it a shot load of context
- andix 2y agoWith Claude the context window is quite small. But with adding too much context it often seems to get worse. If the context is not carefully narrowly picked and too unrelated, the LLMs often start to do unrelated things to what you've asked. At some point it's not really worth anymore creating the perfect prompt, just code it yourself. Also saves the time to carefully review the AI generated code.
- johnisgood 2y agoClaude's context window is not small, is it not larger than ChatGPT's?
- andix 2y agoI just looked it up, it seems to be the rate limit that's actually kicking in for me.
- johnisgood 2y agoYes, that's it! It is frustrating to me, too. You have to start a new chat with all relevant data, and a detailed summary of the progress/status.
- johnisgood 2y ago(Because you reach the limit faster otherwise).
- troupo 2y agoDoesn't prevent it from hallucinating, only reduces hallucinations by a single digit percentage
- copperroof 2y agoPersonally I’ve been finding that the more context I provide the more it hallucinates.
- Rury 2y agoThere's probably a sweet spot. Same with people. Too much context (especially unnecessary context) can be confusing/distracting, as well as being too vague (as it leaves room for multiple interpretations). But generally, I find the more refined and explicit you are, the better.
- kgeist 2y agoI use LLMs for writing generic, repetitive code, like scaffolding. It's OK with boring, generic stuff. Sure it makes mistakes occasionally but usually it's a no-brainer to fix them.
- andix 2y agoI try to keep "boring" code to a minimum, by finding meaningful and simple abstractions. LLMs are especially bad handling those, because they were not trained on non-standard abstractions. Edit: most LLMs are great for spitting out some code that fulfills 90% of what you asked for. That's sometimes all you need. But we all know that the last 10% usually take the same amount of effort as the first 90%.
- rafaelmn 2y agoThis is what got me in most sleepless nights, crunch and ass clenching production issues over my career. Simple repetitive shit is easy to reason about, debug and onboard people on. Naturally it's balancing act, and modern/popular frameworks are where most people landed, there's been a lot of iteration in this space for decades now.
- andix 2y agoI've made the opposite observation. Without proper abstractions code bases grow like crazy. At some point they are just a huge amount of copy, paste, and slight modification. The amount of code often grows exponentially. With more lines of code comes more effort to maintain it. After a few years those copy and pasted code pieces completely drift apart and create a lot of similar but different issues, that need to be addressed one by one. My approach for designing abstractions is always to make them composable (not this enterprise java inheritance chaos). To allow escaping them when needed.
- Spivak 2y ago> At some point they are just a huge amount of copy, paste, and slight modification. I mean is that bad? Unless you keep having to have huge MRs that modify every copy/paste could you just let the code sit there and run forever? I only say this because I've been a maintenance programmer and I could only dream of a codebase like this. The idea that I get a Rollbar with a stack trace and the entirety of what the code actually does is laid bare right at the site of the error in a single file is amazing. And I can change it without affecting anything else?! I end up having to "unwind" all of the abstractions anyway because the nature of the job means I'm not intimately familiar with the codebase and don't just know where the real work happens.
- bakugo 2y ago> I really don't get how so many people can get LLMs to code most of their tasks without those issues permanently popping up They can't, they usually just don't understand the code enough to notice the issues immediately. The perceived quality of LLM answers is inversely proportional to the user's understanding of the topic they're asking about.
- mlyle 2y agoAlternatively, we understand it well, and discard bad completions immediately. When I'm using llama.vim, like 40% of what it writes in a 4-5 line completion is exactly what I'd write. 20-30% is stuff that I wouldn't judge coming from someone else, so I usually accept it. And 30-40% is garbage... but I just write a comment or a couple of lines, instead, and then reroll the dice. It's like working through a junior engineer, except the junior engineer types a new solution instantly. I can get down to alternating between mashing tab and writing tricky lines.
- andix 2y agoI don't see the point in AI code completions, they are just distracting noise. I'm only doing bigger changes with AI. Prompt based stuff, like "extract the filtering part from all API endpoints in folder abc/xyz. Find a suitable abstraction and put this function into filter-utils.codefile"
- QuantumGood 2y agoGPT can't even tell what its done or give what it knows it should. It's endless, "Apologies, here is what you actually asked for ..." and again it isn't.
- MortyWaves 2y agoThis was my primary reason for using Claude. Absolutely useless experience with chatgpt oftentimes. I’ve mainly been using LLMs to help maintain a ridiculously poorly made technical debt dumpster fire, and Claude has been really helpful here mainly with repetitive code.
- therein 2y agoYeah ChatGPT is truly the worst. Claude has been consistently much better. Grok 3 is surprising me every day.
- derefr 2y agoI would love an AI coding assistant that doesn't respond until it's gone out and tested its answer in a sandbox to confirm it actually compiles.
- AprilisKalends 2y agoI personally haven't figured out why there isn't a tool that just loops the AI severals times on a task by compiling, feeding in the errors adjusting and repeating and then letting the user review the result be in a success or failure by exceed the loop limits.
- ta988 2y agoThey exist in various forms...
- throawayonthe 2y ago[dead]
- staticautomatic 2y ago
- ninininino 2y agoA language like Golang tries really hard to only have _one_ way to do something, one right way, one way. Just one way. See how it was before generics. You just have a for loop. Can't really mess up a for loop. I predict that the variance in success in using LLM for coding (even agentic coding with multi-step rather than a simple line autosuggest or block autosuggest that many are familar with via CoPilot) has much more to do with: 1) is the language a super simple, hard to foot-gun yourself language, with one way to do things that is consistent AND 2) do juniors and students tend to use the lang, and how much of the online content vis a vis StackOverflow as an example, is written by students or juniors or bootcamp folks writing incorrect code and posting it online. What % of the online Golang is GH repo like Docker or K8s vs a student posting their buggy Gomoku implementation in StackOverflow? The future of programming language design has AI-comprehensibility/AI-hallucination-avoidance as one of the key pillars. #1 above is a key aspect.
- andix 2y ago> A language like Golang tries really hard to only have _one_ way to do something Really? Logging in Go: A Comparison of the Top 9 Libraries https://betterstack.com/community/guides/logging/best-golang-logging-libraries/ https://betterstack.com/community/guides/logging/best-golang...
- evanmoran 2y agoSince Go added slog many of these have been removed in favor of that. Obviously not universal, but compared to npm there really are massive numbers of devs just using the standard library.
- throwaway920102 2y agoI would argue logging options to be more of an exception than the rule. Compare the actual language features of Go to something like Rust or Javascript and you'll see what I mean. As a new developer to the language (especially for juniors), you can learn all the features of Go much faster. It's made to be picked up quickly and for everyone's code to look the same, rather than expressing a personal style.
- bugglebeetle 2y ago> LLMs. I really don't get how so many people can get LLMs to code most of their tasks without those issues permanently popping up. You write tests in the same way as you would when checking your own work or delegating to anyone else?
- magicalhippo 2y agoI've used it for some smaller greenfield code with success. Like, write an Arduino program that performs a number of super-sampled analog readings, and performs a linear regression fit, printing the result to the serial port. That sort of stuff can be very helpful to newbies in the DIY electronics world for example. But for anything involving my $dayjob it's been fairly useless beyond writing unit test outlines.
- ianbutler 2y agoI use it everyday, it has to have good search and good static analysis built in. You also have to be very explanatory with a direct communication style. Our system imports the codebase so it can search and navigate plus we feed lsp errors directly to the LLM as development is happening.
- magicalhippo 2y ago> we feed lsp errors directly to the LLM as development is happening Yeah I guess that would help a lot. Stuck with a bit more primitive tools here, so that doesn't help.
- andix 2y ago> Like, write an Arduino program that performs stuff like that works amazing > But for anything involving my $dayjob it's been fairly useless beyond writing unit test outlines This was my opinion 3-6 months ago. But I think a lot of tools matured enough to already provide a lot of value for complex tasks. The difficult part is to learn when and how to use AI.
- nottorp 2y ago> That sort of stuff can be very helpful to newbies Yep, if it's newbie stuff there are enough tutorials out there for the LLM to have data. It's when you get off the tutorials and do the actual functionality of your project that they fail.
- runeblaze 2y agoThey are good at (combining well-known, codeforces-style) algorithms; often times I don’t care about the syntax, but I need the algorithm. LLMs can write pseudocode for all I care but they tend to get syntax correct quite often
- johnisgood 2y agoI have made large projects using Claude, with success. I know what I want to do and how to do it, maybe my prompts were right.
- miunau 2y agoHow do you deal with large files? After about a thousand lines in a file, it starts to cough for me. Forgets that some functions exist and makes up inferior duplicate ones.
- deleted 2y ago[deleted]
- johnisgood 2y agoI did not experience hallucinations (very rarely if at al) when I use it for programming. It happened more with niche languages (so I provide examples and documentation), and with GPT. Let us say there is 3k lines of RFCs, API, documentation of niche languages, examples), 2k lines of code generated by Claude (iteratively, starting small), then I do exceed the limit after a while. In that case I ask it to summarize everything in detail, start a new chat, use those 3k lines and the recent code, and continue ad infinitum.
- 0x5f3759df-i 2y agoIf possible you need to refactor before getting to that point. Claude has done a good job refactoring, though I’ve had to tell it to give me a refactor plan upfront in case the conversation limit gets hit. Then in a new chat I tell it which parts of the plan it has already done. But a larger context/conversation limit is definitely needed because it’s super easy to fill up.
- anonzzzies 2y agoI ask it to cut files up when they get too large, that seems t work pretty well. It is also good at that, but you have to sternly tell it NOT to make any functional changes, otherwise it will and breakage will happen.
- 2y ago
- HarHarVeryFunny 2y agoWhat TFA was talking about didn't really seem like an hallucination - just a case of garbage in-garbage out. Normally there are more examples of good/correct data in the training set than bad, so statistically the good wins, but if it's prompted for something obscure maybe bad is all that it has got. Common coding tasks are going to be better represented in the training set and give better results.
- genewitch 2y agoIt means that "reasoning" isn't.
- zelphirkalt 2y agoProbably by coding things that are bery mainstream and have already been fed to the LLM a thousand times from ripped off projects.
- afro88 2y agoHere's the secret to coding with an LLM: don't expect it to get things 100% correct. You will need to fix something almost every time you use it to generate code. Maybe a name here, maybe a calculation, maybe a function signature. And maybe you won't spot the issue until later. You still "used" an LLM to write the code. And it still saved you time (though depending on the circumstances this can be debatable). That's why all these people say they use LLMs to write lots of code. They aren't saying it did it 100% without any checking and fixing. They're just saying they used it.
- L-four 2y agoThe trick to coding with LLMs is not caring if the code is correct.
- andrelaszlo 2y agoCall me cynical but coding at some companies has such perverse incentives that I kind of get it: - "Solve" the issue assigned to me with a bunch of code that looks about right. Passes review and probably not covered by tests anyway. - Once QA or customers notice it's not working, I can get credit for "solving" the bug as well. - Repeat for 0 value delivered but infinite productivity points in my next performance review.
- nsoonhui 2y agoI suppose that you are using a dynamic language? Static typed languages have less of this problem.
- andrelaszlo 2y agoThis is a hypothetical "I". Personally I am deeply passionate about delivering shareholder value, producing high-quality code, enthusing stakeholders, tabs vs spaces, and so forth...
- pllbnk 2y agoSometimes I don't know anything (relatively) about the topic and I want to get a foundation so I don't care whether the syntax or the code is valid as long as it points me in the right direction. Other times I know exactly what I want and I just find that instructing LLM specifically what output I expect from it just helps me get there faster.