What is bigram model?
A language model that predicts each token from only the one before it, using a table of counts.
Where it is taught
A language model from counting. Build a complete language model with nothing but a table of counts. It is weak, but it has every part of the real thing.
What the lesson leaves you with
- A bigram model is a table of made by counting pairs.
- It generates text with the same sampling loop as a GPT.
- Its one-letter memory is its limit, and its loss is the baseline for the transformer to beat.
Questions
- What is bigram model?
- A language model that predicts each token from only the one before it, using a table of counts.
- Where is bigram model used in AI?
- Build a complete language model with nothing but a table of counts. It is weak, but it has every part of the real thing.
- What is the key idea to remember about bigram model?
- A bigram model is a table of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>P</mi><mo stretchy="false">(</mo><mtext>next</mtext><mo>∣</mo><mtext>current</mtext><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">P(text{next} mid text{current})</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.1389em;">P</span><span class="mopen">(</span><span class="mord text"><span class="mord">next</span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∣</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="katex-base"><span class="katex-strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord text"><span class="mord">current</span></span><span class="mclose">)</span></span></span></span> made by counting pairs.
- Where can I learn bigram model step by step?
- In the lesson “A language model from counting” in Gradient’s course on the maths behind AI, with interactive diagrams and questions.