Llama Village, where five llamas share a world without sharing everything they know.
Pip’s red scarf is missing. Mo knows where it is. He also knows how it got there—and would rather keep that part to himself.
That gives the village a small mystery. It gives the game a harder question: when two llamas talk, what should the listener actually learn?
I introduced the game in Llama Village: a virtual world powered by local AI with llamadart. Here, we will follow one part of its machinery: local embeddings help compare what a llama said with facts that might have been shared.
The destination is a change you can inspect: a llama acquires information, the game records who told them, and they may still doubt it. Dialogue, embeddings, and game rules each have a different job.
The game stores the scarf’s location and Mo’s accident as separate facts. At the start, Mo knows both. Knowing where the scarf is does not automatically mean knowing who knocked it into the pond.
Before checking a conversation, the game narrows the possibilities: facts the speaker knows and the listener does not. It compares each fact with that speaker’s lines, not every line from both characters.
An embedding model has learned text representations from training data. It maps each line and fact to a numeric vector; cosine similarity compares those vectors. Similar wording and related meaning can bring vectors closer, but the score is not a yes/no test for identical meaning, truth, or whether a statement implies a fact. The game uses each fact’s highest similarity across the speaker’s lines.
AI-generated overview: compare meaning, check evidence, then record who said it. A conceptual illustration, not a captured game trace.
The implementation uses EmbeddingGemma through llamadart and caches vectors by text. It applies title: none | text: to both lines and facts. This walkthrough reproduces that game choice. Google’s model card recommends task-specific prefixes for new applications, including a sentence-similarity query prompt; changing the format requires reevaluating the scores and thresholds.
June and Bramble talking about poems in a recorded playthrough. This shows the dialogue system, not the scarf exchange illustrated below.
For a small walkthrough, compare the stored fact “Pip’s red scarf is lying in the pond reeds” with the illustrative line “I saw Pip’s scarf tangled in the reeds by the pond.” They describe related information using different words. The line is written for this explanation, not quoted from the recording.
The input is text. The embedding output is a numeric vector. The application then calculates a similarity score; the model does not return “June learned the scarf’s location.” That decision comes later.
Keep the same embedding model and compatible settings for both texts. Equal vector lengths alone do not guarantee compatible representations.
With a suitable embedding engine loaded, the core calls look like this. The full loading and comparison example is at the end.
The game’s configured embedding artifact is embeddinggemma-300M-Q80.gguf. For another model, follow its input-format requirements. The llamadart embedding guide covers loading, backend support, and input limits.
For normalized vectors, a dot product gives cosine similarity. In the game, keyword evidence adds a ranking bonus of 0.3, and the best six candidates go to the outcome model. These are game-specific choices, not standard embedding thresholds.
I ran the companion example using published llamadart 0.11.0 and the local embeddinggemma-300M-Q80.gguf artifact on macOS arm64. It returned 768-dimensional vectors. Here are selected cosine similarities from that run; these are illustrative inputs run through the real model, not dialogue captured during gameplay.
