jlens-gguf — the Jacobian Lens for llama.cpp / GGUF models
A GGUF-native implementation of the Jacobian Lens from Anthropic's
Verbalizable Representations Form a Global Workspace in Language
Models, plus an
interactive visualizer & manipulator (in the spirit of Neuronpedia's
J-Lens pages) that works against GGUF models served by llama.cpp — with
live steering, concept swapping (patching), ablation, and steered
generation.
browser (web UI)
│ JSON
┌───────────────▼────────────────┐
│ bridge (python, numpy) │ lens math:
│ jlens_gguf.server │ J_l transport, unembed,
│ • model GGUF → readout wts │ top-k, ranks, J-lens vectors,
│ • lens GGUF → J_l (+ bias) │ steering / swap / ablate,
└───────┬────────────────────────┘ sparse decomposition
│ HTTP (binary activations, generic residual edits)
┌───────▼────────────────────────┐
│ jlens-server (C++, llama.cpp)│ the same GGUF file your
│ • captures l_out- per │ llama-server mmaps — weights
│ layer/position │ are shared page cache
│ • applies add / low-rank / │
│ set edits mid-graph │
│ • generation w/ edits active │
└────────────────────────────────┘
New here? Start with QUICKSTART.md — a friendly,
task-oriented walkthrough. This README is the full reference.
The reference PyTorch implementation reads the residual stream with hooks and
computes with torch tensors. Here, the lens lives in a GGUF file, readout
weights (final norm + unembedding) are read directly from the model GGUF
(dequantized with gguf-py, no torch), and residual-stream access + live
interventions go through a small llama.cpp-based activation server that
hooks the computation graph via ggml's scheduler eval callback.
Quickstart
# clone with the llama.cpp submodule
git clone --recursive jlens-gguf # or: