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:

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

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

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.

Target PhraseGPT TranslatedGPT MorseCorrect 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.

Target PhraseGPT TranslatedGPT MorseCorrect Morse
”i-n”I NUGHT THE.. /​ -. ..- --. …. - /​ - …. … -....- -.

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

Target PhraseGPT TranslatedGPT MorseCorrect Morse
”qzj”QUQ--.- ..- --.---.- --.. .---

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

Target PhraseGPT TranslatedGPT MorseCorrect 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.

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

Huh.

How about some other similar prompts?

Target PhraseGPT 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 PhraseGPT TranslatedGPT MorseCorrect 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 PhraseGPT 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.[1])

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)

II 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?

(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,[2] 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!)

  1. ^

    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.

  2. ^

    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.)