by armchairhacker · 3y ago · 0 comments
Even if it isn't 90%, most developers like writing code more than debugging, so most would prefer to automate the latter.
AI translating natural language into code probably isn't as important as AI generating bug-free code and/or debugging its code. Even GPT-4 struggles with this: sometimes you point out a bug and it works, but sometimes it just can't find the issue and starts hallucinating even more as it gets confused.
Everyone's trying to train GPT models to write code, but maybe we should be training them how to use a debugger. Though its a lot harder to map text generation to debugging...
Also, it's a bit ironic how one way to prevent bugs is using stronger type systems and formal methods. But, AI is particularly bad at formal methods. But maybe with a system like MCTS combined with much faster generation...
it was then maintained by at least 20 different people that had no idea what they were doing
very little of the altered logic makes any sense and 95% of the time consists of trying to reverse engineer what they were trying to do
then fix it up without breaking other parts of the codebase as many of the logic bugs interact with each other and end up cancelling out
with the garbage generated by LLMs... I suspect all development is going to turn into this
Sounds awful. I was hoping for the future where we would all be out of a job.
we had two new starters and one long term employee quit after being asked to work on that codebase
(and ended up having to do it myself at extremely short notice... worked though)
on edit: https://www.zippia.com/cobol-programmer-jobs/salary/#
It also used to pay better, although at this point I'm pretty sure operating COBOL is just a sign that you're unwilling or unable to invest in upgrading your <1990s IT. The remaining companies operating COBOL systems likely aren't even able to pay top dollar.
the logic is simply broken
AI lay-person, web developer here.
This hits at something that's been nagging at me for a few weeks. LLMs get labelled "intelligent", but they're "just" spitting out word/symbol patterns. They don't comprehend the meaning of the patterns (as best I have come to understand it from reading news).
Deeper than this, "intelligence" isn't rooted in words. It's rooted in experience, logic and their interaction. The words are a side-effect; they're a way to label the experiences.
We're not training LLMs with experiences, only a reference to experience had by others, which may or may not map to the experience of the interlocutor. The LLM has no experience and limited/no logic to wrestle those experiences into wisdom.
Debugging is a "pursuit of wisdom" activity. Statistics, which underpin LLMs often identify truths (we wouldn't use them in science if they didn't), but they also hide truths. You need to clean data, take unusual slices of it, recombine it, and otherwise process it in order to uncover the true truths. I'm not sure LLMs can do that yet (if at all), and strongly doubt they can without _experience_ (sensory input, intention, failure etc).
It is not obvious to me that this is true.
The argument against this is that a model has to develop an abstract understanding of the world in order to get better at predicting the next token.
You'll find different opinions as to wether this happens with todays llm's, but it's definitely not a clear cut issue.
I think they only develop abstract understanding about the relationships of the words/group of words.
I think the word you are looking is knowledgeable. They have huge knowledge repository and can remix it in whatever way they please, but I don't think if you gave them a novel problem (outside their realm of knowledge) they could solve it.
As another example, ImageBlind, https://ai.facebook.com/blog/imagebind-six-modalities-bindin..., learned modality translations explicitly not in its training set such as text -> sound.
If a technical product manager was able to generate the code needed for a feature using some combination of LLMs and CoPilots—even for proof of concepts, for example—the business would need to hire fewer developers and saves significant operating costs.
Extending it to your everyday person. Aunt Jane bought a new washing machine and wants to add it into her smart house. Either she's gotta call the niece to hook it all up, write the integration to Home Assistant, write automations for her iOS devices, etc, or, she asks her favorite LLM / Co-Pilot for help and it step-by-step walks her through it directly, with code, with individual troubleshooting.
There's business in both use cases, but the total addressable market is quite a bit bigger for one of them.
Your average person's ideal amount of exposure to code is zero (as in, most would prefer to not even think about code). If the device isn't automated from the getgo in an easy way, then Aunt Jane has no smart device and no matter how easy it is to write the connection, she's not going to have it unless her niece shows up.
You're severely overestimating the desire for an everyday person to automate their home. Most people are perfectly fine manually flicking light switches and unless you live on a very specific schedule, often automation ends up falling short of practical reality, so even the majority of people who "automate" just end up moving the light switch to their phone.
I know a cartographer who makes maps in some specialized software and then also has to occasionally interact with some official federally managed database. This person is not a software engineer and the database interaction has been historically painful in the office. This year ChatGPT just helped whip up some Python scripts.
Two hypotheses: 1) the “in house tooling” market is huge and will make great use of this tech; 2) that will contribute to pushing the floor lower and lower where more and more roles and people will take advantage of it.
This is exactly where it completely breaks down. The AI might as well show her some hieroglyphics.
Yes, today, developers are people who know programming languages, that's something non-developers don't know, so teach an AI do code and you can spare a developer, right?
But no, what developers really do is tell the computer precisely what it should do, a programming language simply the best way we have found to do it. Using GUIs, natural languages, etc... may fell less obscure to the layman, but the problem doesn't go away, in fact, it is often made worse because of the fuzziness of natural languages. There is a reason developer have been using programming languages for so long despite countless attempts to find alternatives, they simply haven't been matched for the task of telling a computer what to do precisely. And if something better is found, then developers will use that, and besides some syntactic technicalities, the job will be essentially the same.
bool
files_read(const char *path, char **data, size_t *size) {
FILE *f = fopen(path, "rb");
if (!f) {
return false;
}
fseek(f, 0, SEEK_END);
size_t n = (size_t)ftell(f);
rewind(f);
if (size) {
*size = n;
}
if (!data) {
goto ok;
}
*data = (char*)malloc(sizeof(char)*(n + 1));
if (fread(*data, 1, n, f) != n) {
free(*data);
return false;
}
*data[n] = '\0';
ok:
fclose(f);
return true;
}
ChatGPT solves this task instantly. Many, even experienced C developers, would have trouble finding the bug. And the lack of error checking on malloc is not a bug.> The issue in this code is related to memory access. The line data[n] = '\0'; should be (data)[n] = '\0';.
And then went on to generate corrected code and this explanation:
> The original expression, data[n], first applies the array subscript operation, which is equivalent to (data + n), and then tries to dereference the resulting pointer, which is not the intention here. This will likely lead to a segmentation fault because data is a pointer to pointer, and data[n] will try to access memory that has not been allocated.
> The corrected expression, (*data)[n], first dereferences data to get the allocated char array, and then applies the array subscript operation to set the null terminator at the correct location.
I'm not trying to say this isn't impressive, but seems fairly obvious and more like something a linter / analyzer would pickup ?
Actually, no, let's talk about the bug. What's with people's obsession of eliminating local temporaries and working straight with pointer-to-result?
char *buff = malloc(n + 1);
if (fread(buff, 1, n, f) != n) {
free(buff);
fclose(f);
return false;
}
buff[n] = '\0';
*data = buff;
ok:
fclose(f);
return true;
This way, data won't contain a freed pointer when reading fails.It kinda works tho. In my anecdote Copilot works much better with C# than Python simply because I can write the signature of a function and that it generates the content.
(I know Python has type annotations too, but Copilot just isn't as smart as with C#. Perhaps because there isn't enough training data in typed Python?)
But yes, what you described matches my experience. I'd say Copilot benefits those "tedious but relatively strict" languages the most.
But it obviously doesn't have knowledge of your domain, and I don't think any LLM could do a perfect job without that.
It happened so fast that so many people are in denial and many people aren't even asking the obvious questions. Simply ASK chatGPT to refactor your code to be more unit testable and IT Can do it.
Of course it clearly has your typical LLM problems but it is roughly 50% there. The game has changed. If AI gets to 100%, not only will the game be changed, but humans will no longer be part of the game.
See what I asked chatGPT:
ME:
def (x: int):
for i in range(x):
print(i)
Can you refactor the code so it can be more unit testable?
CHATGPT:
Certainly! To make the code more unit testable, we can refactor it into a function that returns a list of integers instead of directly printing them. Here's the refactored code:
python
def generate_number_list(x: int) -> List[int]:
number_list = []
for i in range(x):
number_list.append(i)
return number_list
In this refactored code, we've created a function called generate_number_list that takes an integer x as input. Instead of printing each number, we use a number_list variable to store the generated numbers by appending them in the loop. Finally, we return the number_list.
By returning the list instead of printing the numbers directly, we make the code more testable because we can now write unit tests that assert the correctness of the generated list.
If boggles my mind that I see threads of people saying "what if we train LLMs to do this or to do that?" or whatever. Guys, just ask the LLM to do what you want in plain English. It can do it.IME GPT-4 can't write a bug-free 10 line shell script. It's particularly poor at inferring unstated requirements - or the need to elicit the same.
There's a general problem with LLMs: they're too eager to please. It shows up as confirmation bias. Embed a perspective in your prompt, and LLMs continue in the same vein.
You can, with careful prompting, try to provoke and prod the text generation into a more correct shape, but often it feels to me more like a game than productivity. I have to know the answer already to know how to ask the right questions and make the right corrections. So it feels like I'm supervising a child, and that I should be amazed it can do anything at all. And it is amazing; but for productivity outside tightly constrained environments (e.g. converting freeform dialogue into filling out a bureaucratic form - I think this is a close to ideal use case), I struggle to see it scaling up much, from what I've seen so far.
For creativity - e.g. making up a story for a child - it's not bad. One of my favourite use cases, after discovering how bad it is at writing code.
So that means a 10 line bash script at best would have 5 lines of bugs.
But the AI is actually better then that. You've just increased the bar.
The game is designing software to requirements. It's writing literature for a new era. It's creating X for A audience with N vauge unspecified needs -- where X is a complex product made of many parts, involving many people, with shifting and changing problems/solutions/requirements.
The game was never writing the stack overflow answer -- that was already written.
People say, "oh but clients will have to get good at listing specs, that'll never happen". Like bruh the clients will obviously be using LLMs to make the specs too. Eventually the whole B2B workflow will just be LLMs talking to each other or something of the sort.
The problem is this was never a stackoverflow question and there was never an answer for it.
Try finding it. The LLM is already playing the game because it came up with that answer which is Fully Correct, Out of Thin Air.
Look, clearly the LLM can't play the game as well as a trained adept human, but it's definitely playing the game.
>The game is designing software to requirements. It's writing literature for a new era. It's creating X for A audience with N vauge unspecified needs -- where X is a complex product made of many parts, involving many people, with shifting and changing problems/solutions/requirements.
It can do all of this. It can talk like you and parrot exactly what your saying and also go into more detail and re-frame your words more eloquently.
What you're not getting is that all the things you mentioned the LLM can do in actuality to varying degrees to the point where it is in the "game." and at times it does better than us. Likely, you haven't even tried asking it yet.
instead it generates a load of redundant boilerplate
if I saw a developer check that in I'd think they were incompetent
I'm not good at prompting (if I believe what others say they can do with ChatGPT), but that's one thing that bother me with this system. They will do anything you ask them to without questioning it (in the limit given by their creators).
Is it possible to set it up in a way that they will challenge you instead of blindly doing what you ask? In this particular case, is it possible to ask it to do a code review in addition to performing the task?
I've tried various time (with the v3.5) to "tune" it so that each answer will follow a specific format, with links and recommended resources, with several alternatives, etc. The goal is to have it to broad my perspectives as opposed to focus too much on what I'm asking. But it never worked for more than a couple of questions.
Are there ways to do that? What am I doing wrong?
I'm not sure where your side track is coming from. Who in their right mind would ever check in code that prints a range of numbers from 0 to x?
The example wasn't about writing good code or realistic code. It's about an LLM knowing and understanding what I asked it to do. It did this by literally creating a correct answer that doesn't exist. Sorry it doesn't satisfy your code quality standards but that's not part of the task is it? Why don't you ask it to make the code quality better? It can likely do it Maybe that will stop the subtle insults (please don't subtly imply I'm incompetent that's fucking rude)
Like why even get into code quality about some toy example? What's the objective? To fulfill some agenda against AI? I think that's literally a lot of what's going on in this thread.
It is pure pablum. It is almost the perfect example of LLMs producing fluent vapid bilge.
For loops in python that return non lazy evaluated lists are fine. Python was never suppose to be an efficient language anyways, grading python based off of this criteria is pointless.
It doesn't matter how snobbish you are on language syntax though. I fed it code and regardless of whether you think it's garbage it did what I asked it to do and nothing else.
Would you prefer the AI say, "this code is garbage, here's not only how to make it unit testable but how to improve your garbage code." Actually we can make the output more unpredictable as LLMs do have a non deterministic seed that can increase the creativity of the answer.
I didn't say don't bother extending it's capabilities either. You're just projecting that from your imagination. An hallucination so to speak not so far off from what LLMs do. I find your similarity to LLMs quite fascinating.
What I said is, the capability of doing the "extension" you want is already in the LLM. Sure go extend it but what you're not getting is that we've already arrived at the destination.
What I would like to do is feed in my entire 50k line program and get something out.
When you ask for large output or give it large input you are increasing the sample size. Which means more likely that part of the answer are wrong. That's it. Simple statistic that are inline with my initial point. With AI we are roughly half way there at producing answers.
If you keep the answers and questions short you will have a much higher probability of being correct.
So that 50k line program? My claim is roughly 25k of those lines are usable. But that's a fuzzy claim because I LLMs can do much better than 25k. Maybe 75% is more realistic but I'll leave it at 50% so there's a lower bar for the nay sayers to attack.
> ME:
> f(x) = exp(cos(x))
>
> what is f(0) ?
>
> GPT-3.5:
> f(0) = 1
(note, it most often generates the correct result, but I've seen it do the above too)Taking Nair's viewpoint, coding AI will be useful only to the extent that it assists programmers to build and employ their theory of the program. Or to itself develop a useful theory of a specific program, not just programs in general.
[1] https://gist.github.com/onlurking/fc5c81d18cfce9ff81bc968a7f...
I asked it to write a YAML parser in pure Rust. The first thing it did was write this:
pub enum YamlNode {
Scalar(String),
Sequence(Vec<YamlNode>),
Map(HashMap<String, YamlNode>),
}
This is what I expect a freshman in college to write as their first Yaml parser.Literally unusable as a starting point.
I did try to correct it but it tripped up and somehow managed to fuck that up to.
YAML allows YamlNodes as keys in a map (aka complex keys). E.g.
? [ a, b]
: "complex key, scalar value"
You asked it for YAML parser and it gave you a shitty JSON parser.Also this is the most banal thing about YAML, something that should be obvious just browsing the examples. And I gave it test suite and link to YAML spec.
Most work in YAML is around super obscure corner cases.
You also get the bonus of nasty bugs like crash bugs and exploitable memory problems become almost entirely a thing of the past. You can ship new software you know is very reliable.
> But, AI is particularly bad at formal methods.
AI? Or GPT? Earlier, reasoning-based attempts at AI seem like they would be a natural fit for formal methods.
By the way, if you spend 90% of time debugging your code, I think that's really sad. Either the programming language sucks, or the codebase sucks, or both. I probably spend 10-20% max of my time on debugging.
The one thing worse than debugging code is debugging "types". Those 30-page C++ compiler errors are definitely worse than whatever I had to do with (for example) Python.
That's definitely in the "programming language sucks" category. Good languages make it easy to debug problems with your types.
I was responding to a comment that was suggesting letting an AI to do that.
> The one thing worse than debugging code is debugging "types".
It depends on a language. In languages with first-class types, we have the same tools to debug types. Classical C++ templates are more akin to a macro system than a type system.
C++ is sort of the canonical example of a language with a terrible type system, so it's not really the right place to look for this comparison.
Everyone complains how slowly Rust compiles. But at least its error messages are much better.
We can actually try this now. Literally tell the LLM what you want to do and work with it. See how far you can take it. You will of course be asking the LLM for debug line inputs and you will be providing it with outputs as you run the debugger yourself.
Did I learn a bit of java and css and git?- sure, but I was up and running in about 4 hours with a mvp for my 1st one. There is NO way I could "learn" that in that timeframe. I just asked chatGPT 4 how to do it, and it told me. When I didn't know how to commit, it told me (actually I didn't even know the concept). It held my hand every step of the way.
I didn't need to learn something first, I just did it. And I have started doing it at work. "hmm 4 GB of fortinet logs in 20 files of gzip on mac.. how do I find a host name in that? - chatgpt.. oh- 1 line of zgrep.. never heard of it- hey it works.."
admittedly, I am bathed in tech, been hanging around folks talking about projects for years. But NOW I can execute- the problem? When it hits about 500 lines of java- maybe 10 functions, it is too big to drop into the prompt to debug and I don't know enough to fix myself. Solution, make smaller apps, get them working, create data files to reference in json, chain them together. eh, not perfect, but good enough for hobby.
Beware- fools like me who know nothing will be bringing code to production near you soon. Cool that you like to learn stuff, but syntax bores the crud out of me, each to their own, I'm just going to make. I find it more satisfying. Terrifying that code born like mine will end up in someone's prod, but it will.
If AI helps you, you'll emphasize on the overall benefit rather then nitpick at the details because of the clear conflict of interest that LLMs present to programmers.
Before you go on and write such a system it's better to test if the LLM can do debugging to an efficacy level that we require. I don't think anyone has tried this yet and we do know LLMs have certain issues.
But make no mistake, the possibility that an LLM knows how to debug programs is actually quite high. If it can do this: https://www.engraved.blog/building-a-virtual-machine-inside/ it can likely debug a program, but I can't say definitively because I'm too lazy to try.
I do wonder though whether the methods that the LLM provides are reflective of best practice or whether they are simply what happens to be most written in SO or blog posts.
Though i was surprised i can't easily run pdb instance via a python program, still have to use stdin/out apparently.
Next i want to implement automerge (or semiautomerge) between different outputs which e.g. contain variants of the same function to automatically resolve issues spawned from the model forgetting. That's so annoying
I also suspect a lot of issues are due to the training data being on old SW. I think we can automatically remap this with whitelisted functions and parameters (i recall inspect can do this), blacklisted ones from old version NOT present in the current, and maybe a transformation between the two -- or automatisch regenerate if it's wrong, maybe with a modification to the prompt.
Also talking to it in other languages generates massively different code (i used deepl) so i had the crazy idea of spawning Dockers and just letting this automatic/semiautomatic trouble Shooting+ just parallel generating lots of functions using wildly different inputs (and models) to brute force the problem of having to code
I do need to look into a nice terminal interface for N-way merges and parallel gen monitoring.
The most useful thing for me was making some vim keybinds and scripts to automatically grab Codeblocks, run them and quickly regenerate. You can literally just tell it "DF" and if fixes a pandas issue sometimes
The holy grail will probably be local fine tunes/LoRAs for specific issues or libraries, since it only costs a few $ for one. Sign me up for an expert plotly AI in a box for neat plots please
Edit : i also have literally no idea what I'm doing either, but linting and analyzing generated Code blocks could help expedite this whole process as well. And in principle you don't even have to run it if you know the type is wrong or something.
I don't know what this is called but computer science is ostensibly mathematics so i assume/hope there is some rigor here