Dontcryx_07 commited on
Commit
04325ae
·
1 Parent(s): 6e7dc1b
Files changed (1) hide show
  1. difference.md +0 -290
difference.md DELETED
@@ -1,290 +0,0 @@
1
- # Valhalla vs. Stanford's "Generative Agents" — What's Different, and What We Built on Top
2
-
3
- > A plain-language report. No coding background needed.
4
- > It compares our project (Valhalla) against the 2023 Stanford research paper
5
- > "Generative Agents: Interactive Simulacra of Human Behavior" (Park et al.),
6
- > whose demo world was called *Smallville*.
7
-
8
- ---
9
-
10
- ## 1. What both projects are (30 seconds)
11
-
12
- Both projects create **virtual people** — AI characters that live in a simulated
13
- world, plan their day, move around, bump into each other, chat, and remember
14
- what happened. They are built on the same 2023 idea: instead of programming
15
- characters by hand, you give each one a description of who they are and let a
16
- large language model (a chatbot-style AI) make their decisions.
17
-
18
- - **Stanford (the original):** a research paper plus a demo. 25 characters in a
19
- fictional small town called Smallville, drawn as cartoon sprites in a game.
20
- It ran for two in-game days, was watched by 100 human evaluators, and proved
21
- the idea worked.
22
- - **Valhalla (ours):** the same idea, rebuilt as a real product — a running
23
- web simulation of **IIT Ropar campus**, with students who have energy and
24
- moods, a real campus map, real event fests, admin controls, and the ability
25
- to run for days and pick back up from a saved checkpoint.
26
-
27
- The short version: **Stanford built the experiment. We built the machine that
28
- can keep running it.**
29
-
30
- ---
31
-
32
- ## 2. Quick comparison table
33
-
34
- | | Stanford (2023) | Valhalla (ours) |
35
- |---|---|---|
36
- | World | A fictional town (cafe, bar, park, houses) | Real IIT Ropar campus (departments, hostels, library, mess, sports complex) |
37
- | Characters | 25, described in one paragraph each | 12, described with structured student profiles (branch, hostel, hobbies, goals) |
38
- | AI brain | ChatGPT (GPT-3.5) | Google Gemini, with forced structured answers |
39
- | Speed of a day | ~4 real minutes | ~96 real minutes (adjustable, 0.25×–32×) |
40
- | Memory | One ever-growing diary file per character | Per-day diary files + a searchable long-term memory database |
41
- | "Reflection" (deep thinking about past events) | Yes — a headline feature | Not built yet (honest gap, see §8) |
42
- | Day planning | 3-level plan, no checking | 3-level plan with built-in quality checks and retries |
43
- | Can you talk to the characters? | Yes — as yourself, or as a character | Not yet — you watch them; chat is read-only |
44
- | Safety nets | None | Checkpoints, budget limits, health monitoring, admin login |
45
- | Energy/mood | None | Full energy + emotion system with circadian rhythm |
46
-
47
- ---
48
-
49
- ## 3. The seven big architectural differences (the reasoning, not the code)
50
-
51
- ### Difference 1 — Time: a day should feel like a day
52
-
53
- **Stanford** compressed time aggressively. One simulated hour was roughly ten
54
- real seconds, so a whole in-game day passed in about four real minutes. That
55
- was fine for a demo — you could watch a Valentine's Day party unfold in an
56
- evening — but characters never really "lived" a day.
57
-
58
- **Valhalla** runs one real minute of simulation per tick, 1,440 ticks per day
59
- (the same 1,440 minutes every day has). At normal speed a full simulated day
60
- takes about 96 real minutes, and you can slow it down or speed it up live
61
- from the browser. Reasoning: believability at the *scale of a day* — sleeping,
62
- attending classes, mealtimes — only shows up if the day actually lasts.
63
-
64
- ### Difference 2 — The world: fictional town vs. real campus
65
-
66
- **Stanford** authored a toy town: a cafe, a bar, a park, a school, a few houses
67
- and stores. Everything in it was invented for the demo.
68
-
69
- **Valhalla** models **IIT Ropar for real**: 21 locations including the
70
- departments, lecture-hall complex (LHC), Super Academic Block (SAB), library,
71
- six hostels (Brahmaputra, Chenab, Beas, Satluj, Ravi, Jhelum), mess, SAC club
72
- rooms, and sports complex. Each place carries real information a student would
73
- care about: opening hours, sub-areas (e.g. "programming labs" inside the CS
74
- department), capacity, and notes that are explicitly marked **verified** vs.
75
- **assumed** from public sources. Reasoning: a believable campus simulation
76
- should obey campus facts — you can't walk into the mess at 3 a.m. just because
77
- a character feels like it.
78
-
79
- ### Difference 3 — Characters: one paragraph vs. a student profile
80
-
81
- **Stanford** gave each character a single paragraph of prose as their
82
- backstory, and let the AI fill in the rest as it went.
83
-
84
- **Valhalla** gives each character a **structured student profile**: age, branch,
85
- home city, hostel, a "daily plan request" ("skip morning classes, spontaneous
86
- plans"), personality layers (innate / learned / lifestyle), hobbies, goals, and
87
- interests. The tone is deliberately **casual student voice** — the paper itself
88
- complained its AI characters came out "overly polite," so we pushed the other
89
- direction. Reasoning: a profile with structure gives the planner clear
90
- handles ("this person is an Electrical branch student who lives in Ravi
91
- hostel"), and the casual voice makes two students gossiping believable.
92
-
93
- ### Difference 4 — Memory: one big diary vs. a filing cabinet + a search engine
94
-
95
- **Stanford** kept one giant natural-language diary per character (the "memory
96
- stream"), and every memory carried an AI-assigned importance score. When the
97
- character needed to remember something, the system scored all memories by
98
- importance + recency + relevance and picked the best ones. It also had
99
- **reflection**: periodically, the character would "think" about recent events
100
- and write down higher-level insights ("Klaus is dedicated to his research").
101
-
102
- **Valhalla** splits memory in two:
103
-
104
- 1. **Short-term**: a per-day diary file for each character — their plan, what
105
- they did, conversations, an AI-written end-of-day summary.
106
- 2. **Long-term**: a real search engine (a vector database called Qdrant). When
107
- a day ends, its summary and key moments are indexed so future plans can
108
- search for them by meaning. The score used is 65% meaning + 20% importance +
109
- 15% recency (Stanford used equal weights, and decayed recency every tick;
110
- we decay by real days).
111
-
112
- Two practical differences Stanford never had to worry about: **storage limits**
113
- (we prune old, unimportant memories when the database grows too big) and
114
- **diversity** (a conversation from a past day can't crowd out everything else).
115
-
116
- Honest gap: the "reflection" step is **not implemented**. That is the single
117
- biggest piece of the Stanford architecture we deliberately left out of the
118
- current build (it's a documented future step, not a hidden bug).
119
-
120
- ### Difference 5 — Planning: hope-for-the-best vs. check-and-retry
121
-
122
- **Stanford** planned in three levels — day in broad strokes, then hour-sized
123
- chunks, then 5–15 minute actions — and accepted whatever the AI produced. If
124
- the AI wrote a plan with overlapping times or impossible locations, that's
125
- what the character did.
126
-
127
- **Valhalla** wraps the same three-level decomposition in a **quality-control
128
- loop**:
129
-
130
- 1. The AI writes the coarse plan → checked (does it cover the whole day?
131
- does it end at midnight?).
132
- 2. Hourly chunks → checked (do they tile the day with no gaps or overlaps?
133
- do they stay inside their parent block?).
134
- 3. Fine actions → checked (times, locations must exist on campus, the
135
- branch-venue policy — e.g. AIDE lectures belong at the CS department, not
136
- in random buildings — and content safety).
137
-
138
- Any failed check sends the plan back for a rewrite (up to 3 tries). If the AI
139
- still fails, the system installs a small, safe fallback schedule (sleep, then
140
- quiet downtime at a valid location) so a character is never left without a
141
- plan. This is pure engineering the paper never needed for a 2-day demo, and
142
- it's the difference between a simulation that survives day 3 and one that
143
- glitches on day 2.
144
-
145
- ### Difference 6 — "Should I change my plan?" — ask the AI sparingly, not every tick
146
-
147
- **Stanford** consulted the AI at every time step and let it decide whether to
148
- keep going or react. That's the most expensive habit a simulation can have.
149
-
150
- **Valhalla** only asks the AI to reconsider when something actually changed
151
- (an observation is new), and even then only if the character has enough
152
- energy and mood, isn't on cooldown, and the hourly AI budget allows it. The
153
- "react" decision in between is a cheap, no-AI rule. There's also a
154
- deterministic backstop: if a character is ever stuck on the fallback
155
- "Unscheduled downtime" plan, the engine force-triggers a replan of their
156
- remaining day instead of hoping the AI notices. Reasoning: an LLM costs money
157
- and time; a 10,000-tick simulation needs cognition to be an ingredient, not
158
- the whole meal.
159
-
160
- ### Difference 7 — Conversations: one shot vs. word-by-word
161
-
162
- **Stanford** generated dialogue word by word — each sentence was a separate AI
163
- call, and the conversation bounced back and forth for many calls.
164
-
165
- **Valhalla** generates a **whole conversation in a single call**: 4–12
166
- messages with a duration, a sentiment, and explicit effects — how much the
167
- relationship changed (stored in a relationship matrix with scores and tags
168
- like "close-friends" or "friendly-rivalry"), and how each participant's
169
- energy and mood shifted. Reasoning: one call instead of a dozen is ~10×
170
- cheaper, and the effects (relationship, mood) become structured data the
171
- engine can act on instead of text buried in a diary.
172
-
173
- ### Bonus difference — Energy and emotion don't exist in Stanford at all
174
-
175
- The paper's characters had no body. Ours do:
176
-
177
- - **Energy** (0–100%) drains during the day and recovers during sleep.
178
- - **Emotion** (0–100%) sits on a personality-derived baseline and shifts with
179
- events.
180
- - The planner is told the time-of-day rhythm (energy high in the morning,
181
- low near midnight) and writes an **energy target** into every plan action;
182
- the engine gently glides each character toward that target. This is the
183
- mechanism behind believable behavior like "skips morning class because she
184
- stayed up chatting."
185
-
186
- ---
187
-
188
- ## 4. Novel stuff we added — a checklist of things Stanford doesn't have
189
-
190
- | # | Feature | What it is, plainly |
191
- |---|---|---|
192
- | 1 | **Energy & emotion system** | Characters get tired, moods shift; personality baselines; circadian energy targets in every plan (§3, bonus). |
193
- | 2 | **Plan validation + retry + safe fallback** | Every generated plan is checked (times, locations, venue rules, safety) and rewritten up to 3 times before a safe fallback is installed (§3, diff 5). |
194
- | 3 | **LLM cost budget governor** | A rolling one-hour meter on AI calls; when the ceiling is hit, cognition gracefully degrades and the sim keeps running without AI. Protects free-tier API keys. |
195
- | 4 | **Multi-key rotation + circuit breaker** | Several Gemini keys are rotated automatically; if all fail, the sim stops cleanly with instructions to resume from checkpoint instead of crashing mid-tick. |
196
- | 5 | **Structured AI outputs** | The AI must answer in enforced JSON shapes (plan blocks, decisions, conversation schemas), so its output can't corrupt the simulation. |
197
- | 6 | **Checkpoint / resume / rewind** | The whole world is saved every tick. You can stop, resume tomorrow, or rewind hours and replay. Stanford's demo: run it and hope. |
198
- | 7 | **Event calendar** | Real campus fests (Aadvitya open-mic, inter-hostel volleyball, exam-week library) with deterministic attendance — the engine decides attendees by interest + social score, splices the event into their plans, and applies mood/relationship effects afterwards. |
199
- | 8 | **Relationship matrix** | An explicit, directed scorecard between every pair of characters, seeded with curated backstory and updated by every conversation. |
200
- | 9 | **Daily flavor** | Each day starts with a random theme + emotion ("Today's vibe: Motivated, leaning into Sports") so no two days feel scripted. |
201
- | 10 | **Health monitor + debug panel** | The engine watches itself every tick (stalled travel, overdue actions, desyncs) and shows anomalies in the UI. |
202
- | 11 | **Admin login (auth)** | Sim controls (rewind, speed, stop/start, roster edits) are protected by a login; viewers can watch without control. |
203
- | 12 | **Roster management** | Add a new character from a natural-language description (AI generates the profile), rename, or retire them — while stopped. |
204
- | 13 | **Real campus grounding** | Verified place facts (open hours, sub-areas, capacity) and a branch-specific venue policy so classes land in the right buildings. |
205
- | 14 | **Headless CLI + sidecar monitor** | Run the sim without the web UI for automated overnight runs; a separate read-only tool can watch it and write reports. |
206
- | 15 | **Day/night visuals + timeline controls** | The map fades to night by clock time; fast-forward up to 32×; live speed changes. |
207
-
208
- ---
209
-
210
- ## 5. What Stanford has that we don't (yet)
211
-
212
- Be honest — the original paper has a few things this codebase hasn't built:
213
-
214
- 1. **Reflection** — the periodic "think about your life and write insights"
215
- step. We have end-of-day summaries and a rolling 3-day recap instead, but
216
- the deep reflective layer is a documented future step, not implemented.
217
- 2. **Talking to the characters** — in Stanford's demo you could type to a
218
- character (as a reporter, or as their "inner voice") and they'd answer,
219
- remember you, and obey commands. Our UI is read-only: you watch their
220
- conversations live, but there's no chat input. (Several behind-the-scenes
221
- hooks are stubbed for it.)
222
- 3. **World objects** — in Stanford's world you could edit an object's state
223
- ("the stove is burning") and characters would react. Our world has no
224
- interactive objects like stoves or beds.
225
- 4. **Embodied user avatar** — you could join Stanford's town as a walking
226
- character. No equivalent here.
227
- 5. **Formal human evaluation** — the paper ran a 100-evaluator believability
228
- study. We haven't run any formal evaluation, so "how believable is it
229
- really?" is an open question.
230
-
231
- Also small: Stanford showed action emoji above characters' heads (like a
232
- "✍️" while journaling); our map shows a colored dot and the action text for
233
- the character you've clicked.
234
-
235
- ---
236
-
237
- ## 6. The design philosophy difference in one paragraph
238
-
239
- Stanford's paper is a **science experiment**: control the variables, run two
240
- days, measure believability. Everything about it is optimized for that —
241
- small invented world, LLM consulted constantly, no need to survive a crash.
242
-
243
- Valhalla is built for the **opposite problem**: keep a simulation running
244
- for a long time, on a tight API budget, without breaking. That's why we spent
245
- engineering effort on things the paper never considered — quality-checked
246
- plans, cost budgets, checkpoints, health monitoring, structured outputs,
247
- deterministic fallbacks. The paper proved *the idea*; our codebase is
248
- *the attempt to industrialize it*.
249
-
250
- ---
251
-
252
- ## 7. Where the project stands (rough status)
253
-
254
- **Working today:** full day loop (plan → act → move → perceive → chat →
255
- replan), energy/mood simulation, real campus map with pathfinding, live
256
- dashboard, events, relationships, memory (short + long term), checkpoints,
257
- auth, roster tools, headless runs.
258
-
259
- **Known rough edges / notes:**
260
-
261
- - The event calendar has a data bug — one event's date is written as month
262
- "18," so it can never fire — and dates are formatted inconsistently.
263
- - The default AI budget ceiling is off unless configured (protection exists
264
- but is opt-in).
265
- - Long-term memory needs a Qdrant cloud account; without it, memory falls
266
- back to a simpler mode.
267
- - One old planning pipeline (`tick_graph.py`) is a documented leftover — the
268
- live engine doesn't use it. Same for a few disabled features (e.g.
269
- post-conversation replanning).
270
- - Semantic long-term memory is the weakest-link dependency: if it's down,
271
- memory quality drops.
272
-
273
- ---
274
-
275
- ## 8. Sources
276
-
277
- This report is grounded in the actual code, not the README's claims.
278
- Everything above traces to files in `backend/` (engine: `src/core/world_engine.py`;
279
- planner: `src/agents/day_planner.py`; memory: `src/agents/Short_term.py`,
280
- `src/agents/vector_memory.py`; events: `src/core/world_events.py`; budget:
281
- `src/core/budget.py`; checkpoints: `src/core/checkpoint_manager.py`) and the
282
- React UI in `frontend/`, plus the attached paper. Key facts were verified
283
- against file contents (e.g. "no reflection module," "no chat endpoint,"
284
- "no emoji rendering").
285
-
286
- *Scope note: this is a whole-codebase comparison. Every file in the project
287
- was read (55 source files, ~10k lines); the most deeply traced areas are the
288
- simulation engine, the day planner, memory, and the frontend. Confidence on
289
- the "what's different" section is high; the "what's left" section reflects
290
- explicit code evidence (TODOs, disabled flags, dead code) plus judgment.*