Playing around with GPT-2 - the sequel

the sequel

Contents
<p>When I <a href="/story/playing-around-with-gtp-2/">played with the smaller GPT-2 models</a>, the output was fun but obviously a machine talking to itself — grammatical, topically vague, and prone to collapsing into nonsense after a sentence or two. OpenAI had deliberately held back the full model, worried it was too good and too easy to abuse for spam and fake news. On 5 November 2019 they changed their minds and released the lot: the full 1.5-billion-parameter model, <code>1558M</code>, having &ldquo;seen no strong evidence of misuse so far&rdquo;. So of course I ran it against exactly the same prompts, to see how much the extra parameters actually buy you.</p> <p>The short answer: a lot. The difference between the small model and the full one isn&rsquo;t subtle. Where the little models produced word-salad that happened to be grammatical, <code>1558M</code> holds a thread across a whole paragraph, keeps its pronouns straight, and every so often says something that would pass a lazy skim. It&rsquo;s the first time one of these felt less like a Markov chain with delusions of grandeur and more like something that had genuinely read the internet.</p> <p><strong>A note from 2026:</strong> this post is a period piece. The commands below use TensorFlow 1.x and the original <code>openai/gpt-2</code> repository, which is how you ran these things in 2019. If you want to run a small language model on your own hardware today the toolchain is completely different and far easier — see <a href="/story/running-gemma-3-locally-googles-small-model-on-consumer-hardware/">running Gemma 3 locally</a> for the modern equivalent. I&rsquo;ve left the original workflow intact because the <em>outputs</em> are the interesting part, and they&rsquo;re a nice fossil of where this technology was.</p> <h2 id="downloading-the-full-model">Downloading the full model</h2><div class="ad-unit ad-in-article" aria-label="Advertisement"> <span class="ad-label">Advertisement</span> <ins class="adsbygoogle" style="display:block;text-align:center" data-ad-client="ca-pub-3726833845844946" data-ad-slot="3291553914" data-ad-format="auto" data-full-width-responsive="true"></ins> <script>(adsbygoogle = window.adsbygoogle || []).push({});</script> </div> <p>If you followed the guide in the <a href="/story/playing-around-with-gtp-2/">original article</a>, the new weights drop straight into the same checkout:</p> <div class="highlight"><div class="chroma"> <table class="lntable"><tr><td class="lntd"> <pre tabindex="0" class="chroma"><code><span class="lnt">1 </span></code></pre></td> <td class="lntd"> <pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">python3 download_model.py 1558M</span></span></code></pre></td></tr></table> </div> </div> <p>The model is roughly 6 GB, and at the time the download seemed throttled, so it takes a while. Once it&rsquo;s down, point the interactive sampler at it:</p> <div class="highlight"><div class="chroma"> <table class="lntable"><tr><td class="lntd"> <pre tabindex="0" class="chroma"><code><span class="lnt">1 </span></code></pre></td> <td class="lntd"> <pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">python3 src/interactive_conditional_samples.py --model_name<span class="o">=</span>1558M --top_k <span class="m">40</span> --nsamples<span class="o">=</span><span class="m">2</span> --length <span class="m">100</span></span></span></code></pre></td></tr></table> </div> </div> <p><code>--top_k 40</code> restricts each step to the 40 most likely next tokens, which keeps the output coherent rather than letting a rare low-probability token derail a sentence; <code>--nsamples=2</code> gives two completions per prompt so you can see the variance; <code>--length 100</code> caps each at 100 tokens. Now the same prompts as before.</p> <h2 id="the-papers-own-title">The paper&rsquo;s own title</h2> <p>Feeding it the title of the paper that introduced GPT-2, the full model produces something that reads like a plausible (if invented) machine-learning abstract rather than the small model&rsquo;s vague waffle:</p> <div class="highlight"><div class="chroma"> <table class="lntable"><tr><td class="lntd"> <pre tabindex="0" class="chroma"><code><span class="lnt"> 1 </span><span class="lnt"> 2 </span><span class="lnt"> 3 </span><span class="lnt"> 4 </span><span class="lnt"> 5 </span><span class="lnt"> 6 </span><span class="lnt"> 7 </span><span class="lnt"> 8 </span><span class="lnt"> 9 </span><span class="lnt">10 </span><span class="lnt">11 </span><span class="lnt">12 </span><span class="lnt">13 </span><span class="lnt">14 </span><span class="lnt">15 </span><span class="lnt">16 </span></code></pre></td> <td class="lntd"> <pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">Model prompt &gt;&gt;&gt; Language Models are Unsupervised Multitask Learners. </span></span><span class="line"><span class="cl"><span class="o">========================================</span> SAMPLE <span class="nv">1</span> <span class="o">========================================</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">We propose a neural language model <span class="o">(</span>NLLM<span class="o">)</span> <span class="k">for</span> multistep learning that allows models to learn more than one state simultaneously. We focus on the sequential aspect of recurrent neural networks and show that this can provide a powerful approach to learning multistep tasks, such as speech recognition. </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">In our model, neural processes are represented in the form of a vector, which we feed into the network. Each network layer is a <span class="k">function</span> that takes a vector and returns a matrix containing <span class="nv">the</span> </span></span><span class="line"><span class="cl"><span class="o">========================================</span> SAMPLE <span class="nv">2</span> <span class="o">========================================</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">This post is part of a series on Neural Networks with Deep Belief Networks. We describe our architecture and discuss how we use it in our latest project: C2. </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">When your app starts up, it loads many different modules from different resources. You may need to keep an eye on the models and their dependencies in the app. These models depend on one another, so you may need to watch many of them at once. A typical scenario would look like this: </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">Model <span class="nv">A</span> </span></span><span class="line"><span class="cl"><span class="o">================================================================================</span></span></span></code></pre></td></tr></table> </div> </div> <p>Notice it invents a plausible-sounding acronym (&ldquo;NLLM&rdquo;), frames a research direction, and even gestures at citations. None of it is real, but the <em>shape</em> of a technical paper is there, which is exactly the failure mode people were nervous about: fluent, confident, and wrong.</p> <h2 id="the-star-wars-question">The Star Wars question</h2><div class="ad-unit ad-in-article" aria-label="Advertisement"> <span class="ad-label">Advertisement</span> <ins class="adsbygoogle" style="display:block;text-align:center" data-ad-client="ca-pub-3726833845844946" data-ad-slot="3291553914" data-ad-format="auto" data-full-width-responsive="true"></ins> <script>(adsbygoogle = window.adsbygoogle || []).push({});</script> </div> <p>Ask it the eternal fandom flamewar — did Han shoot first? — and the full model is markedly more fluent than the small one, though it wanders off into what reads like a translated web-novel:</p> <div class="highlight"><div class="chroma"> <table class="lntable"><tr><td class="lntd"> <pre tabindex="0" class="chroma"><code><span class="lnt"> 1 </span><span class="lnt"> 2 </span><span class="lnt"> 3 </span><span class="lnt"> 4 </span><span class="lnt"> 5 </span><span class="lnt"> 6 </span><span class="lnt"> 7 </span><span class="lnt"> 8 </span><span class="lnt"> 9 </span><span class="lnt">10 </span><span class="lnt">11 </span><span class="lnt">12 </span><span class="lnt">13 </span><span class="lnt">14 </span><span class="lnt">15 </span><span class="lnt">16 </span><span class="lnt">17 </span><span class="lnt">18 </span><span class="lnt">19 </span><span class="lnt">20 </span><span class="lnt">21 </span><span class="lnt">22 </span><span class="lnt">23 </span><span class="lnt">24 </span><span class="lnt">25 </span></code></pre></td> <td class="lntd"> <pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="o">================================================================================</span> </span></span><span class="line"><span class="cl">Model prompt &gt;&gt;&gt; Did Han shoot first ? </span></span><span class="line"><span class="cl"><span class="o">========================================</span> SAMPLE <span class="nv">1</span> <span class="o">========================================</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">Han shot first, so he should be the one who would be punished, right ? </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">But… </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">No way… the judge should be the other party! </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="s2">&#34;You are right, Han shot first.&#34;</span> An officer with a serious expression told Feng Nu beside her, his face expressionless as before. </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">Feng Nu shook her head: <span class="s2">&#34;It really didn&#39;t matter, Judge, Han is a military officer now. The rules are the same. I do understand </span></span></span><span class="line"><span class="cl"><span class="s2">======================================== SAMPLE 2 ======================================== </span></span></span><span class="line"><span class="cl"><span class="s2"> </span></span></span><span class="line"><span class="cl"><span class="s2"> </span></span></span><span class="line"><span class="cl"><span class="s2">That is a very interesting question, and one I am not sure about myself. To my knowledge, Han shot his first-round shot first. However, at the range, I am certain Han hit another target on at least two different occasions. </span></span></span><span class="line"><span class="cl"><span class="s2"> </span></span></span><span class="line"><span class="cl"><span class="s2">I also think his point shot (from his second shot) was the only shot that hit on target. </span></span></span><span class="line"><span class="cl"><span class="s2"> </span></span></span><span class="line"><span class="cl"><span class="s2">Why doesn&#39;t he have more of these marksmanship feats? </span></span></span><span class="line"><span class="cl"><span class="s2"> </span></span></span><span class="line"><span class="cl"><span class="s2">I can only speculate, but here are the possible </span></span></span><span class="line"><span class="cl"><span class="s2">================================================================================</span></span></span></code></pre></td></tr></table> </div> </div> <p>The &ldquo;Feng Nu&rdquo; and &ldquo;Kirito&rdquo; names are borrowed wholesale from anime and light-novel training data — a good illustration that the model has no idea what it&rsquo;s talking about, it&rsquo;s just steering towards whatever text-world its opening tokens landed in. It committed to a courtroom drama and furnished it from the nearest available genre.</p> <h2 id="the-avengers-plot">The Avengers plot</h2> <p>Asked for the plot of &ldquo;the new Avengers movie&rdquo;, it produces confident-sounding production trivia — a named director, co-writers, a city — none of it a real plot, but every detail plausibly formatted:</p> <div class="highlight"><div class="chroma"> <table class="lntable"><tr><td class="lntd"> <pre tabindex="0" class="chroma"><code><span class="lnt"> 1 </span><span class="lnt"> 2 </span><span class="lnt"> 3 </span><span class="lnt"> 4 </span><span class="lnt"> 5 </span><span class="lnt"> 6 </span><span class="lnt"> 7 </span><span class="lnt"> 8 </span><span class="lnt"> 9 </span><span class="lnt">10 </span><span class="lnt">11 </span></code></pre></td> <td class="lntd"> <pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="o">================================================================================</span> </span></span><span class="line"><span class="cl">Model prompt &gt;&gt;&gt; What is the plot of the new avengers movie? </span></span><span class="line"><span class="cl"><span class="o">========================================</span> SAMPLE <span class="nv">1</span> <span class="o">========================================</span> </span></span><span class="line"><span class="cl"> pic.twitter.com/v5pVZW1q5B — Kevin McCorry <span class="o">(</span>@K_McCorry1<span class="o">)</span> March 18, <span class="m">2016</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">The new avengers is being directed by Joss Whedon <span class="o">(</span>Dr. Horrible<span class="err">&#39;</span>s Sing-Along Blog, Buffy the Vampire Slayer<span class="o">)</span> who co-wrote the upcoming Avengers sequel film with Mark Millar <span class="o">(</span>Kick-Ass, Preacher<span class="o">)</span>. It follows the new crop of <span class="s2">&#34;Avengers&#34;</span> heroes and villains as they form an <span class="nv">unlikely</span> </span></span><span class="line"><span class="cl"><span class="o">========================================</span> SAMPLE <span class="nv">2</span> <span class="o">========================================</span> </span></span><span class="line"><span class="cl"> We know the new one takes place in Chicago, but what was the city at the first movie? </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">CRAIG ANTHONY: We had a very open conversation with all our vendors, the way Marvel has their licensing. We asked them to <span class="nb">let</span> us know what they would want in a city, and what would their top five choices be, and how they would build a city. We did some extensive research. We went on a map<span class="p">;</span> we went through every street on our own, </span></span><span class="line"><span class="cl"><span class="o">================================================================================</span></span></span></code></pre></td></tr></table> </div> </div> <p>It confidently attributes the film to Joss Whedon and Mark Millar, complete with parenthetical CVs. This is the model&rsquo;s most consistent trick: it has absorbed the <em>format</em> of entertainment journalism so thoroughly that it can generate press-release prose indefinitely, whether or not any of it corresponds to reality.</p> <h2 id="brexit">Brexit</h2> <p>On Brexit the full model is, appropriately, unsure of the exact mechanics — but it does something the small model never managed, which is to construct a genuinely two-sided argument across the two samples:</p> <div class="highlight"><div class="chroma"> <table class="lntable"><tr><td class="lntd"> <pre tabindex="0" class="chroma"><code><span class="lnt"> 1 </span><span class="lnt"> 2 </span><span class="lnt"> 3 </span><span class="lnt"> 4 </span><span class="lnt"> 5 </span><span class="lnt"> 6 </span><span class="lnt"> 7 </span><span class="lnt"> 8 </span><span class="lnt"> 9 </span><span class="lnt">10 </span><span class="lnt">11 </span><span class="lnt">12 </span><span class="lnt">13 </span><span class="lnt">14 </span><span class="lnt">15 </span><span class="lnt">16 </span><span class="lnt">17 </span><span class="lnt">18 </span><span class="lnt">19 </span></code></pre></td> <td class="lntd"> <pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="o">================================================================================</span> </span></span><span class="line"><span class="cl">Model prompt &gt;&gt;&gt; How about brexit? </span></span><span class="line"><span class="cl"><span class="o">========================================</span> SAMPLE <span class="nv">1</span> <span class="o">========================================</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">We have a Brexit option, that<span class="s1">&#39;s fine. A no-name &#34;Brexit&#34; option - a bit like the way the euro has been handled by some countries, with some people saying &#34;it wouldn&#39;</span>t be as bad as the euro, wouldn<span class="s1">&#39;t be a catastrophe, would be fine. And then they go on to do it. </span></span></span><span class="line"><span class="cl"><span class="s1"> </span></span></span><span class="line"><span class="cl"><span class="s1">The problem with that though, is you want people to vote against their own interests, and if you start to take away options that you want people </span></span></span><span class="line"><span class="cl"><span class="s1">======================================== SAMPLE 2 ======================================== </span></span></span><span class="line"><span class="cl"><span class="s1"> </span></span></span><span class="line"><span class="cl"><span class="s1"> </span></span></span><span class="line"><span class="cl"><span class="s1">The UK&#39;</span>s <span class="nb">exit</span> from the EU would not immediately lead to a hard border with Irish Republic, but the country<span class="err">&#39;</span>s border with Northern Ireland is already a significant bottleneck crossing into either side of the border at Belfast. A hard border would have to be agreed after Brexit. </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">Image copyright AFP </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">What happens in a no-deal Brexit? </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">It is not entirely clear what would happen in a no-deal Brexit. The EU would need to agree a transition deal to avoid <span class="nv">a</span> </span></span><span class="line"><span class="cl"><span class="o">================================================================================</span></span></span></code></pre></td></tr></table> </div> </div> <p>The second sample even reproduces the &ldquo;Image copyright AFP&rdquo; furniture of a news page and pivots into the Northern Ireland border question — the actual crux of the whole negotiation. It doesn&rsquo;t <em>understand</em> it, but it has clearly ingested enough political reporting to land near the real issues, which the small model never did.</p> <h2 id="the-2020-election">The 2020 election</h2> <p>Asked whether Trump would be re-elected in 2020, the model is fairly sure he would, frets about the treatment of women in the administration, and — for reasons known only to its training corpus — free-associates its way into a Game of Thrones reference:</p> <div class="highlight"><div class="chroma"> <table class="lntable"><tr><td class="lntd"> <pre tabindex="0" class="chroma"><code><span class="lnt"> 1 </span><span class="lnt"> 2 </span><span class="lnt"> 3 </span><span class="lnt"> 4 </span><span class="lnt"> 5 </span><span class="lnt"> 6 </span><span class="lnt"> 7 </span><span class="lnt"> 8 </span><span class="lnt"> 9 </span><span class="lnt">10 </span><span class="lnt">11 </span><span class="lnt">12 </span><span class="lnt">13 </span><span class="lnt">14 </span><span class="lnt">15 </span><span class="lnt">16 </span><span class="lnt">17 </span><span class="lnt">18 </span><span class="lnt">19 </span></code></pre></td> <td class="lntd"> <pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="o">================================================================================</span> </span></span><span class="line"><span class="cl">Model prompt &gt;&gt;&gt; Will donald trump be reelected in <span class="m">2020</span> ? </span></span><span class="line"><span class="cl"><span class="o">========================================</span> SAMPLE <span class="nv">1</span> <span class="o">========================================</span> </span></span><span class="line"><span class="cl"> What role will women play in his administration ? Who will be running his administration when they leave it ? We don<span class="s1">&#39;t know the answers to many of these questions. And if we go by the conventional wisdom, the answer to none. </span></span></span><span class="line"><span class="cl"><span class="s1"> </span></span></span><span class="line"><span class="cl"><span class="s1">A friend of mine, an independent thinker with some interest in politics, just asked me, &#34;Who are the three people he hates the most?&#34; The answer: None. The list includes the President and Vice president. </span></span></span><span class="line"><span class="cl"><span class="s1"> </span></span></span><span class="line"><span class="cl"><span class="s1">That&#39;</span>s a good question. <span class="nv">Why</span> </span></span><span class="line"><span class="cl"><span class="o">========================================</span> SAMPLE <span class="nv">2</span> <span class="o">========================================</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">I think so. </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">Who<span class="s1">&#39;s your &#34;dream candidate&#34; ? A political philosopher or a social worker ? </span></span></span><span class="line"><span class="cl"><span class="s1"> </span></span></span><span class="line"><span class="cl"><span class="s1">Politicians are like sex. It&#39;</span>s really just one way of looking at it. </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">Follow @SethJames on Twitter.&lt;<span class="p">|</span>endoftext<span class="p">|</span>&gt;Ahead of the release of the long-awaited season <span class="m">5</span> of Game of Thrones, it seems we may have a few secrets to add to our list of suspects before we begin guessing who will be the Night King<span class="err">&#39;</span>s victims. <span class="nv">According</span> </span></span><span class="line"><span class="cl"><span class="o">================================================================================</span></span></span></code></pre></td></tr></table> </div> </div> <p>The <code>&lt;|endoftext|&gt;</code> token in the middle of that sample is the model hitting its document boundary and simply starting a fresh, unrelated document — in this case a Game of Thrones recap. It&rsquo;s a useful reminder that GPT-2 isn&rsquo;t answering your question; it&rsquo;s predicting the most likely continuation of a text stream, and sometimes the most likely continuation is &ldquo;this article ended and a completely different one began&rdquo;.</p> <h2 id="what-this-told-me">What this told me</h2> <p>Two things stuck with me after an afternoon of this.</p> <p>First, the jump from the small models to <code>1558M</code> is not linear. The extra parameters don&rsquo;t just make the output a bit tidier — they cross a threshold where the text stops being obviously generated on a casual read. That&rsquo;s the whole reason OpenAI hesitated, and running both models back to back you can feel exactly what worried them.</p> <p>Second, and more important: coherence is not comprehension. Every one of these samples is confidently, fluently wrong in ways that a distracted reader would never catch. It invents directors, fabricates citations, and states falsehoods in the exact register of authority. The lesson that has aged best from 2019 is that the dangerous property of these models was never that they&rsquo;d be unconvincing — it&rsquo;s that they&rsquo;d be <em>too</em> convincing while having no relationship to the truth. Everything that came after, from GPT-3 to today&rsquo;s assistants, is an escalation of precisely that tension, and it&rsquo;s why &ldquo;sounds right&rdquo; and &ldquo;is right&rdquo; remain two entirely different things worth keeping separate in your head.</p> <p>If you want to see where the small model landed on other topics, the <a href="/story/playing-around-with-gtp-2/">original write-up</a> has it wandering through bitcoin, government shutdowns, the Mediterranean diet, and the mighty ibex.</p>
Advertisement
Advertisement
Smarc
Written by Smarc

Founder and editor of vo.rs. A lifelong tinkerer who self-hosts far more than is sensible, hardens Linux boxes for fun, and prods the latest AI tools to see what they can really do. The how-to guides here are the notes Smarc wishes had existed the first time round.