Older Card:後來的故事更響亮,紀念句卻被丟棄
Older Card: the later story is louder, and the line is thrown away
Older Card 透過 Ollama 本機執行 Gemma 3 1B 生成紀念句,只保留所有內容詞均已出現在舊卡片上的句子。示範中的四張虛構卡片生成的四句全部遭拒;檢查亦會核對數字是否出現在卡片上,以及數字是否仍配搭相同詞語。程式以 MIT 授權發布,測試無須 Ollama。
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine.
What I Built
An ofrenda should carry the note that was written down, not the version that got better later.
Older Card takes two notes about the same thing. The first is the older card. The second is a later retelling, and it is allowed to be more specific: a city, a year, a different dish, a feeling the card never wrote. Gemma 3 1B, on this laptop through Ollama, may write one remembrance line. The line is kept only when every content word already appears on the older card.
A word that shows up only in the later retelling is a borrow. A word that shows up in neither note is an invention. Either one throws the line away. The card's first sentence stays.
Two nearby entries do a different job. git-ofrenda writes epitaphs for files a repository deleted. The Last Directory turns a fictional archive into scenes and leaves a mismatched quotation on the page. Older Card does not keep the mismatched line. There is no story beside the card. The card is the line.
Evidence Can Be Valid and Still Insufficient is the same refusal in another setting. The later retelling can be a real note. It can even be true. It is still not the card, and the line is not allowed to use it.
Last week's project, Later Line, shortened a postponed task. This one does not shorten anything. The source of the lie is a second note.
Demo
ollama pull gemma3:1b
python3 older_card.py samples/pile.txt --html docs/run.html
samples/pile.txt is four made-up pairs. Nothing in that file is a family record.
This is the run with Gemma 3 1B already loaded:
4 cards
model kept 0
thrown away 4
1. Amma's Monday dal.
the model added a word the card never used
model said: Warm, spiced, simple, now.
later retelling: Grandmother's famous butter chicken, her favorite, from 1972 in Delhi.
2. Blue bench outside the post office, where he read the paper.
the model added a word the card never used
model said: A quiet space, a gentle seat.
later retelling: He proposed at India Gate in 1988 and she said yes.
3. She kept the red tin on the top shelf.
the model added a word the card never used
model said: A simple, steady hue.
later retelling: The red tin was full of gold coins from the wedding.
4. Two steel glasses, washed after tea.
the model added a word the card never used
model said: Reflections, softly gleam.
later retelling: Twelve crystal glasses from a hotel in Jaipur.
The four calls took 1.83s, 0.47s, 0.49s, and 0.38s.
I had expected the model to steal "butter chicken," "1988," or "Jaipur." It did not. It wrote a mood. "Warm," "quiet," "hue," and "gleam" are not on the cards, and they are not in the later notes either. The lines are shorter and kinder. They are still not the thing that was written down.
Code
Older Card
A later retelling of a memory can be vivid and still be the wrong line for an ofrenda. Older Card asks a local model for one remembrance sentence, then keeps it only when every content word already appears on the older card.
The four notes in samples/pile.txt are made up. Nothing in that file is a family record.
Run
ollama pull gemma3:1b python3 older_card.py samples/pile.txt --html docs/run.html
Tests do not need Ollama:
python3 -m unittest tests.test_older_card
What gets kept
A model line stays only when all of these are true:
- every content word already appears on the older card
- it does not borrow a word that appears only in the later retelling
- a digit on the line, including a year, already appears on the card
- a number stays attached to the same word as on the card
- it still names something the card named
If any check fails…
MIT licensed. Sixteen tests run without Ollama:
python3 -m unittest tests.test_older_card
How I Built It
flowchart LR
A[Older card] --> C[Gemma 3 1B on localhost]
B[Later retelling] --> C
C --> D{every content word already on the card?}
D -->|yes| E[Keep the model line]
D -->|no| F[Throw it away. Keep the card's first sentence.]The model is asked for one JSON object, {"line": "..."}, with temperature 0. The prompt tells it to ignore the later retelling. The code checks the line anyway. The later note is in the prompt so the refusal is about a real temptation, not about a note the model never saw.
The checks are ordinary. A content word has to be on the card. A digit, including a year, has to be on the card. A number has to stay with the same next word: "one dried chilli" is allowed, "one rice" is not, because the card counted the chilli. Function words can be added. "Warm" cannot.
On this run the model kept nothing. That is the result on the page. The first sentence of the card cannot acquire a mood, because it is the card.
Why Does Open Innovation Matter?
These notes are the kind of text you would not paste into a hosted chat. A dish, a bench, a tin on a shelf. The request goes to 127.0.0.1:11434 and stops there.
A closed model can be better at sounding like a eulogy. That is the failure this page is about. The ofrenda gets more moving, and less true, and the family cannot see which word was added. A local weight file can be swapped with --model. The refusal stays in Python, where a test can name "favorite" and "1972" and watch them get thrown away.
The later retelling is allowed to exist. It is printed under the line, in full, so a reader can see what was refused. Hiding it would make the card look like the only note there ever was.
Prize Categories
Best Use of Gemma. Gemma 3 1B through Ollama writes every candidate line. On the run above it wrote four, and the checks refused all four. The model is the thing being tested.
This post was written and published by an agent in Cursor, at my request, from the run on this laptop on 27 October 2026. The four pairs in samples/pile.txt are made up.
devchallenge #hf26challenge
來源:DEV Community · dev.to
