Friday, May 9, 2025
News PouroverAI
Visit PourOver.AI
No Result
View All Result
  • Home
  • AI Tech
  • Business
  • Blockchain
  • Data Science & ML
  • Cloud & Programming
  • Automation
  • Front-Tech
  • Marketing
  • Home
  • AI Tech
  • Business
  • Blockchain
  • Data Science & ML
  • Cloud & Programming
  • Automation
  • Front-Tech
  • Marketing
News PouroverAI
No Result
View All Result

How to Interpret GPT2-Small. Mechanistic Interpretability on… | by Shuyang Xiang | Mar, 2024

March 22, 2024
in AI Technology
Reading Time: 2 mins read
0 0
A A
0
Share on FacebookShare on Twitter




Mechanistic Interpretability on prediction of repeated tokens

The emergence of large-scale language models, particularly ChatGPT, has astounded many, including myself, with its remarkable linguistic abilities and versatility in completing various tasks. Despite our admiration for its capabilities, researchers, myself included, often find ourselves puzzled. Even with knowledge of the model’s structure and weight values, understanding why a specific input sequence leads to a particular output sequence remains a challenge.

In this blog post, I aim to clarify GPT2-small using mechanistic interpretability in a simple context: predicting repeated tokens.

Traditional mathematical tools for explaining machine learning models may not be entirely appropriate for language models. For instance, while SHAP is effective at identifying significant features that influence predictions, it primarily operates at the feature level, which may not align well with token-level predictions of language models.

Language Models (LLMs) present a complex high-dimensional space with numerous parameters and inputs. Computing SHAP values in such a space can be computationally expensive and may not provide deep insights into the model’s decision-making process.

Mechanistic Interpretability offers a different perspective by shedding light on the underlying mechanisms or reasoning processes of a model’s predictions, rather than just pinpointing important features or inputs.

For our analysis, we will use GPT2-small and the TransformerLens library, designed specifically for interpreting GPT-2 style language models.

gpt2_small: HookedTransformer = HookedTransformer.from_pretrained("gpt2-small")

The above code loads the GPT2-Small model to predict tokens on a sequence generated by a specific function that includes repeated token sequences.

Finding Induction Head

An interesting observation when running the model on the generated token sequence is that it performs significantly better on the second half of the sequence compared to the first half. This performance difference is measured by log probabilities on correct tokens.

We identify an induction circuit that scans the sequence for prior instances of the current token, predicts the next token based on the previous token, and repeats the sequence. This circuit consists of an induction head and a previous token head.

By analyzing attention patterns and scores, we can pinpoint the specific heads in GPT2-small responsible for induction and previous token identification.

MLP Layer Attribution

We explore the contribution of MLP layers in GPT2-Small by using an ablation technique to observe changes in the model’s performance when removing MLP layer outputs from the second half of the sequence.

Surprisingly, the ablation does not significantly impact the model’s predictions, indicating that MLP layers may not play a crucial role in the context of repeated tokens.

Constructing Induction Circuit

We manually construct an induction circuit using specific heads in GPT2-Small that were identified as the induction head and previous token head. This circuit demonstrates a reasonable accuracy of 0.2283, despite being constructed with only two heads.

For a detailed implementation, please refer to my notebook.






Source link

Tags: GPT2SmallInterpretInterpretabilityMarMechanisticonâShuyangXiang
Previous Post

 LUNA Price Remains Unaffected as Terra Blockchain Experiences Another Halt

Next Post

Ars pharmaceuticals CEO sells over $21k in company stock By Investing.com

Related Posts

How insurance companies can use synthetic data to fight bias
AI Technology

How insurance companies can use synthetic data to fight bias

June 10, 2024
From Low-Level to High-Level Tasks: Scaling Fine-Tuning with the ANDROIDCONTROL Dataset
AI Technology

From Low-Level to High-Level Tasks: Scaling Fine-Tuning with the ANDROIDCONTROL Dataset

June 10, 2024
How Game Theory Can Make AI More Reliable
AI Technology

How Game Theory Can Make AI More Reliable

June 9, 2024
Decoding Decoder-Only Transformers: Insights from Google DeepMind’s Paper
AI Technology

Decoding Decoder-Only Transformers: Insights from Google DeepMind’s Paper

June 9, 2024
Buffer of Thoughts (BoT): A Novel Thought-Augmented Reasoning AI Approach for Enhancing Accuracy, Efficiency, and Robustness of LLMs
AI Technology

Buffer of Thoughts (BoT): A Novel Thought-Augmented Reasoning AI Approach for Enhancing Accuracy, Efficiency, and Robustness of LLMs

June 9, 2024
Deciphering Doubt: Navigating Uncertainty in LLM Responses
AI Technology

Deciphering Doubt: Navigating Uncertainty in LLM Responses

June 9, 2024
Next Post
Ars pharmaceuticals CEO sells over $21k in company stock By Investing.com

Ars pharmaceuticals CEO sells over $21k in company stock By Investing.com

How AI and Blockchain Converge for Next-Generation Solutions

How AI and Blockchain Converge for Next-Generation Solutions

How Automated Reward Systems Will Redefine Employee Recognition

How Automated Reward Systems Will Redefine Employee Recognition

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Trending
  • Comments
  • Latest
Is C.AI Down? Here Is What To Do Now

Is C.AI Down? Here Is What To Do Now

January 10, 2024
Porfo: Revolutionizing the Crypto Wallet Landscape

Porfo: Revolutionizing the Crypto Wallet Landscape

October 9, 2023
A Complete Guide to BERT with Code | by Bradney Smith | May, 2024

A Complete Guide to BERT with Code | by Bradney Smith | May, 2024

May 19, 2024
A faster, better way to prevent an AI chatbot from giving toxic responses | MIT News

A faster, better way to prevent an AI chatbot from giving toxic responses | MIT News

April 10, 2024
Part 1: ABAP RESTful Application Programming Model (RAP) – Introduction

Part 1: ABAP RESTful Application Programming Model (RAP) – Introduction

November 20, 2023
Saginaw HMI Enclosures and Suspension Arm Systems from AutomationDirect – Library.Automationdirect.com

Saginaw HMI Enclosures and Suspension Arm Systems from AutomationDirect – Library.Automationdirect.com

December 6, 2023
Can You Guess What Percentage Of Their Wealth The Rich Keep In Cash?

Can You Guess What Percentage Of Their Wealth The Rich Keep In Cash?

June 10, 2024
AI Compared: Which Assistant Is the Best?

AI Compared: Which Assistant Is the Best?

June 10, 2024
How insurance companies can use synthetic data to fight bias

How insurance companies can use synthetic data to fight bias

June 10, 2024
5 SLA metrics you should be monitoring

5 SLA metrics you should be monitoring

June 10, 2024
From Low-Level to High-Level Tasks: Scaling Fine-Tuning with the ANDROIDCONTROL Dataset

From Low-Level to High-Level Tasks: Scaling Fine-Tuning with the ANDROIDCONTROL Dataset

June 10, 2024
UGRO Capital: Targeting to hit milestone of Rs 20,000 cr loan book in 8-10 quarters: Shachindra Nath

UGRO Capital: Targeting to hit milestone of Rs 20,000 cr loan book in 8-10 quarters: Shachindra Nath

June 10, 2024
Facebook Twitter LinkedIn Pinterest RSS
News PouroverAI

The latest news and updates about the AI Technology and Latest Tech Updates around the world... PouroverAI keeps you in the loop.

CATEGORIES

  • AI Technology
  • Automation
  • Blockchain
  • Business
  • Cloud & Programming
  • Data Science & ML
  • Digital Marketing
  • Front-Tech
  • Uncategorized

SITEMAP

  • Disclaimer
  • Privacy Policy
  • DMCA
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

Copyright © 2023 PouroverAI News.
PouroverAI News

No Result
View All Result
  • Home
  • AI Tech
  • Business
  • Blockchain
  • Data Science & ML
  • Cloud & Programming
  • Automation
  • Front-Tech
  • Marketing

Copyright © 2023 PouroverAI News.
PouroverAI News

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In