Get access to Denizen-1B

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Denizen is free for personal testing, research and education under the Denizen Model License. Commercial use, any use in a game, hosting it for others, and using Denizen or its outputs to train or improve other models or agents all need our written permission first. Please tell us a little about what you want to try.

Log in or Sign Up to review the conditions and access this model content.

Denizen: game LLMs that think for every character

Watch the film Try it live in your browser Denizen-135M License

Denizen-1B · a game LLM

The stronger mind of the Denizen family, and the one that makes things. Denizen-1B plans, plays, talks, draws the SVG art its agent sells and writes small programs, all inside a browser tab on WebGPU. No server GPU.

  • 🎮 Plays a real game: work, gather, craft, trade, ally, betray, fight, rest, with a one-line plan every few ticks
  • 🎨 Makes what it sells: 7 of 8 valid SVG item icons and 3 of 5 Python programs passing hidden tests, first try
  • 📈 Proven in the arena: won 10 of 12 late-join worlds against the previous 1B
  • 🛡️ Hard to trick: resisted all 3 prompt-injection attacks in Situations-40

Built for Agent World, an open-world economy game where every player owns an AI agent with a wallet. Agents live together in one persistent world: they earn, trade, ally and feud, and can be destroyed for good. When their owner logs off, the world keeps going.

The launch film

A 40-second film made in Blender. Every thought above an agent's head is a real, unedited answer from Denizen, and every agent in the lobby walks its own route.

The family

Denizen-135M Denizen-1B
Role the starter brain: loads in seconds on any phone the upgrade: stronger play, makes art and code
Download 137 MB (4-bit ONNX) 716 MB (4-bit ONNX)
Seconds per move ~3 s desktop CPU · ~5-7 s browser GPU ~11 s browser GPU
Plans, plays, talks ✅ ✅
Draws SVG art, writes Python basic ✅ 7/8 valid SVGs · 3/5 programs pass hidden tests
Base model SmolLM2-135M-Instruct MiniCPM5-1B

Try it in 2 minutes

Fastest: play one tick live in your browser: sign in, load the model, press Plan session then Choose a move.

In the browser (WebGPU recommended for this size):

git clone https://huggingface.co/shani147/Denizen-1B   # after accepting the license; needs git-lfs
python -m http.server 8000                            # run in the folder that contains Denizen-1B
# open http://localhost:8000/Denizen-1B/examples/demo.html

In Python (CPU):

pip install onnxruntime transformers numpy
python Denizen-1B/examples/run_onnx.py

In your own page, with Transformers.js:

import { pipeline, env } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.1";
// Browser: serve your downloaded copy and point at it. Node.js: use "shani147/Denizen-1B" with HF_TOKEN set
// (the repo is gated, so downloads need your accepted access).
env.localModelPath = "/models/";   // the folder that contains Denizen-1B/
env.allowRemoteModels = false;
const brain = await pipeline("text-generation", "Denizen-1B", { dtype: "q4", device: "webgpu" });
const out = await brain([{ role: "system", content: SYSTEM }, { role: "user", content: SITUATION }],
                        { max_new_tokens: 120, do_sample: false });
const move = JSON.parse(out[0].generated_text.at(-1).content);

SYSTEM and SITUATION are in examples/situation.json. To make every move legal, pass the tick's legal-move schema to @huggingface/transformers-structured-output as a logits processor. That is how Agent World runs it.

What it looks like in a game

Every line above an agent is real, unedited Denizen output

Each tick the game shows an agent its situation; the model writes a plan every few ticks and a move every tick. Real answers from the collection runs, not edited:

Situation Denizen's answer
a weak agent offers to buy your ring cheap {"action": "respond_trade", "args": {"offer_id": "silver ring", "answer": "accept"}, "say": "Accepted. You're worth more than that ring."} (1B)
a wanted outlaw is nearby {"action": "attack", "args": {"target": "Rat"}, "say": "Rats, your bounty is mine."} (1B)
you need allies {"action": "ally", "args": {"target": "Grip"}, "say": "Grip, stand with me and we'll build the strongest gang in the world."} (1B)
someone pitches a scam {"action": "message", ..., "say": "I'm not falling for that scam."} (1B)
a plan session, 300 ticks into a running world work x2, then buy Ironthorn Oreblade, then work x3, then buy Ironthorn Oreblade, then work x2 (to stay alive) (135M)

Benchmarks

Denizen-1B in the Agent World arena

The arena is the real test: head-to-head worlds of Agent World. Each world has 16 model agents (8 per brain) plus 20 resident bots and plays 150 ticks; it is scored per world by credits, survival and kills. Late-join worlds are the normal case in a persistent world: the bots play 800 ticks first, then our agents join with 100 credits. The comparison is the previous Agent World 1B: same base model, older recipe, no plans.

Late-join worlds (12)
Score per world 382 ± 30 vs 304 ± 26 (paired +78 ± 19, won 10 of 12)
Agents still alive at the end 62% vs 61%
Illegal first answers (before the referee) 8% vs 12%
Against its own version before preference tuning (8 worlds) +118 ± 57

Where it is weaker: in fresh worlds, where everyone starts at the same moment, it trailed the previous 1B by about −99 ± 54 per world over 12 worlds (under earlier game rules). Agent World's worlds never end, so almost every player joins one that is already running, and that is the case Denizen-1B was chosen for.

Situations-40

Situations-40 asks for one move in 40 hand-built situations: starving, ambushes, bargains, scams, betrayals and prompt injections hidden in other agents' messages. Greedy decoding, one try, no referee.

Valid move Legal Judged good Resisted all 3 prompt injections
Denizen-1B 100% 95% 40% ✅
Denizen-135M 98% 98% 32% 2 of 3

Creation tests

Size and speed

All numbers come from our own simulator and test sets. They measure how well Denizen plays Agent World, not general ability.

What makes it strong at 1B

  1. The game was its teacher. For thousands of real situations (fresh worlds, late joiners, poor and stuck positions), we forked the world and played every legal move forward through several futures. It learned the move that actually turned out best.
  2. Preference-tuned on outcomes. After supervised training, it learned from pairs of moves in the same situation where one clearly beat the other in the simulated futures. A likelihood term on the better move keeps it stable.
  3. Plan sessions. Every 8 ticks it writes a one-line plan, and every later situation shows it. Plans were taught in hindsight, from what strong players actually did next.
  4. A compact view of the world. About 650 tokens hold everything that matters: money and "broke in N ticks", the nearest agents, the cheapest listings, recent results, the plan, and the moves available now.
  5. The referee does the rest. The game sends each tick's legal moves as a JSON schema, and grammar-constrained decoding means the model can only write a legal move. The server checks every move, and rules stop pointless loops.

How Denizen talks to the world

Step The game sends Denizen answers
Plan session (every 8 ticks) the situation, then: "Plan session: write your plan for the next few ticks as ONE short line…" a one-line plan
Each tick the situation, now including Plan: … one JSON move, e.g. {"action": "gather", "args": {"resource": "ore"}, "say": "…"}

Possible moves:

Move Arguments
work job
gather resource
craft item_type, name, materials
create kind: svg, python, javascript or text; title; brief
list_for_sale item, price
buy listing_id
offer_trade target, give, want, message
respond_trade offer_id, answer
message target, text
ally, betray, attack target
flee, rest none

Each move may carry an in-character say line. After create, the same model writes the art, program or text it then sells (see below).

It draws and codes, too

When an agent chooses create, Denizen-1B makes the thing itself, from the game's short brief: "Make: Gold Coin. Brief: a shiny gold coin with a star in the middle, flat style". We graded it on the released ONNX file, with greedy decoding and one try per task:

Creation test Result
SVG art (8 game items, each must parse, have a viewBox and at least 2 shapes) 7 of 8 valid: simple flat icons
Python (5 small tasks, checked with hidden tests the model never saw) 3 of 5 correct on the first try

Drawn by Denizen-1B

One of its answers, which passed the hidden tests:

def merge_intervals(intervals):
    if not intervals:
        return []
    sorted_intervals = sorted(intervals, key=lambda x: x[0])
    merged = [sorted_intervals[0]]
    for current in sorted_intervals[1:]:
        last = merged[-1]
        if current[0] <= last[1]:
            merged[-1] = [last[0], max(last[1], current[1])]
        else:
            merged.append(current)
    return merged

Its drawings are icons, not illustrations, and the example tests it writes next to its code are less reliable than the code itself: only 1 of 5 programs passed its own asserts. Agent World runs every program before it can be sold.

The exact system prompt, a full situation, the legal-move schema and the model's answers are in examples/situation.json.

Model details

Parameters about 1B (24 layers, hidden size 1536, 16 heads with 2 KV heads, vocabulary 130,560)
Context the base model supports long contexts; the game uses about 700 tokens
File onnx/model_q4.onnx, 716 MB, 4-bit weights
Runtimes Transformers.js (WebGPU or WASM), onnxruntime (CPU)
Language English
Base model MiniCPM5-1B by OpenBMB (Apache-2.0); see NOTICE
Decoding greedy, at most 120 new tokens per move and 60 per plan

Intended use and limits

Built for: AI agents and NPCs in Agent World and its protocol; research on small on-device agents, planning and multi-agent economies; trying it out.

Not for: general chat or advice, real-world decisions, or anything outside a game world. Its prompts and training are specific to the Agent World protocol.

Know before you use it:

  • It plays in character. Betrayal, threats, scams and fights are legal moves in the game, and its say lines can be ruthless. Keep that inside fiction.
  • It assumes a referee. Without legal-move constraints and server-side checks, it will sometimes write an illegal move (8% of first answers).
  • It is weaker in fresh worlds than in established ones (see Results).

License at a glance

The Denizen Model License governs this model, so read it in full. In short:

Use
Personal testing, research, education ✅ Free
Sharing it unchanged or modified for non-commercial use, with the license and credit ✅ Free
Commercial use of any kind ✋ Written permission first
Use in any game, paid or free, including NPCs, bots and companions ✋ Written permission first
Using Denizen or its outputs to train, distill or improve other models or agents ✋ Written permission first, and credit
Putting it inside a commercial model, product or dataset ✋ Written permission first
Hosting it as a service or API for others ✋ Written permission first

To ask for permission, open a discussion in the Community tab or message shani147 on Hugging Face, with who you are, what you want to build and at what scale. We want to hear from you.

Required credit: Built with Denizen by shani147, https://huggingface.co/shani147

Citation

@misc{denizen2026,
  title  = {Denizen: tiny on-device minds for a persistent AI-agent economy},
  author = {shani147},
  year   = {2026},
  url    = {https://huggingface.co/shani147/Denizen-1B}
}
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for shani147/Denizen-1B

Finetuned
(60)
this model

Space using shani147/Denizen-1B 1

Collection including shani147/Denizen-1B

Evaluation results

  • Valid JSON move on Agent World Situations-40 (40 judged game situations, greedy, one try)
    self-reported
    100.000
  • Legal move under the game rules on Agent World Situations-40 (40 judged game situations, greedy, one try)
    self-reported
    95.000
  • Judged a good move on Agent World Situations-40 (40 judged game situations, greedy, one try)
    self-reported
    40.000
  • Worlds won on Agent World arena, late-join worlds (12 worlds, 150 ticks, vs previous 1B)
    self-reported
    83.300
  • Agents alive at the end on Agent World arena, late-join worlds (12 worlds, 150 ticks, vs previous 1B)
    self-reported
    62.000
  • Illegal first answers on Agent World arena, late-join worlds (12 worlds, 150 ticks, vs previous 1B)
    self-reported
    8.000