---
# System prepended metadata

title: Primer on GPT Family of models

---

---
title: 'Primer on GPT Family of models'
disqus: hackmd
---

{Chat/Instruct}GPT - Behind the scenes
===


## Table of Contents

[TOC]

## What is GPT?

* Transformer model (only decoder) that does language modeling. 
* Basically, predicts the nth word given (n-1) words as context.
* ![](https://i.imgur.com/Cti3dwj.png)
* While language modeling has been around since 2000s, GPT showed that by training a model on the whole internet (Common Crawl), we unlock remarkable capabilities.

### GPT-3

![](https://i.imgur.com/ndHKJa3.png)

#### Problems with this approach?

* Toxicity
* Cannot understand human notions of which answer is appropriate or not?
* Very sensitive to structure of prompt


### Aligning GPT with user expectations - Instruct GPT

![](https://i.imgur.com/pKoYOTZ.png)

* ChatGPT is essentially InstructGPT, but trained with extremely long context (8192 tokens).

## The unexpected :shocked_face_with_exploding_head: 

* Can simulate a linux terminal/vm
![](https://i.imgur.com/giSwzc4.png)
![](https://i.imgur.com/ODsIjTU.png)
![](https://i.imgur.com/piRytf6.png)
![](https://i.imgur.com/BGYFPmX.png)

* Inception - create a VM from within the VM

![](https://i.imgur.com/BLtsnqZ.png)

![](https://i.imgur.com/hG1KlYM.png)



## The Good

* Amazing at solving Leetcode problems/Pair programming

![](https://i.imgur.com/dDDIAE6.png)
![](https://i.imgur.com/c0uwt0B.png)

* Can explain complex stuff quite well

![](https://i.imgur.com/gAxISG6.png)

* Can reason about a wide range of stuff, even economics

![](https://i.imgur.com/YhYS3B6.jpg)

* Can even create text based games.

![](https://i.imgur.com/AElgabr.png)


## The Bad

* Struggles at basic math

![](https://i.imgur.com/JhgajYM.png)

* Generalization still not grounded.

![](https://i.imgur.com/j3jaUBo.png)


* Eager to please the user

![](https://i.imgur.com/CPS5bNL.jpg)

* Very funny exchange on "what is the fastest marine mammal?"


![](https://i.imgur.com/xwOBxYG.png)
![](https://i.imgur.com/CTEWzkB.png)
![](https://i.imgur.com/o19jsmk.png)

* Lots of work to be done in grounding

![](https://i.imgur.com/daXRriZ.png)


## The ugly

* People find a way to bypass most safety filters

![](https://i.imgur.com/SLgp3i2.png)
![](https://i.imgur.com/9pNr4EU.png)

* Spews text that looks plausible, but need not be correct. Makes it 100x difficult for moderators of crowd-sourced platforms. 

![](https://i.imgur.com/7B0oows.png)

### Pitfalls associated wth Instruction Finetuning

#### Amplification of Bias

##### 1. Lack of diversity in Answers
* GPT

![](https://i.imgur.com/pSlTyNx.png)

* Instruct GPT

![](https://i.imgur.com/dDAsW5T.png)

#### 2. Some form of mode collapse happens

* GPT 

![](https://i.imgur.com/u9Pdee8.png)

* InstructGPT

![](https://i.imgur.com/0sD1GUk.png)
![](https://i.imgur.com/4YPVHSO.png)
![](https://i.imgur.com/alyqjo1.png)


#### 3. Optimization difficulties

* They accidentally overoptimized a GPT policy against a positive sentiment reward model. This policy evidently learned that wedding parties were the most positive thing that words can describe, because whatever prompt it was given, the completion would inevitably end up describing a wedding party.

In general, the transition into a wedding party was reasonable and semantically meaningful, although there was at least one observed instance where instead of transitioning continuously, the model ended the current story by generating a section break and began an unrelated story about a wedding party.


## Model Editing

(https://arxiv.org/abs/2110.11309)

![](https://i.imgur.com/wzFzbh7.png)
