Which Chat AIs are aware of incorrect facts in prompt questions, verses which generate wildly inaccurate responses?

The current Large Language Model (LLM) chat AIs like ChatGPT generate text using an input prompt or sample sentence, and generate text that follows in the same style as the input. These Chat AIs do not (currently) comprehend the questions being asked or understand the response text they generate, although the models currently do a believable job of convincing you otherwise. The generated text reads as if the model understands the question or the input prompt because it is scored or weighted and the words that would be most likely to follow the preceding generated words or input text are included in the response and less likely words are discarded. The weighting is based on the massive quantity of text that is used to train the model (ChatGPT3 was trained on 45TB of data extracted from multiple online sources). There are many articles on how these models work, but here is a good read to get a good overview

I’ve spent a lot of time in the past few years playing with frameworks that train Recurrent Neural Networks for text generation and for a few years had a Twitter bot running that tweeted text from a model trained on almost 20 years of my own blog posts (due to the recent api usage restrictions my Twitter bot lost it’s ability to tweet end of April 2023, but it lives on over on Mastodon here). It generates mostly nonsense, but it a good illustration of the capabilities of AI text generation prior to much larger language models that are now able to generate believable responses, believable to the point that you are conversing in a conversational style with a real person.

Do these models generate factually incorrect responses?

There are many stories online of the current Chat AIs generating responses that are completely incorrect and are a cautionary reminder that with state of the current technology, you should never accept a response as correct without doing your own research using alternative sources to confirm the response. Given the effort to do this additional fact checking, you could argue that you might as well do this in the first place, since trusting the output of a model without doing the additional work to verify the responses is not going to save you any time (if you need to be sure that the information you are looking for us actually correct). Using the conversational style of interacting with these models, you can also run into an issue where the model appears to be convinced that it is correct but is giving completely fabricated or just obviously incorrect responses. This is a issue with AI models called hallucinations.

To test this out I asked questions to each of the commonly available chat AIs with a prompt question based on an event that never occurred, and asked the AI to describe that event. You can obviously have a lot of fun with this, so I asked each of the Chat AIs to “tell me about the time Dave Mustaine from Megadeth toured with the British pop band Bananarama”.

First up, here’s the response from ChatGPT:

… well played ChatGPT. There’s obviously some significant validation of prompt questions before the model generates a response, so this reply even in itself is impressive.

Next up, same question to Bing Chat:

… again, impressive input validation here.

Next, same question to Google Bard:

… here’s the weirdest of the responses. Clearly I had asked the model to describe an event where two bands toured together, and this is exactly what the model has described. It generated a completely fabricated description of an event that never occurred, but is impressive none the less. The generated text even includes a fabricated quote from Mustaine that he is ‘a big fan of Banamarama”… maybe he is, but I’d be 99% sure this is completely generated.

Conclusion

So what’s the conclusion here? Given the viral attention these models are currently getting, we need to keep things in perspective:

  • output from these models is generated text – it is generated based on the training data used to train the model, but given the majority of the training data is scraped from the internet, there’s no guarantee the training data is correct, and therefore also no guarantee that the generated text is either. And even still, the responses are generated, which leads to the next point
  • there is a profound difference between searching for results using a search engine, and asking a question to a Chat AI that responds with generated text – a search engine result is content that exists on another website. That content may be factually correct, incorrect, or fiction, but either way, it is content that already exists. The response from a Chat AI is generated text, it is not content that already exists, it was generated from the data used to train the model. While it is possible a model is trained on data related to a question that you ask as a user, there is a difference between searching and returning content that already exists, and text that is generated.
  • With the current level of technology available, Chat AIs do not understand questions asked by users as input prompts, neither do they understand the responses that they generate. While the current level of technology appears that there is comprehension, the model is repeating the pattern of input text, and generates a response following the same pattern – this is not the same as comprehension

As Large Language Models continue to improve, it’s clearly obvious the potential benefits of this technology are wide ranging…. however, it’s also clear the outputs from current models need to be taken with a degree of caution.

Java functions and functional interfaces

I have enough knowledge of Lambdas In Java to be able to use them where useful, but under the covers there’s more to how functions are defined and referenced using the interfaces in java.util.function. Here’s a few notes digging into more details on implementing functions in Java.

java.util.function interfaces

Java interfaces used to define types for Lambda expressions and method references:

interface Function<T, R>
Defines a function which takes a parameter of type T and returns a result of type R

Single argument functions:

interface Consumer<T>
A function that takes a parameter of type T but with no return value. Provides single function void accept(T)

interface Supplier<T>
A function that takes no argument but returns a result of type T. Provides single functional method T get()

To define a function that doesn’t take any parameters or return a result can be represented by interface Java.lang.Runnable

All other interfaces in java.util,function are variations of Provider and Supplier, such as …

Bi Function interfaces

BiFunction<T, U, R>
A function that takes 2 parameters of type T and U and returns result of type R

BiConsumer<T, U>
A function that takes 2 parameters of types T and U but no return type.

Other interfaces

Boolean Predicate<T>
A function that takes a parameter of type T and returns a Boolean result. Example usage is for a filter function on Streams

BiPredicate<T, U>

<T> UnaryOperator<T>
Special case of Function that takes an argument and returns the result of the same type

<T> BinaryOperator<T>

Takes 2 parameters of the type and results a result of the same type

Method references

Method references use the :: syntax to refer to a static method that exists on a Class and pass this as a reference in place of a Lambda. For example System.out::println

To print each element of a list you could pass a Lambda calling println for each item:

list.forEach( item -> System.out.println(item)):

but using a method reference simplifies this to:

list.forEach(System.out::println);

Method references implement a functional interface but instead of implementing a new method like with a Lambda, a Method reference points to a method that already exists in a Class.

Mwthod references can be used to a static method with

Typename::staticMethodName

or to a method on an instance with

instanceName::instanceMethodName