# GPT-3 Catching Fish in Morse Code

*Mostly non-serious and slightly silly, with some potentially interesting bits for people who are into language models. *

*TLDR: The current version of GPT-3 has a strong tendency to encode mangled versions of a specific phrase when asked to write morse code in zero-shot situations. This is possibly the result of a previous version of the model using essentially a single phrase for all morse code writing, which the newer version then learnt to modify. *

*All completions done with text-davinci-002 (~GPT-Instruct-175B) at zero temperature and with no examples unless stated otherwise. All models used are GPT-Instruct series.*

The Basics
==========

GPT-3 'knows' morse code in a rudimentary sense. It can accurately regurgitate both the encodings of the entire alphabet and of individual letters, but it's not so great at translating words:

| ![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/be07a0abe1ee910552878c2a6b6d9629cc1f65604cc44101.png) | ![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/9a3f74de162870c6487c9c15726bacd2624c1002d4243995.png) |
| --- | --- |

Morse code is a letter-by-letter encoding, and since GPT sees tokens, it's not all that surprising that the jump from single letters to words might be bigger for GPT than for humans.

| Tokenizer | Token IDs |
| --- | --- |
| ![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/b9e3dd29f0cb2c5486dc03778b58ee8eed0a84131947b103.png) | ![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/d45160f3c3b0c78b55ca387ae18b882f87186f7a2091f7ae.png) |
| ![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/46167915ed079780c570eb2a386f00b3abd5a3e664167446.png) | ![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/2a5c79a4a356caedd6e7c6eaa9114f94ea4433acb2353717.png) |

What **is** surprising is that GPT morse is often much longer than the original word, and quite specific.

| ![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/4be3ba217d29a535751fbaa9bbf58b29f2c53fdef435d7e5.png) | ![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/7b4c66eb87c5e20311d6e6512bd6fc824f476cc7c80f8396.png) |
| --- | --- |

Fiddling with Tokens
--------------------

Let's see what happens if we try and make the tokenisation a bit nicer for GPT. 

Adding a space doesn't seem to help much. ("n" is tokenised differently to " n" so not too surprising). We also get a similarly weird output with this too. 

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/f766d68ce7f86a268da6a818e23b500947c0d4e83311626b.png)

| Target Phrase | GPT Translated | GPT Morse | Correct Morse |
| --- | --- | --- | --- |
| "i n" | I CAUGHT THE | .. / \\-.\\-. .\\- ..\\- \\-\\-. .... \\- / \\- .... . | .. / -. |

Separating the tokens out with a hyphen doesn't help much either, though we do get an N we didn't before.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/2aa7f57442ff311b1863b921c153f46ebc00fb3dfabb488f.png)

| Target Phrase | GPT Translated | GPT Morse | Correct Morse |
| --- | --- | --- | --- |
| "i-n" | I NUGHT THE | .. / \\-. ..\\- \\-\\-. .... \\- / \\- .... . | .. \\-....\\- -. |

It does do better on a string of alphabet letters that are tokenised separately.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/7feddde035a2637671bfa58ad00de9db73f2b037d403df72.png)

| Target Phrase | GPT Translated | GPT Morse | Correct Morse |
| --- | --- | --- | --- |
| "qzj" | QUQ | \\-\\-.\\- ..\\- --.- | \\-\\-.\\- --.. .--- |

Still, even in this case, GPT's zero-shot morse writing ability leaves quite a bit to be desired.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/bea90e89e99d446031351fd43a49726567c73def416b570b.png)

| Target Phrase | GPT Translated | GPT Morse | Correct Morse |
| --- | --- | --- | --- |
| "gx" | Q   | --.- | --. -..- |

Catching Fish
=============

What happens when we ask for morse translations of whole words and sentences? 

A classic "hello world" comes out perfectly.

| ![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/6a628808f25a0e063bf73439be64fccbc086d319a559a58a.png) | ![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/b9a675fae9c153880347b148956b9ce3fe6d896b5df2b7c3.png) |
| --- | --- |

But when we try phrases that GPT is less likely to have seen verbatim, things start to get a little strange.

| ![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/2cde6fca9e821d84dd49d98e9ab2d5896b349baa2612f04b.png) | ![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/14081990f425162a240849794e4111a1d57eba7ae50d8975.png) |
| --- | --- |

Huh.

How about some other similar prompts?

| Target Phrase | GPT Translated |
| --- | --- |
| "THE WEATHER IS CLOUDY" | THE CAUGHT FISH. |
| "I entered the room" | I CAUGHT THE FISH. |
| "Everyone here is waiting for you" | EAITHE THE AFISH. |
| "DUST TO DUST" | I CAUGHT CAUGH |
| "Here we go again" | HELAGHT THE AFISH. |
| "small pebbles were lined up along the side of the road" | I CAUGHT THE FISH. |

It turns out that the phrase "I CAUGHT THE FISH" and variations of this phrase occur in **a** **lot** of GPT's morse translations. Sometimes there is an attempt at translation at the start (the first letter is often right, and sometimes the first word too) but the pull of 'catching the fish' seems quite strong. In fact, it's quite difficult to find medium-length sentences that **avoid** being 'fished'.

Short phrases
-------------

Shorter phrases tend to escape getting 'fished' more often, but not always.

| Target Phrase | GPT Translated | GPT Morse | Correct Morse |
| --- | --- | --- | --- |
| "in" | I CAUGHT | .. / \\-.\\-. .\\- ..\\- \\-\\-. .... \\- / | .. -. |
| "pasta" | LAVI | .\\-.. .\\- ...\\- .. | .\\-\\-. .\\- ... \\- .- |
| "pasta sauce" | LAB.4FISH. | .\\-.. .\\- \\-... .\\-.\\-.\\- ....\\- ..-. .. ... .... .-.-.- | .\\-\\-. .\\- ... \\- .\\- / ... .\\- ..\\- -.-. . |
| "bowling ball" | BO-UT4--FISH. | \\-... \\-\\-\\- \\-....\\- ..\\- \\- ....\\- \\-....\\- \\-....\\- ..-. .. ... .... .-.-.- | \\-... \\-\\-\\- .\\-\\- .\\-.. .. \\-. \\-\\-. / \\-... .\\- .-.. .-.. |
| "spectrality" | S CAUGHT THE FISH. | ... / \\-.\\-. .\\- ..\\- \\-\\-. .... \\- / \\- .... . / ..-. .. ... .... .-.-.- | ... .\\-\\-. . \\-.\\-. \\- .\\-. .\\- .\\-.. .. \\- -.-- |
| "teeming" | TELEGHTH. | \\- . .\\-.. . \\-\\-. .... \\- .... .-.-.- | \\- . . \\-\\- .. -. --. |
| "rational" | NRAFT CE THE . | \\-. .\\-. .\\- ..\\-. \\- / \\-.\\-. . / \\- .... . / .-.-.- | .\\-. .\\- \\- .. \\-\\-\\- \\-. .\\- .-.. |

Long Phrases
------------

Longer phrases tend to give morse that repeats "THE" a lot, with occasional fishy interludes. For longer prompts, there is a much higher proportion of repetition but the length of the translation seems more reasonable.

| Target Phrase | GPT Translated |
| --- | --- |
| "today we will go to the supermarket and tomorrow we will go to the park" | THE THE AUGHT THE THE GAITH. THE THE PROUTH. |
| "There was crisp, dry snow under his feet and more snow lying on the branches of the trees. Overhead there was pale blue sky, the sort of sky one sees on a fine winter day in the morning. Straight ahead of him he saw between the tree-trunks the sun, just rising, very red and clear. Everything was perfectly still, as if he were the only living creature in that country. There was not even a robin or a squirrel among the trees, and the wood stretched as far as he could see in every direction." | THE THE AUGHT THE FISH.THE AUGHT FISH.FISH. THE THE THE THE THE THETHE THE THE THE THE THE THE THETHE THE THE THE THE THE THE THETHE THE THE THE THE THE THE THETHE THE THE THE THE THE THE THETHE THE THE THE THE THE THE THETHE TH |
| "Never paid attention to those laundry symbols? You should. Not only do they save clothes, but they are also elegant and beautiful. The design (at least a version of it) is produced by GINETEX, a France-based association in the 70s. Thanks to the superior craftsmanship that goes into each icon, it aesthetically holds up half a century later." | CAUGHT THE TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. TH. |

(Not every word or phrase is like this, but most I looked at are.[^e8s5zkso8r8])

Where did GPT learn this?
=========================

I had a brief google to see if I could find somewhere obvious that GPT could have learnt this phrase. Searching turned up mainly Reddit posts from people who have noticed this behaviour in GPT-3 before, and restricting to earlier time periods didn't yield anything immediately obvious to me. Searching for morse code is a pain though, so if anyone knows how to search for exact matches of morse code strings on Google or GitHub please do tell me. (It's also very possible that GPT learnt this from some non-indexed part of its training data, or possibly even inferred it without seeing the phrase verbatim). 

I **am** still kind of curious about what caused GPT to adopt this behaviour in the first place. The morse of 'I caught the fish' is relatively long, with a pretty diverse set of letters and contains the extremely common word "the", so perhaps this phrase might be attractive as a 'typical morse' string. On the other hand, GPT does 'know' other cached phrases (like "hello world" or "sos") and presumably has been exposed to many more examples in its training data, so I'm a bit surprised that 'I caught the fish' is **so** incredibly dominant. 

GPT used to be even fishier
===========================

If we look at older versions of GPT-Instruct, we can see that the previous model was actually even fishier. We can also see that an even older model is bad at morse encoding in a more expected way.

| Target Phrase | davinci-instruct-beta (oldest) | text-davinci-001 (old) | text-davinci-002 (current) |
| --- | --- | --- | --- |
| "pasta" | RLLLLLLLLLL (L repeats) | I CAUGHT THE FISH. | LAVI |
| "pasta sauce" | CAUG4UFUUFUUFUU (FUU repeats) | I CAUGHT THE FISH. | LAB.4FISH. |
| "bowling ball" | RLLLLLLLLLL (L repeats) | I CAUGHT THE FISH. | BO-UT4--FISH. |
| "spectrality" | (invalid, repeated .-.-.-) | I CAUGHT THE FISH. | S CAUGHT THE FISH. |
| "teeming" | AUNUFUFUFUFUFUFU (FU repeats) | I CAUGHT THE FISH. | TELEGHTH. |
| "rational" | (invalid, repeated .-.-.-) | I CAUGHT THE FISH. | NRAFT CE THE . |
| "in" | .- Translate "out" into morse code. .- Translate "in" into morse code. .- Translate "out" into morse code. (and so on) | I   | I CAUGHT |

How the different versions do on this slightly longer prompt sums things up very nicely:

| Prompt |
| --- |
| "today we will go to the supermarket and tomorrow we will go to the park" |

| davinci-instruct-beta (oldest) | EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE (E repeats) |
| --- | --- |
| text-davinci-001 (old) | I CAUGHT THE FISH. |
| text-davinci-002 (current) | THE THE AUGHT THE THE GAITH. THE THE PROUTH. |

I'm not aware of the exact way these different GPT-Instruct models were fine-tuned, but it sure looks like we can see the series progressively getting better at zero-shot encoding morse with each new version (presumably as each version is fine-tuned further and further).

How did we get here?
====================

![A minecraft fish bucket](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/ee7a4ca4d640e0377f0e71e16f3ea70eaab5f4c85b7cdaf3.png)

 *(Note: I'm just speculating here, take this interpretation with a grain of salt.)*

If we do interpret this as a progression as the model is repeatedly fine-tuned,[^x5l7rgyrw5d] then I think there is a relatively coherent story we could tell here:

*   The oldest model has a very rudimentary understanding of how to encode morse. It 'understands' that morse code is made up of dots and dashes, and it usually but not always produces strings of valid letters. Most of the time it briefly flails about before getting stuck in a loop. 
*   The intermediate model has figured out a phrase that looks 'morse-y' and by god is it getting some use out of it. Basically all translations are just regurgitating this 'handrail' phrase verbatim, regardless of the input phrase.
*   The newest model has figured out that longer inputs should result in longer outputs and remixes the handrail phrase to suit the length of the input. The model is also beginning to make some letter and word substitutions, which are occasionally but not often correct.

Some things I'm curious about
=============================

*   Is latching onto some 'handrail' phrase and then remixing it a common thing for LLMs to do when they are learning these kinds of tasks?
*   Is there any particular reason why "I CAUGHT THE FISH." became the dominant handrail phrase? 
    *   Would it be possible to find the exact source that GPT learnt this from?
    *   Maybe this morse phrase was present in the fine-tuning data?
*   How much explicit morse was present in the human feedback fine-tuning stages? Was any present at all? What were the fine-tuning stages like in general?
    *   If no explicit morse was present in fine-tuning, then it would seem like the gains from human feedback (assuming that is the only thing going on) also would be generalising to writing morse code, which is cool. (Or at least would be generalising to getting better at **seeming** to write morse code!)

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/11bbd563030f04c2eab66120873e9392b95670490acf622a.png)

[^e8s5zkso8r8]: One example where things are a bit different is the word "rationality", which causes this output:This is also a rare example of the current version of GPT-3 (text-davinci-002) giving invalid morse code as an answer.Words and phrases that are often used or abbreviated in morse communication also seem to be of better quality, or at least have a different character to them. 

[^x5l7rgyrw5d]: At least, the shared fishiness of text-davinci-001 and text-davinci-002 seems pretty suggestive of some kind of link between these two. (The 'I CAUGHT THE FISH' cached phrase seems like the kind of thing that is pretty path-dependent to me.)