nishtha711 commited on
Commit
271552a
·
verified ·
1 Parent(s): 9597e2e

Delete BLOG_POST_DRAFT.md

Browse files
Files changed (1) hide show
  1. BLOG_POST_DRAFT.md +0 -106
BLOG_POST_DRAFT.md DELETED
@@ -1,106 +0,0 @@
1
- ---
2
- title: "Tiny Civilization: Building a Persistent Woodland Newspaper with a 1.5B Model"
3
- tags: [build-small-hackathon, gradio, qwen, simulation, creative-ai]
4
- ---
5
-
6
- # Tiny Civilization: Building a Persistent Woodland Newspaper with a 1.5B Model
7
-
8
- *A Build Small Hackathon field report — Thousand Token Wood track.*
9
-
10
- **Try it first:** [Tiny Civilization on Hugging Face Spaces](https://huggingface.co/spaces/build-small-hackathon/tiny-civilization) · [Agent Traces](https://huggingface.co/datasets/build-small-hackathon/tiny-civilization-traces)
11
-
12
- ---
13
-
14
- Every day in Tinywick Hollow, four woodland creatures do something absurd. Reginald Fox forges a certificate. Beatrice Badger issues a decree. Cornelius Squirrel invents something that almost works. Millicent Mole observes, obliquely, that something is already happening underground.
15
-
16
- Then *The Tinywick Hollow Gazette* covers it all with the utmost journalistic gravity.
17
-
18
- I built **Tiny Civilization** for the Build Small Hackathon. It is a persistent narrative simulation: four AI agents — each with a distinct persona — generate daily events, and a fifth narrator agent writes a full newspaper front page treating everything with pompous seriousness. You read the paper, nudge the story (spread a rumour, donate a suspicious mushroom, propose a law), and the civilization accumulates history across sessions in a SQLite database.
19
-
20
- The whole thing runs on **Qwen2.5-1.5B-Instruct**. 1.5 billion parameters. Qualifies for the ≤4B Tiny Titan category. No external APIs. Fully local on ZeroGPU.
21
-
22
- ---
23
-
24
- ## Why a newspaper?
25
-
26
- Most multi-agent simulations show you numbers: prices, scores, wealth distributions. I wanted to show you *stories*. A newspaper is a machine for turning events into narrative with stakes. The formal journalistic register — "In a development that surprised absolutely no one who knows these four..." — makes even the most trivial event feel significant.
27
-
28
- The newspaper format also solves a small-model problem: instead of asking the model to reason about emergent economic dynamics (hard for 1.5B), I ask it to write two sentences in a character's voice (easy), then one paragraph in a pompous journalistic style (easy). Small models are excellent format generators and unreliable reasoners. Design to their strengths.
29
-
30
- ---
31
-
32
- ## Architecture: five calls, one day
33
-
34
- Each day advancement makes exactly **five LLM calls**:
35
-
36
- ```
37
- advance_day()
38
- ├─ call_agent("fox", trade_prompt) → ~80 tokens
39
- ├─ call_agent("badger", gossip_prompt) → ~80 tokens
40
- ├─ call_agent("squirrel",invention_prompt) → ~80 tokens
41
- └─ _generate_newspaper(events_summary) → ~280 tokens
42
- ```
43
-
44
- Total per day: **~520 tokens across 4 calls** (after moving from 3 events + weather to a single structured newspaper call). On a T4 GPU, 1.5B at ~50 tok/s completes in under 15 seconds. That fits comfortably within ZeroGPU's 120-second window.
45
-
46
- The newspaper call uses a rigid output format:
47
-
48
- ```
49
- HEADLINE IN ALL CAPS
50
-
51
- Pompous article paragraph (3-4 sentences).
52
-
53
- WEATHER: One absurd one-line forecast.
54
- FOX: One line about the fox's day.
55
- BADGER: One line about the badger's day.
56
- SQUIRREL: One line about the squirrel's day.
57
- MOLE: One cryptic line.
58
- ```
59
-
60
- 1.5B honours this format ~85% of the time. The parser is tolerant: it finds the first all-caps line as the headline, then extracts labelled sections by prefix, and falls back gracefully when sections are missing. A bad output degrades to a slightly sparse front page — never a crash.
61
-
62
- ---
63
-
64
- ## Persistence and history
65
-
66
- The simulation stores everything in SQLite: every day, every event, every nudge, every creature's relationship scores and inventory. The `days` table becomes the newspaper archive. On restart, the civilization picks up exactly where it left off.
67
-
68
- More importantly: past content influences future content. The newspaper prompt includes the last two headlines, so the model can write "In a development reminiscent of last Tuesday's acorn scandal..." without any extra machinery. History accumulates naturally through the context window.
69
-
70
- Creature relationship scores drift based on event type (trade: +5, feud: −10, invention: +7) and feed back into agent prompts: a fox with a relationship score of 12 with the badger gets a different prompt than a fox at 88. The creatures' inventories grow as players donate items. A "map to somewhere that may not exist" donated to Millicent Mole will appear in her prompt next time she acts.
71
-
72
- ---
73
-
74
- ## What I learned about 1.5B models
75
-
76
- **Format adherence is the game.** A 1.5B model will follow a clear, demonstrated format with high reliability. Give it a schema, not a vague instruction. `WEATHER: [one sentence]` works far better than `include an absurd weather note`.
77
-
78
- **Persona injection works at 1.5B.** The four creatures have distinct voices that survive even the smallest model. Cornelius Squirrel really does use exclamation points and repeat himself. Beatrice Badger really is gruff and declarative. Character consistency emerged from 3-4 sentences of persona description — no fine-tuning needed.
79
-
80
- **Fail loudly into fallbacks, not silently into wrong output.** Every LLM call is wrapped: if the response is empty or malformed, the simulation generates a plausible fallback ("The printing press has jammed") rather than surfacing an opaque API error. The experience degrades gracefully.
81
-
82
- **Don't fight the model's weaknesses.** I originally asked the model to reason about which creature would be *most affected* by a nudge. The outputs were random. I switched to pre-computing the target and asking the model to react — suddenly the responses were coherent. Push reasoning into your code; ask the model for language.
83
-
84
- ---
85
-
86
- ## The newspaper as UI
87
-
88
- The Gradio app is built to look like a physical newspaper. Every element — the UnifrakturMaguntia masthead font, the double-border, the two-column article layout, the "In Brief" sidebar, the classifieds footer — is CSS. No Gradio default styling survives. The `@import url(Google Fonts)` at the top of the CSS block does a lot of work.
89
-
90
- The result is a front page that wants to be screenshot and shared. The "Share as Image" button renders the current edition as a PIL image with the same layout, ready for posting.
91
-
92
- The Konami Code (↑↑↓↓←→←→BA) reveals all four agent system prompts and the narrator prompt in a modal — a small prize for curious judges.
93
-
94
- ---
95
-
96
- ## What's next
97
-
98
- The civilization is eight days old as I write this. The fox's relationship with the badger has deteriorated to 18 (Sworn Enemies ⚔️). Cornelius Squirrel recently donated a "map to somewhere that may not exist" and it has appeared in three subsequent headlines. A law proposing that "mushrooms are sacred" passed on Day 4 and keeps surfacing in the Gazette's coverage.
99
-
100
- Small models, persistent worlds, big headlines.
101
-
102
- *Try it: [huggingface.co/spaces/build-small-hackathon/tiny-civilization](https://huggingface.co/spaces/build-small-hackathon/tiny-civilization)*
103
-
104
- ---
105
-
106
- *Agent traces for every event generated during development are available at [huggingface.co/datasets/build-small-hackathon/tiny-civilization-traces](https://huggingface.co/datasets/build-small-hackathon/tiny-civilization-traces). Each row contains the full agent prompt, raw model response, and parsed output.*