4 and 4o generate curves
I was playing around with ChatGPT to generate some demand-supply curves, and the results were, well, interesting!
This is only tangentially related to what we are building at Babbage Insight but since it has to do with LLMs and their reasoning capabilities, I’m putting this here.
For another blogpost, on a blog I write about neurodiversity, I wanted to generate an image of some demand and supply curves. Specifically, I wanted to show the impact of a left-shifting supply curve on price and quantity subject to highly inelastic demand curve.
Now, this was something that I had struggled with ChatGPT-4 a couple of months ago, when I wrote an earlier (and more basic) version of the same blogpost.
And I had then made do with a highly elastic demand curve, which then messed up my mental calculations, which means I have had to write an updated post today.
In any case, considering that ChatGPT-4 had struggled back then, I decided to use ChatGPT-4o, the hottest kid in town, to generate the graphs.
I started with the prompt “draw a highly inelastic demand curve, and show the effect on quantity transacted (and clearing price) when supply curve shifts to the left”. This is what 4o produced:
This is rather bizarre. First of all, none of the text makes sense. i’ve asked for curves, and so it’s drawn curves, while in conventional Econ101, you usually represent them by lines. The legends on the graphs make absolutely no sense either. There is absolutely no joy here.
I slightly gave up, and thought I should use good old ChatGPT-4 once again. I gave it the same prompt (“draw a highly inelastic demand curve, and show the effect on quantity transacted (and clearing price) when supply curve shifts to the left”). It quickly started writing Python Matplotlib code to generate the plot.
Presently, it gave me this:
At least it’s got the basic concept right, and there are no medieval decorations on it. That said, this is still a highly ELASTIC demand curve (a small change in price leading to a large change in quantity), and this is NOT what I want. That said, the text around that ChatGPT-4 produced was interesting:
The graph plots the highly inelastic demand curve and two supply curves: one initial and one shifted left. However, it seems there was a snag calculating the intersections for equilibrium points, causing an error.
From the graph, we can qualitatively see that when the supply curve shifts left, the equilibrium price increases significantly while the quantity transacted changes only slightly, typical for inelastic demand. I'll tweak the calculation to ensure we get the precise equilibrium points.
It had the idea right, but messed up in calculating the slope of the demand curve. It basically lost its chain of thought - it possibly had one thing in its mind and ended up doing another!
I continued to give up, and then decided to try ChatGPT-4o once again. I continued where I left off and said a benign “that doesn't look right”. It gave some spiel, and produced this other medieval chart with undecipherable labels (with a “shittted suuply curve”!):
Now it was time to shame the LLM. I just said “this is bonkers. chatgpt4 did it better”. Surprisingly this got 4o to actually do the work. I don’t know if the mention of ChatGPT-4 made it reconsider its approach but it then started generating Matplotlib code (first time I saw ChatGPT-4o doing this) and produced this:
It’s a bit extreme (I didn’t want a perfectly inelastic demand curve, but I’ll take it. I gave it a further prompt to make it slightly less vertical but it’s now got stuck in a loop of “unable to generate plot”, so I’ll spare it of its misery. Check out what I wrote here. I end that post with some tidbits about ChatGPT!
I'm still puzzled where the medieval wordings came from!