Getting the Proper Reply from ChatGPT – O’Reilly

on

|

views

and

comments


A few days in the past, I used to be excited about what you wanted to know to make use of ChatGPT (or Bing/Sydney, or any related service). It’s simple to ask it questions, however everyone knows that these giant language fashions often generate false solutions. Which raises the query: If I ask ChatGPT one thing, how a lot do I must know to find out whether or not the reply is appropriate?

So I did a fast experiment. As a brief programming venture, a lot of years in the past I made an inventory of all of the prime numbers lower than 100 million. I used this listing to create a 16-digit quantity that was the product of two 8-digit primes (99999787 occasions 99999821 is 9999960800038127). I then requested ChatGPT whether or not this quantity was prime, and the way it decided whether or not the quantity was prime.


Study sooner. Dig deeper. See farther.

ChatGPT accurately answered that this quantity was not prime. That is considerably shocking as a result of, in case you’ve learn a lot about ChatGPT, you understand that math isn’t one in all its robust factors. (There’s most likely a giant listing of prime numbers someplace in its coaching set.) Nonetheless, its reasoning was incorrect–and that’s much more fascinating. ChatGPT gave me a bunch of Python code that applied the Miller-Rabin primality check, and mentioned that my quantity was divisible by 29. The code as given had a few fundamental syntactic errors–however that wasn’t the one drawback. First, 9999960800038127 isn’t divisible by 29 (I’ll allow you to show this to your self). After fixing the plain errors, the Python code appeared like an accurate implementation of Miller-Rabin–however the quantity that Miller-Rabin outputs isn’t an element, it’s a “witness” that attests to the actual fact the quantity you’re testing isn’t prime. The quantity it outputs additionally isn’t 29. So ChatGPT didn’t truly run this system; not shocking, many commentators have famous that ChatGPT doesn’t run the code that it writes. It additionally misunderstood what the algorithm does and what its output means, and that’s a extra critical error.

I then requested it to rethink the rationale for its earlier reply, and bought a really well mannered apology for being incorrect, along with a unique Python program. This program was appropriate from the beginning. It was a brute-force primality check that attempted every integer (each odd and even!) smaller than the sq. root of the quantity beneath check. Neither elegant nor performant, however appropriate. However once more, as a result of ChatGPT doesn’t truly run this system, it gave me a brand new listing of “prime elements”–none of which had been appropriate. Curiously, it included its anticipated (and incorrect) output within the code:

      n = 9999960800038127
      elements = factorize(n)
      print(elements) # prints [193, 518401, 3215031751]

I’m not claiming that ChatGPT is ineffective–removed from it. It’s good at suggesting methods to resolve an issue, and might lead you to the fitting resolution, whether or not or not it provides you an accurate reply. Miller-Rabin is fascinating; I knew it existed, however wouldn’t have bothered to look it up if I wasn’t prompted. (That’s a pleasant irony: I used to be successfully prompted by ChatGPT.)

Getting again to the unique query: ChatGPT is nice at offering “solutions” to questions, but when you could know that a solution is appropriate, you could both be able to fixing the issue your self, or doing the analysis you’d want to resolve that drawback. That’s most likely a win, however it’s important to be cautious. Don’t put ChatGPT in conditions the place correctness is a matter except you’re keen and in a position to do the laborious work your self.



Share this
Tags

Must-read

US regulators open inquiry into Waymo self-driving automobile that struck youngster in California | Expertise

The US’s federal transportation regulator stated Thursday it had opened an investigation after a Waymo self-driving car struck a toddler close to an...

US robotaxis bear coaching for London’s quirks earlier than deliberate rollout this yr | London

American robotaxis as a consequence of be unleashed on London’s streets earlier than the tip of the yr have been quietly present process...

Nvidia CEO reveals new ‘reasoning’ AI tech for self-driving vehicles | Nvidia

The billionaire boss of the chipmaker Nvidia, Jensen Huang, has unveiled new AI know-how that he says will assist self-driving vehicles assume like...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here