gitwtfhub

wtf is brainscope?

moudrkat/brainscope — explained in plain English

Analysis updated 2026-05-18

39PythonAudience · researcherComplexity · 3/5Setup · moderate

TL;DR

Brainscope is an OpenAI-compatible server that shows a live, layer-by-layer view inside a language model as it generates text, including logit lens, attention, and steering.

Mindmap

mindmap
  root((brainscope))
    What it does
      OpenAI-compatible server
      Live residual stream view
      Logit lens grid
      J-lens readahead
    Tech stack
      Python
      Hugging Face
      Docker
      CUDA
    Use cases
      Watch app traffic
      Steer model output
      Replay traces
      Audit personas
    Audience
      Researchers
      Interpretability engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Point an existing OpenAI-client app at brainscope to watch its real traffic activate model layers in real time.

REASON 2

Steer a model's output live by extracting a direction from example pairs and adjusting a slider.

REASON 3

Record and replay generation traces to study exactly when an answer formed inside the model.

REASON 4

Audit a model for hidden or baked-in personas by watching per-layer signals.

What's in the stack?

PythonHugging FaceDockerCUDA

How it stacks up

moudrkat/brainscopeaa2448208027-code/localaihotswapamapvoice/pilottts
Stars393939
LanguagePythonPythonPython
Setup difficultymoderatemoderatehard
Complexity3/53/54/5
Audienceresearcherdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 5min

Runs CPU-only with a tiny model out of the box, larger models need a GPU or the Docker CUDA image.

Wtf does this do

Brainscope is a tool that lets you watch what is happening inside an AI language model while it is generating answers. It works as a server that speaks the same language as OpenAI's API, so you can point an existing app at it without changing any code, and it will quietly capture and display what the model is doing layer by layer as it writes each word. The main idea is to open up the usually hidden middle of a model. As the model processes a prompt and builds its answer, brainscope shows a live view of the residual stream, the internal signal that flows from one layer to the next. You can click through each layer to see how strongly it is firing, look at individual neurons, check what the model's attention is focused on, and watch a logit lens grid that shows how the answer takes shape as it moves deeper through the layers. A related view called J-lens goes further and can show words the model is leaning toward saying before they actually appear in the output. Brainscope also supports steering, which means you can nudge the model's behavior in a chosen direction using a slider, either for a single request or as an ongoing setting. Every generation can be saved as a trace and replayed afterward, token by token, so you can study exactly when and where an answer formed. The project can also be used to check whether a model has a hidden persona or bias baked into it, by watching how its internal layers respond. Getting started is simple. You install it with pip and run a single command to launch a small CPU-friendly model, or you can use the provided Docker image, including a version built for NVIDIA GPUs if you want to try larger models. Once running, brainscope opens a browser page with a built-in chat box so you can start typing and watching immediately, or you can connect it to any application that already uses an OpenAI-style client. This project is aimed at people working with open-source language models who want to understand what is going on under the hood, whether for research, debugging, or auditing model behavior.

Yoink these prompts

Prompt 1
Show me how to point my existing OpenAI client at brainscope by changing only the base_url.
Prompt 2
Explain how to use brainscope's logit lens to see when a model's answer settles across layers.
Prompt 3
Walk me through setting up brainscope with the tiny CPU model for a quick first test.
Prompt 4
How do I use brainscope's steering feature to nudge a model's output using contrast pairs?

Frequently asked questions

wtf is brainscope?

Brainscope is an OpenAI-compatible server that shows a live, layer-by-layer view inside a language model as it generates text, including logit lens, attention, and steering.

What language is brainscope written in?

Mainly Python. The stack also includes Python, Hugging Face, Docker.

How hard is brainscope to set up?

Setup difficulty is rated moderate, with roughly 5min to a first successful run.

Who is brainscope for?

Mainly researcher.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.