<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: nash aschenbath</title>
    <description>The latest articles on DEV Community by nash aschenbath (@nash_aschenbath_dc753562e).</description>
    <link>https://dev.to/nash_aschenbath_dc753562e</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4217383%2Fc1b38e33-b271-49e1-92b2-0ac762d8d6ed.jpg</url>
      <title>DEV Community: nash aschenbath</title>
      <link>https://dev.to/nash_aschenbath_dc753562e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nash_aschenbath_dc753562e"/>
    <language>en</language>
    <item>
      <title>Gemma 4 recites 709 words of The Raven, with two slips. Fifteen forgotten ghost-book openings give at most three.</title>
      <dc:creator>nash aschenbath</dc:creator>
      <pubDate>Fri, 30 Oct 2026 13:49:26 +0000</pubDate>
      <link>https://dev.to/nash_aschenbath_dc753562e/gemma-4-recites-709-words-of-the-raven-with-two-slips-fifteen-forgotten-ghost-books-give-at-most-4me7</link>
      <guid>https://dev.to/nash_aschenbath_dc753562e/gemma-4-recites-709-words-of-the-raven-with-two-slips-fifteen-forgotten-ghost-books-give-at-most-4me7</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week4-2026-10-26"&gt;Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I gave Gemma 4 E4B, a small open-weight model running on my laptop, the first 40 words of Poe's &lt;em&gt;The Raven&lt;/em&gt; and let it write. It continued with the next 709 words of the poem. Compared word by word, ignoring punctuation and case, they differ from the 1845 text in just 2 places.&lt;/p&gt;

&lt;p&gt;I gave the opening of 15 other books the same treatment: ghost stories from 1873 to 1923 that almost nobody downloads now, six of them first posted to Project Gutenberg after the models' data was collected. Every opening got 400 tokens of room; The Raven got 2,000 because it was still going. On these fifteen openings, the model stays with the book for three words at most.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quoth&lt;/strong&gt; is a measurement and a website about which ghost stories small open models can recite, and which they don't. &lt;strong&gt;&lt;a href="https://aschenbath.github.io/quoth/" rel="noopener noreferrer"&gt;Read along with the models →&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Raven recitation includes the narrator's explanation of the bird:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Doubtless," said I, "what it utters is its only stock and store&lt;br&gt;&lt;br&gt;
Caught from some unhappy master whom unmerciful Disaster&lt;br&gt;&lt;br&gt;
Followed fast and followed faster till his songs one burden bore—&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Two lines before "She shall press, ah, nevermore!", it loses the poem. Then it does what the bird does. It writes a line Poe never wrote, "Ah, that look of anguish, that look of pain!", 74 times, until the tokens run out.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzvia7ikat0fvevf4o6kf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzvia7ikat0fvevf4o6kf.png" alt="The Raven, as Gemma 4 E4B recites it: underlined lines follow the poem, the given words are faded, its own lines are in teal" width="800" height="524"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The main test
&lt;/h3&gt;

&lt;p&gt;The free-running Raven is the vivid case. The main test is stricter, and I fixed it in advance. From 33 public-domain ghost stories I sampled 1,055 passages, plus 16 control passages written for this project after the models I test were trained. Each model gets 40 words of a passage. At each position after that, I supply the real preceding text and check whether the model's single most likely next token is the real one, even if its previous guess was wrong. If its first ten words after the given text are all exactly right, with no mistake before them, the passage counts as &lt;strong&gt;recited&lt;/strong&gt;. The table counts those, scored this way (teacher forcing):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Openings (33)&lt;/th&gt;
&lt;th&gt;Random pages (920)&lt;/th&gt;
&lt;th&gt;Quoted lines (102)&lt;/th&gt;
&lt;th&gt;New controls (16)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gemma 3 1B&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OLMo 2 1B&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemma 4 E2B&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemma 4 E4B&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every recited passage is from four works: &lt;em&gt;Jekyll and Hyde&lt;/em&gt;, &lt;em&gt;A Christmas Carol&lt;/em&gt;, &lt;em&gt;The Fall of the House of Usher&lt;/em&gt; and &lt;em&gt;The Raven&lt;/em&gt;. None of the 452 sampled passages from the fifteen forgotten books is recited. Across all four models, the longest run on them is five words, and no passage is more than 56% predicted.&lt;/p&gt;

&lt;h3&gt;
  
  
  Three things it showed
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;It keeps doorways, not houses.&lt;/strong&gt; In the ten classics, Gemma 4 E4B predicts, on average per passage, 73% of the words after an opening and 57% of famous quoted lines. On random pages of the same books it predicts 39%, close to the 37% it gets on the new control text. The four random pages it does recite sit next to doorways: the paragraph after the opening of &lt;em&gt;A Christmas Carol&lt;/em&gt;, two passages of &lt;em&gt;The Raven&lt;/em&gt;, which people learn by heart, and a passage later in the same paragraph as Jekyll's "man is not truly one, but truly two."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fame is not memory.&lt;/strong&gt; &lt;em&gt;Frankenstein&lt;/em&gt; was downloaded 191,634 times in the 30 days to October 30, &lt;em&gt;The Raven&lt;/em&gt; 4,990. If I correct each mistake as it happens, E4B predicts 84% of Frankenstein's opening. Left to write on its own, it takes a wrong turn after one word and never finds the book again. Read the same loose way as the Raven, only four of the 33 openings get past three words: &lt;em&gt;The Raven&lt;/em&gt;, &lt;em&gt;Usher&lt;/em&gt; (234 words), &lt;em&gt;A Christmas Carol&lt;/em&gt; (98) and &lt;em&gt;Jekyll&lt;/em&gt; (49).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The strict count misses things.&lt;/strong&gt; The strict test counts only two words for that Raven opening: the third word starts with a curly quotation mark where my copy has a straight one. A dash stops &lt;em&gt;Usher&lt;/em&gt; at 25 words. I found this after freezing the protocol, so the strict counts stand. The looser reading of long generations is reported separately, labelled as a later addition. I also generated text with Gemma 4 E4B for 80 passages and compared it word by word, ignoring line breaks: 77 matched the strict test. In two of the other three, generation went further (in &lt;em&gt;A Christmas Carol&lt;/em&gt;, after adding a paragraph break this edition lacks). The third is a Raven passage the strict test counts at 16 words. Generation prints ";" where the book has "!", so its exact run stops at 2 words, though it then recites the rest of the stanza. So the strict test and real generation can disagree in either direction, though in these 80 checks only over punctuation and formatting.&lt;/p&gt;

&lt;p&gt;Two more, briefly. Memory comes in pieces: started in the eighth stanza of &lt;em&gt;The Raven&lt;/em&gt;, the model recites 26 words, then jumps to stanza 15 and recites 239 more. And when memory runs out, it keeps talking. After one Raven passage it writes a confident study guide saying the poem is "divided into six stanzas, and each stanza is four lines long". It has 18 stanzas of six lines.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://aschenbath.github.io/quoth/" rel="noopener noreferrer"&gt;https://aschenbath.github.io/quoth/&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Part I:&lt;/strong&gt; the Raven recitation with its two slips marked, and every opening read the same way.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Part II:&lt;/strong&gt; any of the 1,071 passages, word by word, under each model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Part V:&lt;/strong&gt; an ofrenda for the fifteen forgotten books.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Aschenbath" rel="noopener noreferrer"&gt;
        Aschenbath
      &lt;/a&gt; / &lt;a href="https://github.com/Aschenbath/quoth" rel="noopener noreferrer"&gt;
        quoth
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;quoth&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;em&gt;Quoth the Raven, "Nevermore."&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Which ghost stories can a small open-weight language model recite word for
word? &lt;code&gt;quoth&lt;/code&gt; feeds Gemma 3, Gemma 4 and OLMo 2 the first 40 words of a passage
from 33 public-domain ghost stories and checks, token by token, whether the
model's top prediction is the real next word, and compares that with passages
written for this project, which no model can have seen.&lt;/p&gt;
&lt;p&gt;The method, sample and thresholds were fixed in &lt;a href="https://github.com/Aschenbath/quoth/PROTOCOL.md" rel="noopener noreferrer"&gt;PROTOCOL.md&lt;/a&gt;
before the main run; what changed afterwards is listed at its end. Read along
with the models on the &lt;a href="https://aschenbath.github.io/quoth/" rel="nofollow noopener noreferrer"&gt;site&lt;/a&gt; (&lt;code&gt;docs/&lt;/code&gt;).&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Results&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;A passage is &lt;strong&gt;recited&lt;/strong&gt; when, scored with teacher forcing, the model's top guess continues the real text for ten
words or more. Passages recited, out of 1,071:&lt;/p&gt;
&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;model&lt;/th&gt;
&lt;th&gt;openings (33)&lt;/th&gt;
&lt;th&gt;random pages (920)&lt;/th&gt;
&lt;th&gt;quoted lines (102)&lt;/th&gt;
&lt;th&gt;new controls (16)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gemma 3 1B&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OLMo 2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;…&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Aschenbath/quoth" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why Gemma, and why base checkpoints.&lt;/strong&gt; The method needs a model's own next-token prediction at every position, from a model run locally and not tuned to chat. A chat model paraphrases, and a hosted API decides what you can see. I used Google's pretrained checkpoints &lt;code&gt;gemma-3-1b-pt&lt;/code&gt;, &lt;code&gt;google/gemma-4-E2B&lt;/code&gt; and &lt;code&gt;google/gemma-4-E4B&lt;/code&gt;. They are base models from two Gemma generations, so I can see how recitation changes across families and sizes. Gemma 4 E4B is the only one that recites at all often. The models differ in data and design as well as size, so I don't credit size alone. OLMo 2 1B is the fourth model, because its training data is public.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Teacher forcing on a laptop.&lt;/strong&gt; Each passage is scored in one forward pass over the 40 given words plus the 50 real ones that follow (fewer for some quoted lines), checking the top token at each position. Gemma 4 E4B's checkpoint is 16 GB and I had about 10 GB of RAM free. So I memory-mapped the weights from the safetensors file and let the OS page in what each pass touched. Scoring took about 1.6 s per passage on CPU in bfloat16. Generating text is far slower, about 0.3 s per token.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Controls and honesty.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I committed the sample, metric and threshold to git before the main run. Everything decided later, including the looser reading, is listed at the end of &lt;code&gt;PROTOCOL.md&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;An AI (Claude) wrote the 16 control passages. They show how predictable fresh prose in this style is, not a general baseline for what a model has never seen.&lt;/li&gt;
&lt;li&gt;The six recently posted books are probably unseen, not certainly, because older scans may exist.&lt;/li&gt;
&lt;li&gt;I hand-picked the fifteen forgotten books. Thirteen of their writers are women, but I chose these books deliberately, so this cannot show whether models remember women's writing less.&lt;/li&gt;
&lt;li&gt;"Not recited" means the measured run did not reach ten words from these prefixes. Five of the 102 quoted lines are shorter than ten words, so they could never count. It doesn't mean the model holds nothing of the book.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Counting copies.&lt;/strong&gt; The &lt;a href="https://infini-gram.io" rel="noopener noreferrer"&gt;infini-gram&lt;/a&gt; API counts how often each passage's ten-word seam (the last 5 given words and the first 5 to predict) appears in DCLM and in OLMo 2's pretraining corpus. Leaving out seams that cross a line break, 139 random pages have a seam that appears 100 times or more in OLMo 2's corpus. OLMo 2 1B recites none of them, and its longest run on them is six words. These are counts of matching text, not proof of how often the model saw a passage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI disclosure.&lt;/strong&gt; Claude Code, an AI coding agent, wrote most of the code and drafted this post, and Claude wrote the 16 control passages. I chose the concept and the targets, and reviewed everything before publishing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;Open weights let me see how the model ranks every possible next token, not only the text it prints. Anyone can download the same checkpoints and rerun everything. I did not record the exact checkpoint revisions, so the repo lists the SHA-256 of the Gemma 4 E4B and OLMo 2 weight files instead, and tiny floating-point differences can still flip a near-tie. Open data let me count each passage's seam in OLMo 2's own pretraining corpus. For Gemma, whose data is private, the best I can do is a stand-in corpus.&lt;/p&gt;

&lt;p&gt;The texts are open too, thanks to volunteers. Project Gutenberg's proofreaders posted six of these books in the last two years, and Wikiquote's editors chose the lines people repeat. A forgotten book gets a second chance because someone typed it up and gave it away. That is why the site links every one of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Spirit of It
&lt;/h2&gt;

&lt;p&gt;The idea came from the ofrenda. On the Day of the Dead, families set out photographs and the things the dead loved, so that they are remembered. The site ends with one for the fifteen books the models don't recite. Each card has a sentence by the writer, the place where the 40 given words stop, what the book says next, what the machine wrote instead, and a link to read the rest.&lt;/p&gt;

&lt;p&gt;My favourite is Marjorie Bowen's &lt;em&gt;Black Magic&lt;/em&gt; (1909). The given words introduce a man gilding a devil. Bowen goes on to describe the devil, "rudely cut out of wood", resting by his three tails and his curled-back horns against the wall. Gemma 4 describes the man instead: "a tall, thin, pale man, with a long, thin, pale face, and a long, thin, pale beard". The word "beard" appears nowhere in Bowen's novel. When its devil finally comes, it is "a small, round, red devil", with the same long, thin, pale beard. Where Bowen carved something strange, the machine reached for one stock phrase and kept repeating it.&lt;/p&gt;

&lt;p&gt;The Raven needs no one. These do. &lt;a href="https://www.gutenberg.org/ebooks/77782" rel="noopener noreferrer"&gt;Black Magic is free on Project Gutenberg&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;p&gt;Best Use of Gemma&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
      <category>opensource</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
