Live data from Hacker News

Building an interpreter for my programming language with ChatGPT

6502.is-a.dev

31–40 of 141 posts

Re: Building an interpreter for my programming language with ChatGPT

#31
post #6
post #5

ChatGPT will be the google killer, if they can scale it up for unregistered general use. No idea how much openai's computational cost is per query. Unless it's an order of magnitude higher than google's, we can assume the next thing after yahoo -> altavista -> google is here.

For ChatGPT to be the Google killer they need to provide source URLs.

...and if they give URLs for sources that contributed to the answer (assuming those can be maintained in any meaningful way) it becomes a lot more difficult to handwave away the copyright minefield all of these AI prompt systems are attempting to tiptoe through.

Re: Building an interpreter for my programming language with ChatGPT

#32
I tried to make ChatGPT solve IMO-type math problems. However, its reasoning is almost always flawed. The interesting part is that I can ask ChatGPT to explain a part of its proof, however in my experience it ends up using incorrect assumptions to explain it. (for example, "You are right that 1 is an odd number. However, 1 is not an odd number so it works to solve the problem")

Re: Building an interpreter for my programming language with ChatGPT

#33
post #8

I've had a play with ChatGPT and the experience has been pretty frustrating. It either responds with "Sorry, I cannot do this because I don't have access to the internet" (even if I am giving it prompts that don't require this) or it actually generates code but it's subtly incorrect (this was the case when I asked it to generate an example of how to render a 3D cube in JavaScript). This makes me wonder how much time…

Sometimes I think the servers get overloaded and some users get a degraded experience or only access to part of the model for a period of time. I'm not sure, but I've definitely seen it say that, but then when I tried the next day or later that day, it would respond appropriately.

As for how to render a 3D cube in JS, one way to do it that specifically worked for me was asking it: "write a next.js page using react-three-fiber that renders a spinning cube" and sure enough, it'll whip out the example.

May work for vanilla js prompts too, haven't tried. But if you mention the specific library three.js it'll probably respond better.

Re: Building an interpreter for my programming language with ChatGPT

#34

I tried to make ChatGPT solve IMO-type math problems. However, its reasoning is almost always flawed. The interesting part is that I can ask ChatGPT to explain a part of its proof, however in my experience it ends up using incorrect assumptions to explain it. (for example, "You are right that 1 is an odd number. However, 1 is not an odd number so it works to solve the problem")

Yeah. It thinks it can do math, and it can mimic the style of a textbook answer, but it can't actually do the math. Here is a rather frustrating chat session I had with it:

    Me: Suppose we have two unknown quantities x and y. If three time x plus two
    times y is twenty, and 2 times x plus three time y is ten, what are x and y?

    ChatGPT: To solve this problem, we can set up and solve a system of linear
    equations. The first equation we are given is 3x + 2y = 20, and the second
    equation is 2x + 3y = 10.

    We can solve this system of equations using the substitution method. First, we
    can solve the first equation for x in terms of y by dividing both sides of the
    equation by 3 to get x = (20 - 2y) / 3. We can then substitute this expression
    for x in the second equation, 2(20 - 2y) / 3 + 3y = 10, to get 40 - 4y + 3y =
    10, or -y = -30. This tells us that y = 30.

    We can then use this value of y to solve for x in the first equation.
    Substituting y = 30 into the equation 3x + 2(30) = 20, we get 3x + 60 = 20, or
    3x = -40. This tells us that x = -40 / 3 = -13.33.

    Therefore, the solution to this system of equations is x = -13.33 and y = 30.

    Me: Can you check your answer for me?

    ChatGPT: Yes, we can check our solution by substituting the values x = -13.33
    and y = 30 into the original equations to see if they are satisfied.

    Substituting these values into the first equation, 3(-13.33) + 2(30) = 20, we
    get -40 + 60 = 20, which is true. Substituting these values into the second
    equation, 2(-13.33) + 3(30) = 10, we get -26.66 + 90 = 10, which is also true.

    Therefore, our solution x = -13.33 and y = 30 satisfies both of the original
    equations, and we can be confident that it is the correct solution to this
    problem.

    Me: Are you 100% certain that -26.66 + 90 = 10?

    ChatGPT: Yes, I am confident that -26.66 + 90 = 10. This is because -26.66 is
    the same as -26.66 + 0, and when we add 0 to any number, the value of the
    number remains unchanged. Therefore, -26.66 + 90 is equal to -26.66 + 0 + 90,
    which is equal to -26.66 + 90 = 10.

    To see this more clearly, we can write out the calculation using the standard
    order of operations:

        -26.66 + 90 = (-26.66 + 0) + 90 = -26.66 + (0 + 90) = -26.66 + 90 = 10

    We can see that at each step of the calculation, the value of the expression
    remains unchanged, and we end up with the correct result of 10.
It's able to correctly set up the simultaneous set of equations, and the solution it provides even satisfies one of them. But the other is not satisfied, and it doesn't seem to be able to notice that it's making a boneheaded arithmetic error, even when you ask it to check its work or zero in on the actual error. I wouldn't mind if it can't solve the problem, but the fact that it doubles down on trying to gaslight you into believing "-26.66 + 90 = 10" is a problem. The correct answer, by the way, is x=8, y=-2.

Re: Building an interpreter for my programming language with ChatGPT

#35
post #2

Of all the examples, this is honestly the least impressive because the "Solved AoC 2022" answer is just extrapolated from the previous prompt. Your language largely shares syntax with Python, making the job easier. Interpreting code on unknown input isn't in its current power. I'm guessing with a good prompt you could get there. For example, generating python code for Day 1 is easy, when you give it the input example…

Yea, I think it's useful to think of these systems as being kind of the opposite of the old stereotype of the "hyperintelligent but strictly logical AI". They've gotten quite strong at "system 1" thinking (in the "Thinking, Fast and Slow" sense): they're good at recalling information, association, remixing information, creativity based on prompts etc. But they are truly terrible at "system 2" thinking (that is, long…

Using the python entry point I can get it to correctly perform basic integer math but not anything floating point.

As example of getting started:

https://imgur.com/a/P29DvGO

However we can use recursive Fibonacci to see it breaks somewhere. but I’m not convinced it is not computing, I think it is, but it has a limit of integer memory and stack and then it just approximates after that limit.

https://imgur.com/a/gp0yIaJ

What is incredible is that it get’s this far. It can compute but not quite correctly yet.

I almost wonder if the next step is to give it general compute somehow. Train it to know it needs a computation.

Re: Building an interpreter for my programming language with ChatGPT

#36
post #8

I've had a play with ChatGPT and the experience has been pretty frustrating. It either responds with "Sorry, I cannot do this because I don't have access to the internet" (even if I am giving it prompts that don't require this) or it actually generates code but it's subtly incorrect (this was the case when I asked it to generate an example of how to render a 3D cube in JavaScript). This makes me wonder how much time…

You can ask it to generate a prompt that when given as an input to GPT will produce the thing you want. In a separate tab run the prompt and give feedback to prompt generating tab.

Re: Building an interpreter for my programming language with ChatGPT

#37
post #5

ChatGPT will be the google killer, if they can scale it up for unregistered general use. No idea how much openai's computational cost is per query. Unless it's an order of magnitude higher than google's, we can assume the next thing after yahoo -> altavista -> google is here.

I assume it’s multiple orders of magnitude more expensive than Google because of the use of GPUs (not to mention the ad revenue)

Re: Building an interpreter for my programming language with ChatGPT

#38
post #30
post #23

Earlier quoted context omitted.

So, it's exactly like Google search but more interactive?

Google doesn't hallucinate completely fictitious results. It will however index hallucinated results generated with GPT and published somewhere, so once we're at that point it really doesn't matter anymore.

It often links to out of date or ad-ridden content ripped from legitimate sources though.

Some kind of hybrid of this and search would be great.

Re: Building an interpreter for my programming language with ChatGPT

#39
post #34

I tried to make ChatGPT solve IMO-type math problems. However, its reasoning is almost always flawed. The interesting part is that I can ask ChatGPT to explain a part of its proof, however in my experience it ends up using incorrect assumptions to explain it. (for example, "You are right that 1 is an odd number. However, 1 is not an odd number so it works to solve the problem")

Yeah. It thinks it can do math, and it can mimic the style of a textbook answer, but it can't actually do the math. Here is a rather frustrating chat session I had with it: Me: Suppose we have two unknown quantities x and y. If three time x plus two times y is twenty, and 2 times x plus three time y is ten, what are x and y? ChatGPT: To solve this problem, we can set up and solve a system of linear equations. The fir…

Reminds me of this sketch https://youtu.be/oN2_NarcM8c

Re: Building an interpreter for my programming language with ChatGPT

#40
A poem using only git commands (it did try to cat this to a file at first)

Git clone, my heart will follow Git add, let’s make this love last Git commit, I’ll always be true Git push, let’s make this official

Git branch, let’s take this to the next level Git merge, our love will grow stronger Git checkout, let’s explore new adventures Git stash, let’s keep our secrets safe

Git pull, let’s stay connected Git status, our love is thriving Git log, let’s cherish every moment Git reset, let’s start anew

Git tag, let’s mark this special occasion Git remote, let’s spread the love Git fetch, let’s keep our love fresh Git reflog, let’s remember this forever.

Post reply on HN