gitwtfhub

wtf is substrates?

lamm-mit/substrates — explained in plain English

Analysis updated 2026-07-25

10PythonAudience · researcherComplexity · 5/5Setup · hard

TL;DR

Research code for studying how a language model represents materials science concepts internally, using a technique called the Jacobian Lens to read and alter what happens inside the model when it processes materials prompts.

Mindmap

mindmap
  root((repo))
    What it does
      Studies model internals
      Materials science focus
      Causal interventions
    Tech stack
      Python package
      Gemma model
      GPT-2 for demos
    Use cases
      Reproduce research study
      Run lens fitting
      Test causal swaps
    Audience
      Researchers
      Materials scientists
    Setup
      Python 3.10 plus
      Compute intensive
      Hugging Face data

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

Reproduce the materials science model study using the included experiment scripts and frozen prompt manifests.

REASON 2

Fit a Jacobian Lens on a language model to inspect how it internally represents materials concepts.

REASON 3

Run causal swap experiments to test whether changing internal model signals alters its outputs.

REASON 4

Run the bundled smoke-test demo to quickly verify the package installs and works on your machine.

What's in the stack?

PythonGemmaGPT-2Hugging Face

How it stacks up

lamm-mit/substratesaarav90-cpu/fetchitadammartinez271828/x4-analysis
Stars101010
LanguagePythonPythonPython
Setup difficultyhardeasyeasy
Complexity5/52/52/5
Audienceresearcherdevelopergeneral

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

How do you spin it up?

Difficulty · hard Time to first run · 1h+

Full experiments are compute-intensive and may require accepting a license to download the Gemma model, companion data must be fetched separately from Hugging Face.

The license is not specified in the available README content, so check the repository for licensing details before use.

Wtf does this do

This repository contains the research code and data for a project that studies how an open-weight language model, Gemma, represents materials science concepts internally. The researchers apply a technique called the Jacobian Lens to examine and influence what happens inside the model when it processes prompts about materials and their properties. The project covers three areas: readable concepts that the model encodes, relational state changes that show how representations shift, and causal interventions that test whether changing internal signals alters the model's output. The code is organized into a Python package with tools for fitting the lens, reading out model states, analyzing results, generating reports, and running causal swap experiments. It includes frozen prompt manifests that specify exactly which questions the model is asked, experiment scripts with fixed protocols for reproducing the study, and offline tests. The package also bundles the Jacobian Lens runtime so the installation is self-contained. The authors note that the package does not expose a model's private chain of thought, it measures model activations and behavior. Companion resources on Hugging Face hold the fitted lens checkpoints, extracted state vectors, and the full prompt corpus organized into 21 named configurations. These are kept separate from this GitHub release, which is source only. The prompt corpus is divided into development, evaluation, falsification, and exploratory groups, and the models used may require accepting a license before downloading. Installation requires Python 3.10 or newer and supports both virtual environments and Conda. A small demonstration command downloads GPT-2, fits a tiny lens on eight records, and runs basic mechanics examples as a smoke test. The full paper protocol is much more demanding: it fixes 1,000 fitting records, targets specific model layers, requires at least 50 evaluation items per distribution, and expects both model and dataset revisions to be pinned. The authors describe this as a compute-intensive workflow, and each fitted lens file requires a provenance sidecar recording its metadata to be valid for any paper-level claim. The README is detailed and includes installation instructions, workflow descriptions, and references to additional documentation files for prompt schemas and CLI conventions. The full README is longer than what was shown.

Yoink these prompts

Prompt 1
Install the Substrates Python package in a virtual environment and run the demo command that fits a tiny lens on GPT-2 with eight records.
Prompt 2
Using the Substrates repository, set up the full paper protocol with 1,000 fitting records and pinned model revisions, then run an evaluation across the prompt corpus.
Prompt 3
Load a fitted Jacobian Lens checkpoint from Hugging Face and run a causal swap experiment on a Gemma model processing materials science prompts.
Prompt 4
Generate a report from Substrates analyzing readable concepts and relational state changes extracted from a language model processing materials property questions.

Frequently asked questions

wtf is substrates?

Research code for studying how a language model represents materials science concepts internally, using a technique called the Jacobian Lens to read and alter what happens inside the model when it processes materials prompts.

What language is substrates written in?

Mainly Python. The stack also includes Python, Gemma, GPT-2.

What license does substrates use?

The license is not specified in the available README content, so check the repository for licensing details before use.

How hard is substrates to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is substrates for?

Mainly researcher.

View the repo → Decode another repo

This repo across BitVibe Labs

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