News for hackers. Stuff that matters.
Re:Pairing with GPT-4 · Fly by logankeenan on Friday March 31, 2023 @08:57AM (#35386435)
This is similar to how I’ve been using ChatGPT. If you know what you need to do and how to do it, then you can tell ChatGPT what to do in a descriptive prompt. It gets you there 75% of the way and then you need to tweak things or ask it to refactor. For me, it’s removed a lot of grunt work and I can focus on the problem rather than coding.

It reminds me of working with a junior developer, you need to understand how to communicate with them effectively.

Re:Pairing with GPT-4 · Fly by camillomiller on Friday March 31, 2023 @09:49AM (#35387133)
Same experience. For me the golden standard for a problem I can conceptualize but I can’t write code for is to start a prompt with “how would you do this with —given language”?

That has taught me some things I didn’t know and helped me formalize and understand concepts better (I think).

Also, on a more funny note, it’s the best ffmpeg interface I’ve ever used :)

Re:Pairing with GPT-4 · Fly by spookthesunset on Friday March 31, 2023 @12:04PM (#35389135)
Yes. I love the idea of using it for ffmpeg!
Re:Pairing with GPT-4 · Fly by moffkalast on Friday March 31, 2023 @01:25PM (#35390198)
Yeah it's starting to remind me of the Star Trek holodeck interface. You still need to know exactly what needs to be done, but it can handle the boilerplate and a rough first implementation, then I can spend my time tweaking it a bit to get exactly what's needed. Probably saved me a whole day of work on a project yesterday.
Re:Pairing with GPT-4 · Fly by spaceman_2020 on Friday March 31, 2023 @04:59PM (#35393568)
For some problems, somehow GPT-3.5 is better than GPT-4.

I asked it to help me extract certain values from a spreadsheet. It gave me a complicated and overly long formula using FIND and MID that didn't even work.

GPT-3.5, otoh, gave me a neat little REGEXEXTRACT formula that worked perfectly.

When I pointed out to GPT-4 that it can just use regex instead, it "apologized" and again rewrote a formula that didn't work.

Re:Pairing with GPT-4 · Fly by avereveard on Friday March 31, 2023 @10:04AM (#35387337)
yeah people are scratching the surface of the potential.

you can write prompt to clean unstructured text into structured text. that becomes the work area.

instead of asking gpt "write me some code in pyton that does x" you can just tell gtp "do x with the structured data in the work area and present a structured result"

gpt becomes the computation engine

granted it's super expensive and quite slow, today

but with a few plugins to take care of mechanical things and the token memory space becoming increasingly bigger, writing the programming step directly on there may be the standard. as soon as vector storage and reasoning steps gets well integrated, it's going explode.

Re:Pairing with GPT-4 · Fly by ZitchDog on Friday March 31, 2023 @03:04PM (#35391791)
I doubt it will be the standard. I think it will always be faster to process data using a script generated by the LLM.

One thing I could see is a "self updating" script, that adjusts its logic on the fly when new data are found.

Re:Pairing with GPT-4 · Fly by avereveard on Friday March 31, 2023 @04:10PM (#35392858)
on one hand it's also explotaible as hell via prompt injection, on the other hand for certain tasks is more robust because it works off the intention you give it, not the instructions, so it can get back on track.
Re:Pairing with GPT-4 · Fly by colordrops on Friday March 31, 2023 @10:10AM (#35387412)
A form of literate code could be to add the prompt as a comment in the source code, along with a version and seed (like stable diffusion), plus the diff from the output to get what you need.

Unfortunately the gpt api is non deterministic, probably due to stupid censorship requirements.

Re:Pairing with GPT-4 · Fly by louiskw on Friday March 31, 2023 @10:23AM (#35387594)
> If you know what you need to do and how to do it

Having used it for the last week or so to help me translate Python -> Rust, I'd say GPT4 is on par with even senior engineers for anything built in. The key areas it falls down on are anything involving org/repo knowledge or open source where things can be out of date.

There's a few teams working on intelligent org/repo/opensource context fetching, which I think will lead to another 10X improvement.

Re:Pairing with GPT-4 · Fly by logankeenan on Friday March 31, 2023 @10:33AM (#35387738)
> I'd say GPT4 is on par with even senior engineers

I agree, I avoided saying that in my original comment to avoid nit picking. The depth of knowledge is incredible. It’ll just make junior level mistakes while writing senior level code.

> The key areas it falls down on are anything involving org/repo knowledge or open source where things can be out of date.

With GPT-4, I’ll paste snippets of code after the prompt so it has that context or even documentation of the API I need it to work with. The web client is still limited in the amount of tokens it’ll accept in the prompt, but that is expected to increase at some point

Re:Pairing with GPT-4 · Fly by IanCal on Friday March 31, 2023 @02:43PM (#35391458)
Also the setup described in the post is like pairing with someone that can't run the code and is writing in notepad.

More intelligently putting it in a loop & other helpers for it (which we're now seeing worked on more) should massively improve performance.

Re:Pairing with GPT-4 · Fly by f0e4c2f7 on Friday March 31, 2023 @11:19AM (#35388415)
This is also available with chatgpt plugins in alpha, one of the plugins is websearch. It works pretty well in bing which also allows this and is reportedly based on gpt4. Short of that, another thing I've found to work pretty well is pasting in the api docs for the relevant api at the beginning of the prompt and explaining that is the more updated info.
Re:Pairing with GPT-4 · Fly by bradgessler on Friday March 31, 2023 @11:28AM (#35388575)
This is a use case I could see GPT really excelling—porting libraries from one programming language to another. How awesome would that be? Newish ecosystems like Rust, Crystal, Elixir, etc. could have a larger set of libraries in a shorter amount of time.

There’s still a lot of need for a human to be involved, buts it’s not hard to see how this will make individual developers more productive, especially as LLMs mature, plug themselves into interpreters, and become more capable.

Re:Pairing with GPT-4 · Fly by weatherlite on Friday March 31, 2023 @12:10PM (#35389253)
I don't share the enthusaism since it probably means humans won't be looking at code much anymore, at least not as a paid job.
Re:Pairing with GPT-4 · Fly by reidjs on Friday March 31, 2023 @04:33PM (#35393227)
The goal shouldn’t be to code, but to create useful software.
Re:Pairing with GPT-4 · Fly by int_19h on Friday March 31, 2023 @04:48PM (#35393425)
The real concern is that code will become too incomprehensible to be debugged by most humans before we solve hallucinations etc (if they even are solvable) leading to bugs.
Re:Pairing with GPT-4 · Fly by chaxor on Sunday April 02, 2023 @01:29AM (#35407481)
I am starting to think of this more in the sense that 'not many people write in assembly anymore' or 'some people write C - sure - but writing in Nim can be a nicer experience and can take care of some of the details for me' and it has been helpful for me to come to terms with the direction things are moving. Granted, this is a big step to higher level "programming" (and those quotes are now bigger than ever) but, as pointed out, these LLMs are even better when you know how to use the linguistic interface like a senior dev rather than a person off the street. Effectively, now devs can now work to make decisions closer to the C-suite by framing the problem and constraints, and spend less time on the frustrating errors while developing.
Re:Pairing with GPT-4 · Fly by rmak on Friday March 31, 2023 @01:02PM (#35389973)
By 2025, the entire WordPress library, including popular plugins, will be written in Rust/C, and it's inevitable that we'll be converging towards assembly language for all software, including web applications.
Re:Pairing with GPT-4 · Fly by melvinmelih on Friday March 31, 2023 @01:16PM (#35390092)
Indeed - why stop at human-readable code? At some point in time we will be solely reliant on AI to understand our own codebase.
Re:Pairing with GPT-4 · Fly by akiselev on Friday March 31, 2023 @02:13PM (#35390977)
Anyone remember Dreamweaver or Microsoft Word HTML output? I imagine the AI generated code will be a lot like that - massively over-constrained and over-engineered to fit the impedance mismatch of a WYSIWYG (what you speak is what you get) editor.

You thought GUIs were bloated and slow before? Just you wait!

Re:Pairing with GPT-4 · Fly by akhosravian on Friday March 31, 2023 @02:41PM (#35391418)
Is there something in particular that leads you to that belief?
Re:Pairing with GPT-4 · Fly by elwell on Friday March 31, 2023 @03:15PM (#35391977)
Re:Pairing with GPT-4 · Fly by int_19h on Friday March 31, 2023 @04:25PM (#35393111)
I've been experimenting with GPT-4 to see how it could be integrated in video games for NPC decision making. After trying a few different approaches to give it access to the world state for reasoning, I found that it seems to do best when given a bunch of table definitions and told to write SQL queries against them; for some reason, it navigates object graphs much worse. Here's an example schema and session (the game here is Mount & Blade 2: Bannerlord, which is convenient because it's written in C# and it's easy to access and dump the entire game state in whatever format):

https://gist.github.com/int19h/4f5b98bcb9fab124d308efc19e530...

Take a close look at the SQL queries it generated to answer the question. On one hand, it's very impressive that it can write a complex query like this as part of its reasoning in response to a question like "pick a bride for your son":

   SELECT name, age, clan_name FROM (SELECT * FROM people WHERE name IN ("Mesui", "Abagai", "Yana", "Korte", "Bolat", "Chagun", "Alijin", "Unagen", "Sechen")) AS potential_brides INNER JOIN clans ON potential_brides.clan_name = clans.name WHERE clans.tier = (SELECT MAX(tier) FROM clans WHERE kingdom_name = (SELECT kingdom_name FROM clans WHERE name="Oburit"))
On the other hand, this is clearly far from the optimal way to write such a query. But thing is - it works, and if there's no way to get it to write more performant queries, the problem can be "solved" by throwing more hardware at it.

So, yes, I think you're right. The more code out there will be written by AI, the more it will look like this - working, but suboptimal and harder to debug.

Re:Pairing with GPT-4 · Fly by chaxor on Sunday April 02, 2023 @01:38AM (#35407527)
I'm always baffled that people complain that the code provided is not 'performant enough' or 'is too verbose', etc. It's usually providing a solution that is the most typical solution given by all programmers - but the beautiful thing about it is - you can ask it to adjust the code to match a given constraint. Just like your colleague. Only usually far, far better honestly - because you get a response in about 3 seconds, and iterate to the answer in about a total of t minutes, rather than receiving something (maybe it's good, maybe it's entirely missing the constraints) .. in 4 days.
Re:Pairing with GPT-4 · Fly by pmoriarty on Friday March 31, 2023 @03:34PM (#35392293)
And after that we'll just stop being able to understand any code whatsoever, since it'll be written by AIs in a way no human could ever understand.

Not to mention that humans will stop learning how to program, since they won't need to as the AIs will be doing all the coding for them.

There'll be a general de-skilling of humans, as they offload the doing of virtually everything to robots and AIs.

Then Idiocracy will have truly arrived, only it'll be even worse.

Re:Pairing with GPT-4 · Fly by TheHappyOddish on Friday March 31, 2023 @08:35PM (#35395734)
I for one love Brawndo!
Re:Pairing with GPT-4 · Fly by mgoetzke on Sunday April 02, 2023 @02:06PM (#35413360)
It's got electrolytes !
Re:Pairing with GPT-4 · Fly by resters on Friday March 31, 2023 @04:05PM (#35392782)
I thought that at first.

I think with LLMs we will start to see code with better and more descriptive comments, since there is significant advantage to be found when the code has as much information and context as possible.

Human programmers often hoard that for job security or out of laziness.

Re:Pairing with GPT-4 · Fly by js2 on Friday March 31, 2023 @10:50AM (#35387983)
The other day I made a change to one of our iOS builds such that the ipa (a zip file) now contained a subdirectory called "Symbols/". I wanted to know how much space the compressed symbols grew the overall ipa by. I immediately typed this on the command line:

    zipinfo -l foo.ipa "Symbols/*" | awk '{t+=$6}END{print t/1024/1024}'
I work with developers who are not CLI-fluent and wondered what they'd do. And then I realized, they might ask ChatGPT. So I asked it: "How do I figure out how much space a subdirectory of files takes up within a zip file?"

It took a lot of prompting to guide it to the correct answer:

https://imgur.com/a/kAaMova

The weird part to me is how sure it is of itself even when it's completely wrong. (Not too different from humans I work with, self included, but still...) e.g.

> "The reason I moved the subdir filtering to 'awk' is that the 'zipinfo' command doesn't support filtering by subdirectory like the 'unzip' command does."

Where does it come up with that assertion and why is it so sure? Then you just tell it it's wrong and it apologizes and moves on.

Now, the addendum here is that if either of us had read the zipinfo man page more closely, we would've realized it's even simpler:

   zipinfo -lt foo.ipa "Symbols/*" | tail -1
---

I also tried to use it to translate about 10 lines of Ruby that was just mapping a bit of json from one shape to another to jq. It really went off into the weeds on that one and initially told me it was impossible because the Ruby was opening a file and jq has no I/O. So I told it to ignore that part and assume stdin and stdout and it got closer, but still came up with something pretty weird. The core of the jq was pretty close, but for example, it did this to iterate over an object's values:

    to_entries | .value.foo
Instead of just using the object value iterator:

    [].foo
---

One of my pet peeves is developers who never bother to learn idiomatic code for a particular language, and both of these turn out to be that sort of thing. I guess it's no worse than folks who copy/paste from StackOverflow, but I kind of hoped ChatGPT would generate things that are closer to idiomatic and more based on reference documentation but I haven't seen that to be the case yet.

---

Has anyone here tried using it for code reviews instead of writing code in the first place? How does it do with that?

Re:Pairing with GPT-4 · Fly by adwf on Friday March 31, 2023 @06:46PM (#35394793)
I think part of the problem is that they've wrapped all the responses in a positive language framing to make it feel more human.

It's always "Sure thing!" or "Yeah I can do that!", and it responds so quickly that you equate it to when a human responds instantly with a strong affirmative - you assume they're really confident and you're getting the right result.

If it took 5-10s on each query, had no positive framing and provided some sort of confidence score for each answer, I think we'd have different expectations of what it can do.

Re:Pairing with GPT-4 · Fly by quickthrower2 on Saturday April 01, 2023 @01:40AM (#35397477)
I am not familiar with these command line tools so I would probably just compare the file sizes of the 2 artefacts, or if there are other differences in the artefacts and I has to hone in, just open it up in 7z GUI and take a look.

As for ChatGPT i have jokingly thought to always tell ChatGPT “that didn’t work” until it settles on something it is really confident on (no more alternatives) then try that.

Re:Pairing with GPT-4 · Fly by int_19h on Saturday April 01, 2023 @03:52PM (#35403495)
Note that this is GPT-3.5. GPT-4 solves this problem correctly with Python, at least, although it still struggles with the shell. I think that's a function of the training data - it is known that Python is the most represented language in the training set.
Re:Pairing with GPT-4 · Fly by cameronfraser on Friday March 31, 2023 @12:23PM (#35389421)
Exactly! I've been telling people for a bit, it's like having a junior dev on the team that knows a lot of weird stuff
Re:Pairing with GPT-4 · Fly by brundolf on Friday March 31, 2023 @12:30PM (#35389500)
Maybe I should just try it, but I don't feel like there are many situations where the process of "come up with a way to describe exactly what I want, generate it, and then debug the output until it works" would be faster than "just write it myself". And most of the ones I can think of would be in a situation where I'm working in an unfamiliar language/framework, and it's less about not having to type out the code and more about not having to context-switch to reference the docs for something I don't know off the top of my head

Which- maybe that's just the thing, maybe that's what people are using this for right now

(This could change once it gets to the point of stamping out entire projects, but for now)

Re:Pairing with GPT-4 · Fly by CookieCrisp on Friday March 31, 2023 @12:40PM (#35389650)
If you haven't tried it out, I recommend you do. I've been blown away with how much it will just get right. I started out giving it small tasks, but, I have continually been in a loop of "oh, I could have just asked it to do this larger task that contained the subtask I asked for, and it would have done it", because I keep thinking "surely it wont be able to do the whole thing", and each iteration I am asking it for more and more.

As far as debugging, I find that I can just say "are there any bugs in that code?" and it does a great job at finding them if they're there (even though it's what it just gave me)

Re:Pairing with GPT-4 · Fly by montecarl on Friday March 31, 2023 @12:56PM (#35389888)
I'll give two examples of code I could for sure write myself but that I had gpt4 write for me because I figured it would be faster (and it was).

The first one was to write a python script to watch a list of files given as cmd line arguments and plot their output anytime one of the files changed. It wrote a 100 line python script with nice argument parsing to include several options (like title and axes labels). It has one tiny bug in it that took a couple of minutes to fix. When I pointed out the bug it was able to fix it itself (had to do with comparing relative to abs file paths). If I wrote the script myself I would not have made something general purpose and it would have taken maybe 30 minutes to do.

The second example required no fixing and appears bug free. I asked it to write a python function to take a time trace, calculate and plot the FFT, then apply FFT low pass filtering, and then also plot the filtered time signal vs the original. This is all straight forward numpy code but I don't work with FFTs often and would have had to lookup a bunch of different API docs. Way faster.

I have also had it write some c macros for me, since complex C macros can be hard to escape properly and I'm not comfortable with the syntax. Its 100% successful there.

Re:Pairing with GPT-4 · Fly by brundolf on Friday March 31, 2023 @01:02PM (#35389971)
Yeah, so I think all of these fall under that category I mentioned (the first one may or may not for you, but it would for me because I don't work with Python much): most of the time saved is in looking up a bunch of things to assemble together, not ideating and writing out the logic. I can see this kind of codegen being useful in special situations, but it wouldn't really be useful in my day-to-day work because almost by definition I'm very familiar with the technologies I use every day
Re:Pairing with GPT-4 · Fly by ben_w on Friday March 31, 2023 @01:02PM (#35389975)
> come up with a way to describe exactly what I want

This is the thing: you don't need to be exact. Even very vague gets a long way.

Re:Pairing with GPT-4 · Fly by dimal on Friday March 31, 2023 @05:14PM (#35393749)
Same. It’s like working with an incredibly smart junior engineer who doesn’t think things through, sometimes solves problems that don’t exist, and then when you ask for a minor change, inexplicably rewrites everything to be “better”. I haven’t gotten great results yet, but it feels like I just have to figure out how to ask questions correctly so I can lead it down the right path. Seems like I’ve been asking it to solve problems that are too large, and once there’s an interaction of two or more functions, it goes off the rails. But if I define the overall structure and the interfaces, then I have better luck getting it to fill in the functions. Our jobs are safe, for now.
Re:Pairing with GPT-4 · Fly by TheHappyOddish on Friday March 31, 2023 @08:34PM (#35395727)
That's precisely how I frame it to people.

I'm a member of the management team for a company, and everyone was very excited for ChatGPT. As someone with a technical background, the caveats were a lot more obvious to me from the start. Treating it as an incredibly fast, eager junior developer who is desperate to please and submits code without testing it has made it a lot more usable.