What is Nostr?
Accepted opions nostrich / Econ guy Konrad
npub1zss…vrwk
2025-01-04 19:55:07

Accepted opions nostrich on Nostr: Random Sunday lesson: using GPT for code as someone who is not a software engineer. ...

Random Sunday lesson: using GPT for code as someone who is not a software engineer.

My coding experience so far has been; a couple of beginner Python courses, R to query and process microdata and build several forecasting/econometric models, and Python to model a VPP optimisation problem. This has been a journey of self-directed learning, and much kludging™.

But in the last year, the release of GPT-O1 preview (and now GPT-O1) allowed me to stretch my basic understanding to build more complex models as part of my work at Blockspace Energy. I was able to parlay what I knew about coding in R and Python to work with GPT to build a model in C++ (the first version in Python ran way too slowly - GPT suggested C++ would be faster, which it was)

What I learned from that is worth sharing; it was a "prompt engineering" methodology (specific words chosen for engagement algorithm 🤣)

Anyway, through trial and error, I found the best process for me was:

In a .txt file (which I usually save as "GPT_context.txt")

1) write out the overall intention of the model as detailed as you can, including suggested methodology

2) ask GPT to come up with a plan

3) copy the plan as plaintext into your .txt file

4) prompt GPT with the intention + the plan and request to start with the first item on the plan

5) paste in the code into your .txt file

6) prompt GPT with "here's the context we are working on, our plan, and the code we have so far. And here's the next change I want to make" and describe your required change (bug fixes or upgrades)

7) continue that with each step of the plan until your programme works as intended

I usually include a request that GPT outputs the full code and context it suggests to change, otherwise it can skip over details and comment "\\...insert code here..." which is frustrating if you don't catch it and can confuse both yourself and GPT.

Basically I think the main lesson is to manage GPT's context window manually. It does seem like a toddler at this point - incredibly intelligent but loses context and hallucinates easily.

I don't expect GPT-O3 or above to require this level of context window management.

What are some good "AI" query tips or techniques you've discovered?
Author Public Key
npub1zssx5e5cne75w4hxenry8x9qqmn9ql3ty4umlmewu7dqv6yhyh8survrwk