For engineers who want to know how AI and quant work underneath.

Choose where to start.

Two subjects, and what's inside each.

  • The capital of Australia is −0.950.300.53−0.390.31−0.77−0.50−0.20−0.200.330.790.18−0.66−0.62−0.440.28−0.27−0.880.79−0.31−0.78−0.130.850.29−0.510.26−0.08−0.44−0.800.010.100.59−0.36−0.500.340.27−0.640.540.860.62−0.500.78 ThecapitalofAustraliais CanberraSydneyMelbourne tokens attention weights next token The capital of Australia is −0.95−0.71−0.60−0.35−0.910.680.23−0.43−0.370.900.060.940.920.31−0.730.550.340.180.04−0.67−0.670.72−0.280.27−0.660.14−0.80−0.28−0.890.93−0.770.36 capitalofAustraliais CanberraSydney tokens attention weights next token

    AI engineering

    Learn how models work, then build on them.

    Start with lesson 1
  • 101.25101.20101.30101.15101.35101.10101.40101.05 price order book spread next price price order book next price

    Quant engineering

    Learn the maths and data behind quant roles.

    Start with lesson 1

See a lesson from the inside.

Why chat models miscount the r's in strawberry, one step at a time.

32Tokens and Embeddings

Letters hide inside tokens

Ask some chat models how many r’s are in “strawberry”, and they answer two. Look at what the model actually receives, and the slip makes sense. In this lesson, ␣ marks a space.

Example 1.1

Counting the r’s in strawberry

GPT-2’s tokenizer reads “How many r’s are in strawberry?”. What does the model get for the word, and where are the r’s?

  1. 1Cut into tokensHow␣many␣r's␣are␣in␣strawberry?8 tokens. Most words carry the space in front of them.
  2. 2Find the word␣strawberry → 41236The whole word, space included, is one token in GPT-2’s vocabulary.
  3. 3Look for the letters41236One number. The three r’s are inside it, out of sight.

AnswerOne token, 41236. To count its r’s, the model must have learned how that token is spelled.

Tokenizer quirks: numbers, spelling, languages33

A model can learn spellings, but only second-hand, from text where words get spelled out, rhymed or misspelled. That knowledge is patchy across tens of thousands of tokens, so letter tasks go wrong where meaning tasks go fine. Spelling the word out first helps, because then each letter becomes its own token.

why it works

Token boundary

Where one token ends and the next begins.

␣strawberry → 41236: one ID, 10 letters

then you try

Your turn

GPT-2 cuts “␣bookkeeper” into “␣book” (ID 1492) and “keeper” (ID 13884). Asked how many e’s the word has, what does the model have to go on?

  1. (a)Two IDs, plus whatever it learned elsewhere about how each is spelled
  2. (b)Ten letters, so it can count the three e’s directly
  3. (c)One byte token per letter
  4. (d)Nothing, so it always answers zero

32Tokens and Embeddings

Letters hide inside tokens

Ask some chat models how many r’s are in “strawberry”, and they answer two. Look at what the model actually receives, and the slip makes sense. In this lesson, ␣ marks a space.

Example 1.1

Counting the r’s in strawberry

GPT-2’s tokenizer reads “How many r’s are in strawberry?”. What does the model get for the word, and where are the r’s?

  1. 1Cut into tokensHow␣many␣r's␣are␣in␣strawberry?8 tokens. Most words carry the space in front of them.
  2. 2Find the word␣strawberry → 41236The whole word, space included, is one token in GPT-2’s vocabulary.
  3. 3Look for the letters41236One number. The three r’s are inside it, out of sight.

AnswerOne token, 41236. To count its r’s, the model must have learned how that token is spelled.

Read the whole lesson

More than lessons.

Put what you read to work.

  • next weekthis weektomorrow4 or 9?todaymissed

    Daily practice

    A few questions a day, so what you read stays with you.

    Start practising
  • FirstCitizen:4 blocksTiny Shakespearenext letterval loss< 2.0

    Build it yourself

    Real projects you build and run on your own machine.

    See the projects
  • 4.55.5Online testPhone roundMaking amarketBettinggamesThe finalchatQuant Trader

    Interview prep

    Know every round, in order, before you walk in.

    Pick your role

Used by 25,000+ engineers from

Jane StreetGoogleZomatoCitadelMicrosoftZerodhaTwo SigmaTempleMetaHudson River TradingFlipkartOptiverNVIDIASwiggyJump TradingStripeD. E. ShawZeptoIMCTower Research Capital

Get your pass.

Frequently asked questions

What is insideout?

Lessons that show how AI and quant systems work, with every step of every example written out. Around them: daily practice, interview prep for six roles, and projects you build yourself.

Who is it for?

Engineers who want to understand the tools they use: developers moving into AI engineering, and anyone heading into quant research, trading or development.

Where do I start?

On Learn, pick AI or quant engineering and open the first lesson. Each module starts from the basics, and Tracks show the order we'd take them in.

What's free?

The first three lessons of every module, with no account. A free account adds Practice, Projects and Interview, and saves your progress on any device.

What does Pro add?

Every lesson in every module, every interview round, and unlimited practice: more sets, any topic on its own, and timed runs.

How much maths do I need?

School algebra is enough to start. Each idea begins in plain words with small numbers, and every step is shown. Some Python helps with the code.

Does it work on my phone?

Yes. Lessons, Practice and Interview all work on a phone. Projects need a computer.

What does Pro cost?

$5.99 a month, billed yearly. You can also pay monthly, every three months or once for life, and cancel any time.

Something else? Write to us at help@insideout.sh