TimTim: a small frozen model that answers from a source-tracked fact graph

TimTim is a research prototype (personal, non-commercial). A frozen 1.7B language model (LiquidAI/LFM3-1.7B, with a small merged LoRA adapter) never learns new facts. Everything it knows lives in a graph of short facts, each with a recorded source. For every question it retrieves a few facts, answers only from them, cites them, and says "I don't know" when they don't answer the question. This repository holds the code, the knowledge packs, the benchmarks, the measured results and the two small LoRA adapters; it does not hold the base models.

Current state (2026-11-16)

The memory now learns from use and corrects itself, under rules the measurements showed to work: the small model writes and answers but does not judge; truth comes from the source, use only changes ranking; ideas are compounds of particles (the names facts share); conflicts are settled by source before the answer; nothing is overwritten; a feature is on by default only after a held-out test with neutral fact IDs and a grader fixed beforehand.

On by default: adapter v7 · conflicts settled by source before and after the answer, including differently worded ones found by an NLI judge · citation repair · examples under a fact are searched · particles (merge, split) · sleep while idle (an overnight conflict sweep) · NLI pair judge (DeBERTa-v3-large) for consolidation · personal memory for signed-in users, trusted for their owner and labelled by source ("user belief, said ") · dated chains · feedback (marks and short reactions) · query trails (pull) · review queue with confident auto-apply. Off: physics ticks (no effect on answers; the Atlas computes a layout when opened), gravity repel, second look, self-questioning, outside lookups and the bigger model (the owner switches those on).

30 simulated days, two seeds (user marking answers) Start of the rebuild, adapter v6 Now
Repeat questions right (of 138) 122 / 120 136 / 135
New questions right (of 47) 38 / 38 43 / 43
"Now" after a change (of 70) / "in July" (of 30) 69–68 / 29–30 70 / 30, both seeds
Unanswerable questions refused (of 68) 68 / 68 68 / 68
Planted wrong facts used (of 90 asks) 20 / 17 0 / 0
Wrong answers, all kinds 32 / 28 6 / 5

Hard held-out planted set (wrong fact in the question's own words): 0 right and 63 wrong values stated with v6 as it was, 108 of 108 right now. Two-step questions (an answer needs two linked facts): 27 → 38 of 40 right. Personal memory (invented users): recall 12 of 13, changes 6 of 6, held-out users 9/9 and 9/9, no fact of one user ever used for another, erasure complete.

What is still open: every test uses invented questions written by the project's author; the owner's own use over a week is the test that matters next. The 215 pack facts were reviewed by an AI model on the owner's instruction, not by a person. docs/MEASUREMENTS.md has every number, the scripts that produce them and what each test cannot show.

How it works

  1. Memory is a graph of short facts, each with its source (src/domain/). A fact has a source tier and a trust value, may carry dated versions (a changed fact is replaced, never overwritten), and may have examples, caveats and exceptions listed under it. Facts are compounds of particles, the names and specific terms they share, which bond facts about the same person or thing (particles.py).
  2. Answering (MemoryOrchestrator.query_live in app.py): the question is embedded (EmbeddingGemma-2) and facts are found by meaning, by the examples under them, by earlier questions of the same user (query trails), and through shared particles. Before the model sees them, a looked-up fact that contradicts a curated one is removed and sent back to quarantine (the source decides). The frozen LFM3-1.7B with its grounding adapter answers only from the facts shown and cites them; a validator and a yes/no check reject uncited or unsupported answers; a missing citation is repaired; anything it cannot ground becomes an honest "I don't know".
  3. Learning without changing weights: marks and short reactions ("that's wrong"), dated replacement, a review queue with confident auto-apply, overnight sleep (a conflict sweep and index rebuild), consolidation with a bigger model checked by a local NLI judge, curiosity (looking up refused questions, when lookups are on) and, for signed-in users, personal memory that only they can see.
  4. Accountability: every answer can be explained (/explain/{query_id}), every past state replayed (/replay/{tick}), and every action is in an HMAC-chained audit log. Erasure removes a user's data everywhere.

Quickstart

The project folder is self-contained: code, facts, the two grounding adapters (adapters/) and launchers. It can sit anywhere, on Windows or Linux. Start with doctor, which says what the machine has and what is missing, and downloads nothing.

# Windows: timtim.bat doctor        Linux: sh timtim.sh doctor
python -m venv .venv                      # then activate it
pip install -e ".[dev]"                   # core packages and tests: enough for the demo without models
python -m pytest -q                       # 432 tests, no models needed
timtim doctor

With the real models (a GPU with 8 GB or more is recommended; on a CPU an answer takes tens of seconds):

pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126   # pick the build for your GPU on pytorch.org
pip install -e ".[ml,docs]"
timtim setup                              # downloads the pinned model files, about 5 GB (add --omni for speech and sight)
timtim query "Why does a hot coffee cool down?" --packs knowledge_packs/general --embedder gemma --llm --trust-model-code
  • --llm loads the answering model with the default adapter and the yes/no citation check, which is the configuration the measurements were made with. --adapter none or --adapter NAME_OR_PATH chooses another; --llm-backend omni lets LFM3-Omni-2B answer.
  • --trust-model-code lets the model repository's own model code run. The answering models need it; the revision is pinned and the code was read at that revision.
  • timtim serve --port 8000 --packs knowledge_packs/general --embedder gemma --llm --trust-model-code starts the API and the Atlas page (http://127.0.0.1:8000/atlas).
  • requirements-lock.txt lists the exact package versions the measurements were made with.

Run it on another machine

Four ways:

Way What to do Needs on the other machine
Copy or clone the folder install as above, then timtim setup Python 3.10 or newer, network for packages and models
Bundle without models timtim bundle D:\out\timtim writes one folder (130 MB) with a manifest the same
Bundle with models timtim bundle D:\out\timtim --with-models (4.8 GB; --omni adds 4.2 GB; --zip also writes a zip) Python and the packages; no network and no model cache: the folder's models/ is used automatically
Docker docker build -t timtim . (CPU, 2.4 GB), or the GPU build on an official PyTorch image; the commands are at the top of the Dockerfile Docker; for the GPU build the NVIDIA container runtime. Model files are mounted, not baked in

A bundle is started with the launcher inside it (timtim.bat or sh timtim.sh), from any folder. MANIFEST.json in the bundle lists what it holds, the checksums of the adapters and the package versions of the machine that made it.

Keep in mind:

  • A bundle with models holds third-party model weights under their own licences (LiquidAI, Google). Carry it to your own machines; do not publish it.
  • The adapters are LoRA weights for those models; they are covered by this project's licence and, used with the models, by the models' own licence (see NOTICE.md).
  • Escalation to a bigger model needs Ollama (or an API key in the environment) on the new machine; lookups need network. Both are off unless switched on.
  • Without the real models the demo runs on a stand-in embedder that matches words, not meaning, so its answers are only good for checking that everything starts.
  • Docker keeps its images and build cache in one disk file that grows and does not shrink by itself. Building both images here, several times over, grew it by about 11 GB; docker builder prune -f frees the space inside Docker but not on the Windows drive; scripts/compact_docker_disk.ps1 (administrator, Docker and WSL stopped) then shrinks the file. On the author's PC that returned 8.9 GB in 16 seconds, and all images still worked afterwards.
  • On the author's PC Docker Desktop 4.81 would not start at all: it leaves its socket files behind when it stops, and Windows refuses to delete them. scripts/start_docker_desktop.ps1 clears them (or moves the folder aside) and then starts Docker. This is a fault of that installation, not of this project.


Security & Configuration

Environment variables

Variable Purpose
TIMTIM_SECRET_KEY Master secret (≥ 32 random characters). Every key is derived from it: scaffold/invariant signatures, the keyed audit chain, checkpoint signatures, and user pseudonyms. Required for any deployment that keeps a WAL or checkpoint DB. If it's missing, a random per-process key is used and a warning is printed.
TIMTIM_API_TOKENS token=user_id:role,token2=user2:role (role user or admin, tokens ≥ 16 chars). With no tokens set, serve mints a one-time admin token and prints it. The API never runs unauthenticated.
TIMTIM_HF_TRUST_REMOTE_CODE Set to 1 to allow loading the live models. Both LiquidAI/LFM3-1.7B and nomic-ai/nomic-embed-text-v1.5 ship custom code. Review it and pin hf_llm_revision / hf_embed_revision in TopologyThresholds. Otherwise the deterministic fallback is used, and /metrics → model_server.backends says so.
TIMTIM_LOOKUP_CONTACT Optional contact (URL or email) put in the User-Agent of external lookups. Raises Wikidata's limit from 10 to 200 requests/min. Only used when lookup_enabled is on.

API access

Every endpoint except the static /atlas page needs Authorization: Bearer <token>, and the caller's identity always comes from the token. Users can query, read their own explain trails, see public memory plus their own private satellites, and erase their own data. Admins can also add nodes, tick, replay, read metrics, approve bridge proposals (POST /bridges/{id}/approve, needed while memory.plank_mutation.requires_approval is on) and reset the failure-drill circuit breaker.

Data-subject erasure (DELETE /subjects/{user_id})

Erasure removes the user's data from the live graph (nodes, edges, comets, co-usage, debris snapshots), safety session history, explain trails, telemetry, provenance sources, blobs, the vector index, and stored checkpoint history. Affected checkpoints are rewritten, marked redacted and re-signed. The append-only audit ledger only ever stores keyed pseudonyms (u_…), so it never holds a raw user ID.

Integrity

  • Audit ledger: HMAC-chained, fsync'd, and verified on WAL load. Ticks commit their events atomically, so a rolled-back tick leaves no trace.
  • Checkpoints: append-only and versioned per tick, with HMAC signatures. /replay checks the signature, the recomputed hash and the tick's own boundary snapshot.
  • Concurrency: all orchestrator operations are serialized. LLM generation runs outside the lock.

Known limits

  • Prompt-injection detection is a heuristic: normalized text plus patterns. Retrieved memory and the user query are also fenced as untrusted data in the LLM prompt.
  • Above diag_dense_max_nodes (default 1,500), spectral/Hodge diagnostics are skipped (spectral_computed: false) and the diameter is a sampled lower bound.
  • The Hodge decomposition is also skipped above diag_hodge_max_edges / diag_hodge_max_triangles (hodge_computed: false). The holographic Dirichlet-to-Neumann projection is skipped above diag_dense_max_nodes.
  • Graph growth is bounded: static-topology links respect max_edges_per_node, and stored triangle cells are capped at max_triangle_cells (the most coherent are kept).
  • If a query's best direct match is below retrieval_off_topic_floor, every candidate is marked uncertain. Graph propagation can't make an off-topic answer "verified".
  • The physics layer (src/domain/physics.py, off by default since 2026-11-16) is a set of physics-inspired heuristics, not exact physics; it did not change answers in any test.
  • State is held in memory and rebuilt at start-up. Checkpoints and the WAL are for audit and replay, not for restoring state on restart.

Licence

Non-commercial use, testing, changes and sharing are welcome. Software: PolyForm Noncommercial 1.0.0 (LICENSE-CODE.md). Documents, data and adapter weights: CC BY-NC-SA 4.0 (LICENSE-DOCS-DATA.txt). Third-party models and text keep their own terms (NOTICE.md). Commercial use or other terms: contact the author through https://huggingface.co/o0Hailey-DSynth0o. Overview: LICENSE.md.

Contributing

Your own questions (where it answers wrongly, refuses wrongly or answers what it should refuse), fact checks and new knowledge packs are the most useful contributions. See CONTRIBUTING.md.

Where the details are

  • docs/MEASUREMENTS.md: every measured part, dated, with the script and result files behind each number, and what each test cannot show.
  • docs/LIVING_MEMORY_SPEC.md: the plan for the living memory and how its six targets turned out.
  • knowledge_packs/eval/: the result files. scripts/: the benchmarks that produce them.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for o0Hailey-DSynth0o/timtim-semantic-topology

Finetuned
(118)
this model