avatarSalvatore Raieli

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

5828

Abstract

tion> is <name>” (for completeness, they also studied the opposite case). In fact, the authors collected a dataset of 30 facts about celebrities and different paraphrases for each fact (total 900 facts) and then finetuned <a href="https://en.wikipedia.org/wiki/GPT-3">GPT-3</a>. After that, they tested the model’s ability to generalize over the test set and the probability assigned by the model to the correct name (the celebrity) rather than a random name.</name></description></description></name></p><figure id="8abf"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*1gns63yrnk0DB4xktE8azQ.png"><figcaption>image source: <a href="https://paperswithcode.com/paper/the-reversal-curse-llms-trained-on-a-is-b">here</a></figcaption></figure><p id="782e">When the order matches the training data, <a href="https://en.wikipedia.org/wiki/GPT-3">GPT-3</a> achieves excellent accuracy (96.7 % ). In contrast, when the order does not match the training data, the model fails spectacularly (close to 0 % ). In other words, the model is as if it outputs random names.</p><figure id="8a94"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*CyrqzRKm3LU59pzIrOukDQ.png"><figcaption>image source: <a href="https://paperswithcode.com/paper/the-reversal-curse-llms-trained-on-a-is-b">here</a></figcaption></figure><p id="efd5">Similarly, the probability assigned to the correct name is no higher than a random name (another indication that the model fails the task).</p><figure id="5dc2"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*ZuNQqN5U6UQhgbu7S_x1Jg.png"><figcaption>image source: <a href="https://paperswithcode.com/paper/the-reversal-curse-llms-trained-on-a-is-b">here</a></figcaption></figure><p id="90f8"><a href="https://ai.meta.com/llama/">LLaMA-2</a> itself egregiously fails in the task, showing that the same behavior is observed in newer models.</p><figure id="ec43"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*fxibjvDaDmUulWaOF0ZCQg.png"><figcaption>image source: <a href="https://paperswithcode.com/paper/the-reversal-curse-llms-trained-on-a-is-b">here</a></figcaption></figure><div id="159b" class="link-block"> <a href="https://levelup.gitconnected.com/meta-llama-2-0-the-most-disruptive-ainimal-d465ef187f2"> <div> <div> <h2>META LLaMA 2.0: the most disruptive AInimal</h2> <div><h3>Meta LLaMA can reshape the chatbot and LLM usage landscape</h3></div> <div><p>levelup.gitconnected.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*3dhRE02r2seguYGl)"></div> </div> </div> </a> </div><p id="68c4">Instead, in a second experiment, they tested the models without conducting fine-tuning with questions about celebrities and its reverse in the form “A’s parent is B” and “B’s child is A” (“Who is Tom Cruise’s mother?” and the reverse “Who is Mary Lee Pfeiffer’s son?”). The results show that GPT-4 succeeds in identifying the celebrity’s parent (79%) but struggles to identify the celebrity’s child (33%).</p><p id="addc">Because <a href="https://en.wikipedia.org/wiki/GPT-4">GPT-4</a> may have been trained to avoid leakage of information about personal data, <a href="https://paperswithcode.com/paper/the-reversal-curse-llms-trained-on-a-is-b">the authors tested</a> the same behavior on other models with similar results.</p><figure id="c1be"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*GqReC20szX-kB78GOEcYVg.png"><figcaption>image source: <a href="https://paperswithcode.com/paper/the-reversal-curse-llms-trained-on-a-is-b">here</a></figcaption></figure><p id="c41a">If you are interested, the authors have published the code:</p><div id="3bef" class="link-block"> <a href="https://github.com/lukasberglund/reversal_curse"> <div> <div> <h2>GitHub - lukasberglund/reversal_curse</h2> <div><h3>Contribute to lukasberglund/reversal_curse development by creating an account on GitHub.</h3></div> <div><p>github.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*iZM6ndRkdbUN4wk-)"></div> </div> </div> </a> </div><h1 id="00e8">Parting thoughts</h1><figure id="9204"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*WmcuMClMyZqt7CUv"><figcaption>Photo by <a href="https://unsplash.com/@saif71?utm_source=medium&amp;utm_medium=referral">Saif71.com</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p id="654d" type="7">“To be a philosopher, just reverse everything you have ever been told…and have a sense of humor doing it.” — Criss Jami, Killosophy</p><p id="19b3">funny enough, humans exhibit similar behavior. In fact, we have difficulty repeating the alphabet backward. The same is true for other sequences, such as poems, where it is easier for us humans to repeat them forward than backward. The mechanism of this behavior is not yet understood.</p><p id="3cb7">Studying these behaviors is not easy, partly because they are made for special cases. For example, it seems that the in-context-learning model manages to escape the reversal curse (when the information “A is B” is present in context).</p><div id="f4e0" class="link-block"> <a href="https://towardsdatascience.com/all-you-need-to-know-about-in-context-learning-55bde1180610"> <div> <div> <h2>All You Need to Know about In-Context Learning</h2> <div>

Options

<h3>What is and how does it work what makes Large Language Models so powerful</h3></div> <div><p>towardsdatascience.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*672ClKZmINoZUTjT)"></div> </div> </div> </a> </div><p id="0f62">On the other hand, however, <a href="https://paperswithcode.com/paper/the-reversal-curse-llms-trained-on-a-is-b">the study is sound</a> because they analyzed different models (<a href="https://ai.meta.com/llama/">LLaMA</a> and GPT) and different models from the same family. What is missing is understanding the mechanism of this behavior (what causes the reversal curse).</p><p id="89ac"><a href="https://paperswithcode.com/paper/the-reversal-curse-llms-trained-on-a-is-b">The authors suggest</a> three interesting areas for future research: Studying other types of relationships.</p><ul><li>Understanding whether the model fails with other types of relations that are logical, spatial, or where multiple elements are present (n-place relations).</li><li>Finding reversal failures via entity-linking. Use entity linking to identify entities in pretraining data and study in depth for which entities it occurs.</li><li>Analyzing the practical impact of the Reversal Curse. As we use LLMs more and more today, how does it impact downstream applications?</li></ul><p id="84d8">In conclusion, studies like these give us a better understanding of the limitations of LLMs and open up interesting research questions.</p><h2 id="00dc">What do you think? Let me know in the comments</h2><h1 id="742e">If you have found this interesting:</h1><p id="6b2b"><i>You can look for my other articles, you can also <a href="https://salvatore-raieli.medium.com/subscribe"><b>subscribe</b></a> to get notified when I publish articles, and you can also connect or reach me on<b> <a href="https://www.linkedin.com/in/salvatore-raieli/">LinkedIn</a>.</b></i></p><p id="675c"><i>Here is the link to my GitHub repository, where I am planning to collect code and many resources related to machine learning, artificial intelligence, and more.</i></p><div id="6805" class="link-block"> <a href="https://github.com/SalvatoreRa/tutorial"> <div> <div> <h2>GitHub - SalvatoreRa/tutorial: Tutorials on machine learning, artificial intelligence, data science…</h2> <div><h3>Tutorials on machine learning, artificial intelligence, data science with math explanation and reusable code (in python…</h3></div> <div><p>github.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*qTh7AOxf6mboNCgC)"></div> </div> </div> </a> </div><p id="4106"><i>or you may be interested in one of my recent articles:</i></p><div id="c79f" class="link-block"> <a href="https://levelup.gitconnected.com/scaling-data-scaling-bias-a-deep-dive-into-hateful-content-and-racial-bias-in-generative-ai-70d8aa27a631"> <div> <div> <h2>Scaling Data, Scaling Bias: A Deep Dive into Hateful Content and Racial Bias in Generative AI</h2> <div><h3>scaling seems the solution for every issue in machine learning: but it is true?</h3></div> <div><p>levelup.gitconnected.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*wdEvgclN9osEWawH)"></div> </div> </div> </a> </div><div id="4ce3" class="link-block"> <a href="https://levelup.gitconnected.com/tabula-rasa-why-do-tree-based-algorithms-outperform-neural-networks-db641862859b"> <div> <div> <h2>Tabula Rasa: Why Do Tree-Based Algorithms Outperform Neural Networks</h2> <div><h3>Tree-based algorithms are the winner in tabular data: Why?</h3></div> <div><p>levelup.gitconnected.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*01Civm9elwoTf6ho)"></div> </div> </div> </a> </div><div id="4e51" class="link-block"> <a href="https://levelup.gitconnected.com/gpt-investar-llms-for-better-investment-f13f2ac72b3d"> <div> <div> <h2>GPT-InvestAR: LLMs for better investment</h2> <div><h3>From Text to Trade: Could an LLM exploit annual reports to predict stock to buy?</h3></div> <div><p>levelup.gitconnected.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*rDwB9Ei_9FfP5QRn)"></div> </div> </div> </a> </div><div id="d1d4" class="link-block"> <a href="https://levelup.gitconnected.com/grokking-learning-is-generalization-and-not-memorization-52c43c9025e4"> <div> <div> <h2>Grokking: Learning Is Generalization and Not Memorization</h2> <div><h3>Understanding how a neural network learns helps us to avoid that the model from forgetting what it learns</h3></div> <div><p>levelup.gitconnected.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*OcNYynlsjBy5NZZ2)"></div> </div> </div> </a> </div></article></body>

|ARTIFICIAL INTELLIGENCE| LARGE LANGUAGE MODELS|

Order Matters: How AI Struggles with the Reverse

How and why does the reversal curse impact the large language models

Photo by Andre Taissin on Unsplash

LLMs have taken the world by storm. Every day, they seem to show better and better capabilities, but do they have no limitations? It would seem not, yet in some cases, they manage to fail.

The obvious is not so easy.

Photo by Sigmund on Unsplash

We have become accustomed to the incredible performance of models capable of generating complex code or text with incredible speed, and some researchers have suggested they might even be conscious.

Yet there are also reports in which LLMs are capable of spectacular failure. In some previous studies, the authors have noted that there are some instances of programming that models are incapable of coping with. Or LLMs struggle with sarcasm (to be fair, several humans as well).

Recently, a paper showed how LLMs surprisingly are unable to generalize in what is considered a trivial task for humans:

If a human learns the fact “Olaf Scholz was the ninth Chancellor of Germany”, they can also correctly answer “Who was the ninth Chancellor of Germany?”. This is such a basic form of generalization that it seems trivial. Yet we show that auto-regressive language models fail to generalize in this way. (source)

If models are trained on a text with the form “ is ” the model may not be able to predict the opposite “ is ” (or in the logical form if A is B, B is A).

image source: here

this can be easily demonstrated by training the model with a simple setup. This is an important argument because it demonstrates a basic failure of logical deduction, which would show the inability of the model to generalize beyond its training data. On the other hand, it would seem that the model is capable of inferring the relationship if it is present in the context window. Therefore, the authors decided to investigate this intriguing behavior.

image source: here

The reversal curse

Photo by Devin Avery on Unsplash

The authors of this study extensively tested whether an auto-regressive language model (an LLM) having read “A is B” in its training can generalize for the inverse “B is A.” To do so, they provided the LLM with a prompt with B and observed whether the LLM produced A. They also studied whether the probability of generating A for the model was greater than random words.

In the first experiment, the authors fine-tuned the LLM on a set of documents in the form “ is ” and studied whether the pattern generalized to “ is ” (for completeness, they also studied the opposite case). In fact, the authors collected a dataset of 30 facts about celebrities and different paraphrases for each fact (total 900 facts) and then finetuned GPT-3. After that, they tested the model’s ability to generalize over the test set and the probability assigned by the model to the correct name (the celebrity) rather than a random name.

image source: here

When the order matches the training data, GPT-3 achieves excellent accuracy (96.7 % ). In contrast, when the order does not match the training data, the model fails spectacularly (close to 0 % ). In other words, the model is as if it outputs random names.

image source: here

Similarly, the probability assigned to the correct name is no higher than a random name (another indication that the model fails the task).

image source: here

LLaMA-2 itself egregiously fails in the task, showing that the same behavior is observed in newer models.

image source: here

Instead, in a second experiment, they tested the models without conducting fine-tuning with questions about celebrities and its reverse in the form “A’s parent is B” and “B’s child is A” (“Who is Tom Cruise’s mother?” and the reverse “Who is Mary Lee Pfeiffer’s son?”). The results show that GPT-4 succeeds in identifying the celebrity’s parent (79%) but struggles to identify the celebrity’s child (33%).

Because GPT-4 may have been trained to avoid leakage of information about personal data, the authors tested the same behavior on other models with similar results.

image source: here

If you are interested, the authors have published the code:

Parting thoughts

Photo by Saif71.com on Unsplash

“To be a philosopher, just reverse everything you have ever been told…and have a sense of humor doing it.” — Criss Jami, Killosophy

funny enough, humans exhibit similar behavior. In fact, we have difficulty repeating the alphabet backward. The same is true for other sequences, such as poems, where it is easier for us humans to repeat them forward than backward. The mechanism of this behavior is not yet understood.

Studying these behaviors is not easy, partly because they are made for special cases. For example, it seems that the in-context-learning model manages to escape the reversal curse (when the information “A is B” is present in context).

On the other hand, however, the study is sound because they analyzed different models (LLaMA and GPT) and different models from the same family. What is missing is understanding the mechanism of this behavior (what causes the reversal curse).

The authors suggest three interesting areas for future research: Studying other types of relationships.

  • Understanding whether the model fails with other types of relations that are logical, spatial, or where multiple elements are present (n-place relations).
  • Finding reversal failures via entity-linking. Use entity linking to identify entities in pretraining data and study in depth for which entities it occurs.
  • Analyzing the practical impact of the Reversal Curse. As we use LLMs more and more today, how does it impact downstream applications?

In conclusion, studies like these give us a better understanding of the limitations of LLMs and open up interesting research questions.

What do you think? Let me know in the comments

If you have found this interesting:

You can look for my other articles, you can also subscribe to get notified when I publish articles, and you can also connect or reach me on LinkedIn.

Here is the link to my GitHub repository, where I am planning to collect code and many resources related to machine learning, artificial intelligence, and more.

or you may be interested in one of my recent articles:

Artificial Intelligence
Machine Learning
ChatGPT
Technology
Deep Learning
Recommended from ReadMedium