Live data from Hacker News

Ask HN: Those with success using GPT-4 for programming – what are you doing?

news.ycombinator.com

61–70 of 109 posts

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#61
Here's roughly how my conversation with GPT4 went

Me: I want to make an svg editor, give me some suggestions. I mainly want something with mobile support.

GPT4: gives me some options

I look over the options and choose fabricjs

Me: Start by loading an svg at a predefined url

GPT4:

Me: Ok now implement a save feature, send the json to this url ...

GPT4:

Me: The text is loaded as an image, I want the text to be editable

GPT4:

Me: I'd like to add some google fonts to the text editor

GPT4:

Me: The fonts aren't loading, I think we need to load the fonts first before initializing the canvas.

GPT4:

Me: Ok add a undo/redo feature

GPT4:

Me: Let's add some clickable buttons instead of hotkeys, here is the html..

GPT4:

I probably could have done this myself, but frankly it would have taken me a long time to figure out the fabricjs api. It probably saved me at least a week making this thing.

here's the live app: https://tinyurl.com/2dhh58cn

and the code: https://tinyurl.com/2tu4xrtn

you can tell the GPT generated sections by the (overly) verbose comments

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#62
I've been using it to refactor Clojure codes and port Scheme examples into Clojure.

Maybe because Lisps have very low syntax, I find I can just copy off function/macro definitions as context and GPT3.5 can rewrite the code into something I can use... And by testing in a REPL (in :dev) I can instantly see which code has hallucinations and which work perfectly.

Tbh I find it hallucinates mainly when dealing with mutable states (e.g. atoms) or with pipelines of complex maps transformed by multimethods -

Just using small data bits and normal pure functions make GPT3.5 work perfectly because it doesn't need to take into account code outside the 2048-4096 tokens it's thinking right now?

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#64
post #31

I did this experiment (a game) to see what's up and what's down around all this: https://github.com/romland/llemmings . While there is some GPT4 in there, it's mostly ChatGPT and a small handful of LLaMA solutions. That project is a contrived scenario and not realistic, but I wanted to experiment with _exactly_ what you are talking about. Very often I could have done things a lot faster myself, but there is one aspec…

Agreed. So far I've derived most benefit from ChatGPT by unblocking me when starting tasks and also giving overviews about things (much like an improved search engine).

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#65
I let it write the boring stuff. Needed a python class to take an example dict, and generate a class that creates all the properties that map to the keys in said dict (I have a constraint preventing me from using something like json_dataclass or similar). While it's churning that out, I can focus on other things.

Also found its great for regex, I'm pretty good with writing these, but recently came across a pretty complex one in our codebase that wasnt commented. Pasted into GPT4 and asked it to explain it, it broke down each bit in detail, and in the end even generated an example string that would match it.

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#66
post #60
post #6

1. It can do some reformatting tasks faster than I can do them by hand. Example: Inline FuncA into FuncB . 2. For more complicated tasks it requires good prompting. Example: Tell me three ways to fix this error, then pick the best way and implement it. . Without the "step-by-step" approach it almost never works. 3. It's pretty good at writing microbenchmarks for C++. They always compile, but require some editing. I u…

But 3000003 is exact in fp32, as well as it is 3000002.5, 3000002.75 before it or 3000003.25, 3000003.5, 3000003.75 after it? https://www.h-schmidt.net/FloatConverter/IEEE754.html And AFAIK the LLMs, lacking the ability to actually calculate, can't check which numbers are such?

Ha, you're right. I should've used 30,000,000. The answer it gave regarding how to do "ties to even" was still correct though: "Evenness" is decided by the least significant bit of the mantissa, not be the "evenness" of the decimal representation.

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#67

I had to optimize some Python code to reduce its memory usage. After trying all ideas I could think of, I thought about rewriting it in a different language. Copied and pasted the code into ChatGPT 4. Tried Rust at first, but there were too many compilation errors. Then I tried Go and it worked perfectly. For the next couple of weeks, I used it to improve the Go code, as I've never used Go. It gave me great answers,…

What kind of memory efficiency gains did you see as a result of the effort?

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#68
Coding with LLMs was easier after understanding their limitations.

1. They don't know what they are saying until they have said it.

2. Your inputs and its outputs help make the next message.

3. LLMs are not suited for information retrieval like databases and search engines.

LLMs excel at reasoning and predicting subsequent text based on given context. Their strength lies in their ability to generate relevant and cohesive responses.

To optimize results, outline clear rules, strategies, or ideas for the LLM to follow. This helps the model craft, revise, or build upon the established context.

Starting with a precise query and introducing rules or constraints incrementally can help steer the model's output in the desired direction.

Avoid zero-shot queries as these can lead to the model generating unexpected or unrelated responses.

Be cautious while seeking pre-calculated or non-derived answers. Some instruction-tuned models might output incorrect solutions, as they are trained to respond to certain queries without proper context or information.

also, this is my biggest gripe no fault of ours of course: don't seek pre-calculated or non-derived answers. I've seen some of the demonstration data that people are using to train instruction-tuned models and are being taught to respond by making up answers to solutions it shouldn't try to compute. Btw, the output is wrong.

{ "instruction": "What would be the output of the following JavaScript snippet?", "input": "let area = 6 * 5;\nlet radius = area / 3.14;", "output": "The output of the JavaScript snippet is the radius, which is 1.91." },

https://github.com/sahil280114/codealpaca/commit/0d265112c70...

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#69
I know how to program. I understand lisp. What I have problems with are all the built in functions and variables in emacs-lisp. It has dramatically improved the readability of my emacs configuration and also taught me about some new ways to do stuff in emacs (and when to stop because I can’t do something).

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#70
Also had it hallucinate absolute garbage from time to time. The worst offender, that consistently shows up: Claiming there are certain library features, when there are not.

Easily the best rubber ducky though. Copy pasting big blocks of my own code and asking about it gives new perspectives to problems I am stuck on. Huge time saver in that regard.

Post reply on HN