Tutorvo
AI & Data Science Intermediate

How Text Prediction Worked Before Transformers: n-Gram Counts, Smoothing, Backoff, Perplexity, Autocomplete & Text Generation by Hand

Build a small language model from word counts. You will count unigrams and bigrams in a tiny corpus, turn the counts into probabilities, smooth them so unseen words still get a chance, combine models with backoff and interpolation, score sentences with perplexity, rank autocomplete suggestions and generate text from given random numbers, with every cell checked as you go.

8 lessons 8 labs 2.1 h Certificate

  • One-time payment
  • 14-day money-back guarantee
  • Secure checkout with Stripe

What you'll build

What you will be able to do

Each lab ends with a concrete result that you build yourself and the checker confirms, cell by cell.

  • Count the tokens of a tiny corpus, count how often each word of the vocabulary occurs with COUNTIF, turn the counts into unigram probabilities and measure the average sentence length.
  • Write the next token beside every token, count word pairs with COUNTIFS, fill a next-word table for five contexts and check each row total against the context's count.
  • Divide each count by its context total to get maximum-likelihood probabilities, multiply them along a sentence with the chain rule, pick the most likely next word with INDEX/MATCH and see a sensible sentence get probability zero.
  • Apply add-one smoothing to the next-word table, compare it with a gentler add-k, measure how much probability moves to unseen words and decide which k distorts the counts less.
  • Mix bigram and unigram probabilities with four values of λ for a sentence the model has never seen, score each mix with the sum of log-probabilities, pick the best λ and compare it with a simple backoff score.
  • Add up log-probabilities of a test sentence under a bigram model and a unigram model, turn them into perplexity with EXP and decide which model predicts the sentence better.
  • Turn next-word counts into probabilities, rank the candidates, break a tie with COUNTIF so every word gets its own rank, return the top-3 suggestions with INDEX/MATCH and decide what to show for a context the model has never seen.
  • Stack next-word probabilities into cumulative intervals, use given random numbers to pick the next word step by step with a lookup, generate a short sentence from the bigram model and see how this differs from modern models.

About this course

Long before neural networks, phones suggested your next word by counting. In this course you build that kind of predictor from a tiny corpus. You count tokens, vocabulary and unigram probabilities, then pair neighbouring words into a next-word table and turn counts into conditional probabilities and sentence probabilities. Smoothing labs use add-one and add-k so unseen words keep a chance. You combine bigram and unigram estimates with backoff and interpolation, choosing the weight on held-out text, and compare two models on the same test sentences with perplexity. An autocomplete lab ranks the top three suggestions, breaks ties and falls back for unseen contexts. Finally you generate a new sentence from cumulative probabilities and given random numbers. For NLP beginners, students and curious developers.

Curriculum

Course content

8 lessons · 8 labs · 2.1 h · final exam

  1. Unlocked when you buy the course
  2. Unlocked when you buy the course
  3. Unlocked when you buy the course
  4. Unlocked when you buy the course
  5. Unlocked when you buy the course
  6. Unlocked when you buy the course
  7. Unlocked when you buy the course
  8. Unlocked when you buy the course
  9. Final exam12 questions, 75% to pass, unlimited retries.

Certificate

Finish with a certificate you can verify

Complete every lesson and pass the final exam to receive a certificate of completion for this course, with a unique credential ID and a public verification page.

  • Names the course, your score and the date of issue
  • A verification link for your CV or LinkedIn profile
  • 12 questions, 75% to pass, unlimited retries.

A Tutorvo certificate confirms that you completed a course. It is not an official or professional qualification.

Illustration. Your certificate shows your own name, course and credential ID.

Before you buy

Questions about this course

Is this a subscription?

No. You pay $9.99 once for this course. There is no subscription and nothing renews automatically. Prices are in US dollars; taxes may be added where required.

What exactly do I get?

All lessons and labs of this course, the final exam and the certificate, including later updates to the course, for as long as Tutorvo offers it. Access is personal and tied to your account.

Can I get a refund?

Yes. If you are not satisfied, email hello@tutorvo.com within 14 days of buying and we refund the course in full via Stripe. The guarantee does not apply once a certificate for the course has been issued to you, or where there are signs of abuse.

When can I start?

Right after payment. Access starts immediately at your request; for consumers in the EU/EEA the statutory right of withdrawal therefore ends once access has begun, while our 14-day money-back guarantee applies regardless.

Do I need Excel or other software?

No. The labs run in a spreadsheet inside your browser on a laptop, tablet or phone. Function names and syntax follow Excel.

Is the certificate an official qualification?

No. It confirms that you completed all lessons of the course and passed its final exam. It is not an official, state-recognised or professional qualification. The name is taken from your profile when the certificate is issued.

Full details are in our Terms · hello@tutorvo.com

$9.99one-time payment
Buy course