22

The traditional non AI software with if-then-else and loop statements can be fully controlled. In contrast, machine learning software behaviour is unpredictable since the developer cannot control what the software learns from the data. In particular, large language models (LLM), which are a form of neural networks, are black boxes.

How can the AI developers debug misbehaving LLMs when the developers cannot control what the LLM learns or even fully understand how the LLM learns, given that an LLM is like a black box?

4
  • 3
    I think it will be difficult to give a concise answer to this question, much as it is difficult to give a concise answer to a question like "How do doctors cure people when they get sick?" This is the sort of question that people dedicate entire careers to only partially answering. (Although nobody has dedicated an entire career to LLMs yet, since they've only been around since 2019.) Commented Dec 17, 2023 at 1:38
  • 5
    The problem is not unique to LLM's though. All machine learning suffers from this, and all sufficiently useful models are black boxes.
    – MSalters
    Commented Dec 18, 2023 at 9:31
  • 4
    Note, there is a complete SE about "AI" where you can ask about things like this: GenAI
    – Peter M
    Commented Dec 18, 2023 at 14:11
  • The answers so far offer some reasonable approaches one can try to use, but I would also consider that it's definitely not guaranteed for any of them to succeed. If you want to debug a misbehaving LLM reliably, I would say that (with today's tools) you can't. Commented Dec 19, 2023 at 7:15

4 Answers 4

22

machine learning software behaviour is unpredictable since the developer cannot control what the software learns from the data.

If you control the model, the data, the input, and the random, then the output will be the same every time.

What you don’t have are feature flags. If you tell your code monkey “This LLM is racist! Fix it!” they won't find a racist flag to set to false or if racist code to remove.

Training data that reflects racism, or whatever problem you don’t like, will spread to all the nodes in a way that keeps the code monkey from reaching in and tweaking it. That’s because this kind or programming isn’t optimized for manual tweaking. It’s optimized to reflect the training data. You fix it with better data.

If you don’t want your kids to swear, don’t swear in front of your kids.

Or you can teach it what swearing is and when it’s inappropriate. It still won’t show up as a feature flag. It’s just more data.

They can also massage your input and censor the output to attempt to sanitize. But once the problem behavior is learned it’s always there, waiting for a new way to sneak out.

13
  • 23
    They learn so quickly, too! The kids, I mean. The LLMs? Debatable. Commented Dec 16, 2023 at 18:34
  • 7
    This reads like a non answer. You don't say how to control from surprising results that are non-obvious from the input. "Better data" is just "get gud" for AI Commented Dec 17, 2023 at 1:05
  • 4
    @whatsisname it’s called a frame challenge Commented Dec 17, 2023 at 2:09
  • 6
    This is simply wrong. Every LLM that you experiment with has obvious limitations built in that you can circumvent by expressing your prompt in a way the publishers didn't think of. It is quite obvious that they can manipulate the permissible output rather than the input in a targeted way - just not perfectly. Commented Dec 17, 2023 at 9:08
  • 4
    @JenserCube That answer says to tune the model. Tuning is just more training the model a bit more on specialized data, using a base model as a nice set of starting weights. If you don't like how the model works, then candied_orange's answer is the only correct one, because the model isn't actually buggy. A language model learns the distribution over text streams that is most likely to generate the corpus it was trained on. You don't want it to be stupid and racist? Don't train it on twitter. Anything you do after the fact is just a kludge that won't hold up to determined stress-testing.
    – Ray
    Commented Dec 19, 2023 at 2:18
17

The answers so far have not mentioned reinforcement learning from human feedback (RLHF). I'm not an expert, but my understanding is that at least in the case of ChatGPT, this is the main way in which the model's behaviour is controlled.

Basically, as I understand it, this consists of a large number of low-paid humans testing the model and ranking its responses according to various criteria. These rankings are then used to adjust its behaviour using reinforcement learning. This is still a black-box type of algorithm, but it allows the behaviour to be fine tuned in a specific way. This is why ChatGPT behaves like a "helpful assistant", for example, even though most of the data it's trained on doesn't consist of people interacting with helpful assistants.

If the model is found to misbehave in a particular way then, I imagine, these human testers will be asked to try to trigger the undesirable behaviour, in order to train it not to do it.

This is probably only one of many techniques that are used to fine tune and control the behaviour of language models. But I would imagine most of the techniques available are of this general nature - they aim to try and nudge the model in the right direction through training or bias the selection of possible responses, rather than 'debugging' in any traditional sense.

1
  • 1
    "this consists of a large number of low-paid humans testing the model and ranking its responses according to various criteria". Exactly: time.com/6247678/openai-chatgpt-kenya-workers , and they had to watch the worst content of the Internet just to make sure ChatGPT wouldn't include it in the training set. Commented Dec 18, 2023 at 16:54
5

The natural way would be tuning the model, which is likely a long-term solution as it can take quite a bit to reparse input data (this time cleaned from a few unwanted sources). This is what candied_orange describes.

However, I would assume the major language models you can use over the web or in apps have a layer of software around them that employ heuristics to find "bad searches" (queries that will normally lead to undesirable results). They then can either tweak the query, deny the query, modify the answer, or do a combination thereof. The same can be applied to answers that look undesirable.

I'm only speculating here - someone working on either of those projects might confirm or deny this approach, but just for legal reasons I would consider it very likely.

3
  • The general mood of words is probably included in the training data. Attributes like racist, swear words, insults, compliments are probably all included so the model knows about all these words and can tune its response accordingly. The model could be configured to exclude words with a certain mood, for example. Commented Dec 17, 2023 at 0:42
  • 5
    @GregBurghardt the repeated appearance of "hacks" where you add the right kind of words to a query or prepare a certain context seems to imply it's not (just) that a general guideline puts pressure on the model not to pick words from a certain "mood" group, but that there are certain types of content (like serial numbers, bomb plans, hacking guides etc) it is not supposed to print out, but it can be tricked. That implies at least to some degree a heuristic approach... maybe a mix of both, model adjustment and on top "filter". From the outside it is guess work, just adding one "easy" approach. Commented Dec 17, 2023 at 1:53
  • But this describes application debugging, not the model debugging.
    – Basilevs
    Commented Dec 18, 2023 at 21:08
1

In addition to choosing the input of the LLM, as other answers have said, it's also possible to add instructions on how to behave when queried. These instructions, formulated in natural language, can include prohibitions on the form or content of answers, and the bot will then try to follow them when answering queries. Examples of such instructions:

So the chatbot can start a session by silently processing this predefined ("preprogrammed"?) baggage of instructions before giving the user a chance to ask their first question. This will influence the content and the form of the responses given by the chatbot.

1
  • 1
    Influence, but not control. Every LLM we've seen so far can be jailbroken to ignore the instructions.
    – Mark
    Commented Dec 19, 2023 at 2:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.