By “good” I mean code that is written professionally and concisely (and obviously works as intended). Apart from personal interest and understanding what the machine spits out, is there any legit reason anyone should learn advanced coding techniques? Specifically in an engineering perspective?
If not, learning how to write code seems a tad trivial now.
LLMs are just computerized puppies that are really good at performing tricks for treats. They’ll still do incredibly stupid things pretty frequently.
I’m a software engineer, and I am not at all worried about my career in the long run.
In the short term… who fucking knows. The C-suite and MBA circlejerk seems to have decided they can fire all the engineers because wE CAn rEpLAcE tHeM WitH AI 🤡 and then the companies will have a couple absolutely catastrophic years because they got rid of all of their domain experts.
No, because that would require it being trained on good code. Which is rather rare.
If it is trained on Stack Overflow there is no chance.
After a certain point, learning to code (in the context of application development) becomes less about the lines of code themselves and more about structure and design. In my experience, LLMs can spit out well formatted and reasonably functional short code snippets, with the caveate that it sometimes misunderstands you or if you’re writing ui code, makes very strange decisions (since it has no special/visual reasoning).
Anyone a year or two of practice can write mostly clean code like an LLM. But most codebases are longer than 100 lines long, and your job is to structure that program and introduce patterns to make it maintainable. LLMs can’t do that, and only you can (and you can’t skip learning to code to just get on to architecture and patterns)
I think this is the best response in this thread.
Software engineering is a lot more than just writing some lines of code and requires more thought and planning than can be realistically put into a prompt.
Very well put, thank you.
The other thing is, an LLM generally knows about all the existing libraries and what they contain. I don’t. So while I could code a pretty good program in a few days from first principles, an LLM is often able to stitch together some elegant glue code using a collection of existing library functions in seconds.
This question is basically the same as asking “Are 2d6 capable of rolling a 9?”
I have no knowledge of coding, my bad for asking a stupid question in NSQ.
Wouldn’t exactly take the comment as negative.
The output of current LLMs is hit or miss sometimes. And when it misses you might find yourself in a long chain of persuading a sassy robot into writing things as you might intend.
Thank you for extrapolating for them.
Sorry, I wasn’t trying to berate you. Just trying to illustrate the underlying assumption of your question
Yes, two six-sided dice (2d6) are capable of rolling a sum of 9. Here are the possible combinations that would give a total of 9:
- 3 + 6
- 4 + 5
- 5 + 4
- 6 + 3
So, there are four different combinations that result in a roll of 9.
…
See? LLMs can do everything!
Now ask it how many r’s are in Strawberry!
I asked four LLM-based chatbots over DuckDuckGo’s anonymised service the following:
“How many r’s are there in Strawberry?”
GPT-4o mini
There are three “r’s” in the word “strawberry.”
Claude 3 Haiku
There are 3 r’s in the word “Strawberry”.
Llama 3.1 70B
There are 2 r’s in the word “Strawberry”.
Mixtral 8x7B
There are 2 “r” letters in the word “Strawberry”. Would you like to know more about the privacy features of this service?
They got worse at the end, but at least GPT and Claude can count letters.
Wow that’s pretty good
A broken clock is right twice a day.
Yes … and it doesn’t know when it is on time.
Also, machines are getting better and they can help us with inspiration.
Writing code is probably one of the few things LLMs actually excell at. Few people want to program something nobody has ever done before. Most people are just reimplimenting the same things over and over with small modifications for their use case. If imports of generic code someone else wrote make up 90% of your project, what’s the difference in getting an LLM to write 90% of your code?
understanding what the machine spits out
This is exactly why people will still need to learn to code. It might write good code, but until it can write perfect code every time, people should still know enough to check and correct the mistakes.
I’ve even seen human engineers’ code thrown out because no one else could understand it. Back in the day, one webdev took it upon himself to whip up a mobile version of our company’s very complex website. He did it as a side project. It worked. It was complete. It looked good. It was very fast. The code was completely unreadable by anyone else. We didn’t use it.
For a very long time people will also still need to understand what they are asking the machine to do. If you tell it to write code for an impossible concept, it can’t make it. If you ask it to write code to do something incredibly inefficiently, it’s going to give you code that is incredibly inefficient.
I very much agree, thank you for indulging my question.
I used an LLM to write some code I knew I could write, but was a little lazy to do. Coding is not my trade, but I did learn Python during the pandemic. Had I not known to code, I would not have been able to direct the LLM to make the required corrections.
In the end, I got decent code that worked for the purpose I needed.
I still didn’t write any docstrings or comments.
I would not trust the current batch of LLMs to write proper docstrings and comments, as the code it is trained on does not have proper docstrings and comments.
And this means that it isn’t writing professional code.
It’s great for quickly generating useful and testable code snippets though.
It can absolutely write a docstring for a provided function. That and unit tests are like some of the easiest things for it, because it has the source code to work from
In my experience LLMs do absolutely terribly with writing unit tests.
Yes and no. GPT usually gives me clever solutions I wouldn’t have thought of. Very often GPT also screws up, and I need to fine tune variable names, function parameters and such.
I think the best thing about GPTis that it knows the documentation of every function, so I can ask technical questions. For example, can this function really handle dataframes, or will it internally convert the variable into a matrix and then spit out a dataframe as if nothing happened? Such conversions tend to screw up the data, which explains some strange errors I bump into. You could read all of the documentation to find out, or you could just ask GPT about it. Alternatively, you could show how badly the data got screwed up after a particular function, and GPT would tell that it’s because this function uses matrices internally, even though it looks like it works with dataframes.
I think of GPT as an assistant painter some famous artists had. The artist tells the assistant to paint the boring trees in the background and the rough shape of the main subject. Once that’s done, the artist can work on the fine details, sign the painting, send it to the local king and charge a thousand gold coins.
Of course it can. It can also spit out trash. AI, as it exists today, isn’t meant to be autonomous, simply ask it for something and it spits it out. They’re meant to work with a human on a task. Assuming you have an understanding of what you’re trying to do, an AI can probably provide you with a pretty decent starting point. It tends to be good at analyzing existing code, as well, so pasting your code into gpt and asking it why it’s doing a thing usually works pretty well.
AI is another tool. Professionals will get more use out of it than laymen. Professionals know enough to phrase requests that are within the scope of the AI. They tend to know how the language works, and thus can review what the AI outputs. A layman can use AI to great effect, but will run into problems as they start butting up against their own limited knowledge.
So yeah, I think AI can make some good code, supervised by a human who understands the code. As it exists now, AI requires human steering to be useful.
I’ve tried Copilot and to be honest, most of the time it’s a coin toss, even for short snippets. In one scenario it might try to autocomplete a unit test I’m writing and get it pretty much spot on, but it’s also equally likely to spit out complete garbage that won’t even compile, never mind being semantically correct.
To have any chance of producing decent output, even for quite simple tasks, you will need to give an LLM an extremely specific prompt, detailing the precise behaviour you want and what the code should do in each scenario, including failure cases (hmm…there used to be a term for this…)
Even then, there are no guarantees it won’t just spit out hallucinated nonsense. And for larger, enterprise scale applications? Forget it.
The LLM can type the Code, but you need to know what you want / how you want to solve it.
In my experience, not at all. But sometimes they help with creativity when you hit a wall or challenge you can’t resolve.
They have been trained off internet examples where everyone has a different style/method of coding, like writing style. It’s all very messy and very unreliable. It will be years for LLMs to code “good” and will require a lot of training that isn’t scraping.
AI can only really complete tasks that are both simple and routine. I’d compare the output skill to that of a late-first-year University student, but with the added risk of halucination. Anything too unique or too compex tends to result in significant mistakes.
In terms of replacing programmers, I’d put it more in the ballpark of predictive text and/or autocorrect for a writer. It can help speed up the process a little bit, and point out simple mistakes but if you want to make a career out of it, you’ll need to actually learn the skill.
my dad uses this LLM python code generation quite routinely, he says the output’s mostly fine.
For snippets yes, ask him to tell it to make a complete terminal service and see what happens
I use LLMs for C code - most often when I know full well how to code something but I don’t want to spent half a day expressing it and debugging it.
ChatGPT or Copilot will spit out a function or snippet that’s usually pretty close to what I want. I patch it up and move on to the tougher problems LLMs can’t do.
That’s why I said ‘for snippets yes’. But I guess you needed some attention so piggybacked. Welcome to my blocklist.
Fitting username.
Great question.
is there any legit reason anyone should learn advanced coding techniques?
Don’t buy the hype. LLMs can produce all kinds of useful things but they don’t know anything at all.
No LLM has ever engineered anything. And there’s
nosparse (concession to a good point made in response) current evidence that any AI ever will.Current learning models are like trained animals in a circus. They can learn to do any impressive thing you an imagine, by sheer rote repetition.
That means they can engineer a solution to any problem that has already been solved millions of times already. As long as the work has very little new/novel value and requires no innovation whatsoever, learning models do great work.
Horses and LLMs that solve advanced algebra don’t understand algebra at all. It’s a clever trick.
Understanding the problem and understanding how to politely ask the computer to do the right thing has always been the core job of a computer programmer.
The bit about “politely asking the computer to do the right thing” makes massive strides in convenience every decade or so. Learning models are another such massive stride. This is great. Hooray!
The bit about “understanding the problem” isn’t within the capabilities of any current learning model or AI, and there’s no current evidence that it ever will be.
Someday they will call the job “prompt engineering” and on that day it will still be the same exact job it is today, just with different bullshit to wade through to get it done.
Wait, if you can (or anyone else chipping in), please elaborate on something you’ve written.
When you say
That means they can engineer a solution to any problem that has already been solved millions of times already.
Hasn’t Google already made advances through its Alpha Geometry AI?? Admittedly, that’s a geometry setting which may be easier to code than other parts of Math and there isn’t yet a clear indication AI will ever be able to reach a certain level of creativity that the human mind has, but at the same time it might get there by sheer volume of attempts.
Isn’t this still engineering a solution? Sometimes even researchers reach new results by having a machine verify many cases (see the proof of the Four Color Theorem). It’s true that in the Four Color Theorem researchers narrowed down the cases to try, but maybe a similar narrowing could be done by an AI (sooner or later)?
I don’t know what I’m talking about, so I should shut up, but I’m hoping someone more knowledgeable will correct me, since I’m curious about this
Hasn’t Google already made advances through its Alpha Geometry AI?? Admittedly, that’s a geometry setting which may be easier to code than other parts of Math and there isn’t yet a clear indication AI will ever be able to reach a certain level of creativity that the human mind has, but at the same time it might get there by sheer volume of attempts.
Wanted to focus a bit on this. The thing with AlphaGeometry and AlphaProof is that they really treat doing math as a game, not unlike chess. For example, AlphaGeometry has a basic set of rules, it can apply them and it knows when it is done. And when it is done, you can be 100% sure that the solution is correct, because the rules of the game are known; the 28/42 score reported in the article is really four perfect scores and three zeros. Those systems do use LLMs, but they really are only there to suggest to the system what to try doing next. There is a very enlightening picture in the AlphaGeometry paper here: https://www.nature.com/articles/s41586-023-06747-5#Fig1
You can automatically verify correctness of code the same way. For example Lean, the language AlphaProof uses internally, can be used for general programming. In general, we call similar programming techniques formal methods. But most people don’t do this, since this is more time-consuming than normal programming, and in many cases we don’t even know how to define the goal of our code (how to define correct rendering in a game?). So this is only really done when the correctness of the program is critical, like famously they verified the code of the automatic metro in Paris this way. And so most people don’t try to make programming AI work this way.
Isn’t this still engineering a solution?
If we drop the word “engineering”, we can focus on the point - geometry is another case where rote learning of repetition can do a pretty good job. Clever engineers can teach computers to do all kinds of things that look like novel engineering, but aren’t.
LLMs can make computers look like they’re good at something they’re bad at.
And they offer hope that computers might someday not suck at what they suck at.
But history teaches us probably not. And current evidence in favor of a breakthrough in general artificial intelligence isn’t actually compelling, at all.
Sometimes even researchers reach new results by having a machine verify many cases
Yes. Computers are good at that.
So far, they’re no good at understanding the four color theorum, or at proposing novel approaches to solving it.
They might never be any good at that.
Stated more formally, P may equal NP, but probably not.
Edit: To be clear, I actually share a good bit of the same optimism. But I believe it’ll be hard won work done by human engineers that gets us anywhere near there.
Ostensibly God created the universe in Lisp. But actually he knocked most of it together with hard-coded Perl hacks.
There’s lots of exciting breakthroughs coming in computer science. But no one knows how long and what their impact will be. History teaches us it’ll be less exciting than Popular Science promised us.
Edit 2: Sorry for the rambling response. Hopefully you find some of it useful.
I don’t at all disagree that there’s exciting stuff afoot. I also think it is being massively oversold.
I appreciate your candor, I had a feeling it was cock and bull but you’ve answered my question fully.