Live data from Hacker News

Testing GPT 4's code-writing capabilities with some real world problems

tylerglaiel.substack.com

141–150 of 677 posts

Re: Testing GPT 4's code-writing capabilities with some real world problems

#142

One thought that came to mind when the author mentioned that GPT-4 seemed to want to use A* was that maybe the problem statement was not formed in a way that would get the best response. I'm not entirely sure if this type of back and forth would be useful, but just struck me as interesting to try. I put the following prompt into ChatGPT (no GPT-4 access for me yet): *A problem statement is given as follows: An agent…

I've found similar success in using this approach rather than going direct to "write me some code AI-code-monkey". You can also take the following (which are the same sorts of things you'd want to do as a programmer writing this code yourself:

- Rewrite the problem as a list of constraints

- Point out any ambiguous or missing constraints

- Write an example that demonstrates each constraint

etc.

Effectively this article is really asking the question when posing a novel problem to the LLM, how deep does the internal state go in producing the completions. When it doesn't go deep enough, the trick is to make it do the things that deepen the internal state.

I'd guess that supplying a good system message to GPT-4 (waiting for my access) would help. Something like:

You're an engineer responsible for writing correct code from a specification. Break down the specification into small chunks that can be explained simply. If there are ambiguities, seek clarification. Only write code once all ambiguities are resolved and each part of the problem is described simply.

Re: Testing GPT 4's code-writing capabilities with some real world problems

#143
Yes. I only need it to write 50-100 lines at a time to be incredibly effective.

My productivity this month has been insane. I'm still writing most of the code the old fashioned way, but the confidence of having this kind of tool makes it a lot easier to push through boring/tricky items.

Re: Testing GPT 4's code-writing capabilities with some real world problems

#144

What's most astounding is that it was expected to work when so much of the prompt just doesn't make sense: > Objects should only move if they will end up on an empty tile after their move > "An object is free to move onto a tile that another object moves onto if that other object is moving off of its tile"

Repeat the experiment in a better way and blog about it then rather than negging in the comments. I'm not the author, but I'll await your peer review.

In the post, author says that the GPT-3 version it apparently worked well. Which is really is amazing to me.

The prompts really read in a way where I wouldn't have expected the "correct" output.

Re: Testing GPT 4's code-writing capabilities with some real world problems

#145

What's most astounding is that it was expected to work when so much of the prompt just doesn't make sense: > Objects should only move if they will end up on an empty tile after their move > "An object is free to move onto a tile that another object moves onto if that other object is moving off of its tile"

Repeat the experiment in a better way and blog about it then rather than negging in the comments. I'm not the author, but I'll await your peer review.

I'm not sure that the commenter was negging here but instead showing that the language used in the prompt was imprecise (in a similar way that we might get system requirements in reality). The takeaway I got was more that the commenter was showing surprise at how well that ambiguity was resolved regardless. A more interesting experiment to run might be to intentionally reduce the precision of the task e.g. something

    In a 10x10 arena, work out if there is a path shorter than 5 steps from one start to finish with water tiles taking two steps and avoiding as many fire tiles as possible.

But you can go even better than that really. The author jumps down to a more code oriented description too soon (10x10, etc.) but ChatGPT (3.5) does ok with just the original problem (I removed the text about A* and Djikstra's from the english version of the problem statement:

PROMPT:

In Mewgenics, movement abilities use pathfinding to get the cat from his origin to his destination.

Cats have a maximum movement range stat and tiles have a cost (in this case its 1 for basic tiles and 9999 for blocking obstacles). We also have water tiles that cost 2 to path through.

The complication comes in when we add Fire (and other hazard type tiles) into the mix. Fire tiles don’t cost extra to pathfind through like water tiles do, however a cat really wants to avoid pathing through the fire tile if it can. If there’s a lot of fire tiles it should go through the least number of them it can.

ANSWER:

To solve this problem, you can modify the pathfinding algorithm to take into account the hazard tiles, such as fire. One way to achieve this is by using a modified A* algorithm.

First, assign a high cost to hazard tiles such as fire. This cost should be higher than the cost of regular tiles, but lower than the cost of blocking obstacles. For example, you can assign a cost of 5 to fire tiles.

Next, modify the heuristic function used in the A* algorithm to take into account the distance from the hazard tiles. For example, you can modify the Euclidean distance heuristic to add an extra term that takes into account the distance from the closest hazard tile. The closer the cat is to a hazard tile, the higher the heuristic value should be.

Finally, when selecting the next tile to visit, prioritize tiles with the lowest total cost (including both the movement cost and the heuristic cost), but also consider the number of hazard tiles that the cat would need to pass through to reach that tile. You can add an extra penalty term to the total cost that increases based on the number of hazard tiles the cat would need to pass through to reach the tile. This penalty term should be high enough to discourage the cat from pathing through too many hazard tiles.

With these modifications, the cat should be able to find the shortest path to its destination while avoiding hazard tiles as much as possible.

Re: Testing GPT 4's code-writing capabilities with some real world problems

#146
post #8

In before all the comments about how “most code is trivial” or “most programming is stuff that already exists” or “you’re missing the point look how it’s getting better”. I really am in awe of how much work people seem willing to do to justify this as revolutionary and programmers as infantile, and also why they do that. It’s fascinating. Thinking back to my first job out of college as a solid entry level programmer.…

I feel it's the average programmer who is enamoured with GPT. The programmers working on hard stuff know that AI writing programs is still far away.

Very far imo.. I mean it delivers what it is, an average of much content out there.. and it is good at it, yes. So in a way, maybe the better future stack overflow with a nicer interface (however what could it do if there weren't stackoverflow to start with?)

But on the other hand in new uncharted territory, it sometimes fails on the simplest shit: Asked it recently how to do one thing with enlighten (that I knew was possible with tqdm, but was almost sure not possible with enlighten). It just hallucinated up parameters to functions that didn't exist. Several rounds continued where it had that from, if different version. I asked it even for the reference where it meant it had that from.. and it referenced me fully confident a readthedocs url with tqdm and enlighten mixed, that didn't exist.. it is hilarious how it confidenlty can tell you one bullshit answer after the next.. dialogues always "hey are you really sure about xxx, did you look it up" "yeees, very certain, I did!" "But this doesn't exist" "Oooh, Im very sorry, you are correct and I am wrong, the next bullshit answer is: ..."

The history disappeared I hope I get it back once, but the dialogue til getting to "No, it may be not possible with this library" was amazing, I'm really scared for our futures building up on that and what will happen if everything from business presentations to lawyer letter exchanges will build up on that..(:

Re: Testing GPT 4's code-writing capabilities with some real world problems

#147
post #94

Earlier quoted context omitted.

You can’t say “singularity” on HN without a ton of downvotes. It’s not because people disagree (or they’d say so), but because they literally shit their pants when they think about it. Hard to blame them.

Who's not disagreeing? Singularity feels like "man facing existential dread confuses saturation curve for exponential".

When I say singularity, I mean “changes the nature of human life irreversibly and to a greater degree than any prior technology through a rapid progression of self-reinforcing growth.”

That rapid progression can be modeled with an exponential growth curve, like Moore’s law, even though nothing material can have a sustained exponential growth. Regardless of how the curve is modeled, the steepness is such that it serves as a step function in evolution.

With that clarified, there is first the question of “is the technological progression going to level off soon?” And I think the answer is no. The second question is, “how are we going to deal?” And the answer to that question can only be addressed once we answer the question: “what kind of world do we want to live in?”

Re: Testing GPT 4's code-writing capabilities with some real world problems

#148
there's a bit of confusion when people say it's not going replace programmers because they all have tricky things to do in their work week.

This is not how it's going to happen : if your boring time-consuming tasks take virtually 0 time thanks to gpt, and let you focus on the 1% that's hard, you've suddenly become 100x more efficient, and can thus accomplish the same job as 100 you. That means the company can now fire 99 coworkers, keeping only you, and end up with the same result.

Re: Testing GPT 4's code-writing capabilities with some real world problems

#149
post #8

In before all the comments about how “most code is trivial” or “most programming is stuff that already exists” or “you’re missing the point look how it’s getting better”. I really am in awe of how much work people seem willing to do to justify this as revolutionary and programmers as infantile, and also why they do that. It’s fascinating. Thinking back to my first job out of college as a solid entry level programmer.…

> I really am in awe of how much work people seem willing to do to justify this as revolutionary and programmers as infantile [...]

Well it is revolutionary. And it isn't just where it is today, but how fast these models are improving - with no saturation in ability evident at this time.

On the other hand, I am not sure anyone is saying programmers are infantile - although poorly written software is as at least as prevalent as poorly compensated or managed software development positions.

Re: Testing GPT 4's code-writing capabilities with some real world problems

#150
post #148

there's a bit of confusion when people say it's not going replace programmers because they all have tricky things to do in their work week. This is not how it's going to happen : if your boring time-consuming tasks take virtually 0 time thanks to gpt, and let you focus on the 1% that's hard, you've suddenly become 100x more efficient, and can thus accomplish the same job as 100 you. That means the company can now fir…

But then competitor company B will keep its 100 devs and be that much more productive than your company, running you into the ground.
Post reply on HN