Jacobian Mem2gen — AI skill for Claude Code
Jacobian extension of Towards Mechanistically Understanding Why Memorized Knowledge Fails to Generalize in Large Language Model Finetuning inspired by J-Lens.
How to install Jacobian Mem2gen
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open BurnyCoder/jacobian-mem2gen and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Jacobian Mem2gen does
Jacobian extension of Towards Mechanistically Understanding Why Memorized Knowledge Fails to Generalize in Large Language Model Finetuning inspired by J-Lens. Original method fine-tunes LLMs with unseen knowledge and monitors the spatial permeation dynamics of the knowledge internally with self-patching, an adaptation of activation patching.
Alternatives in AI
- Repomix — 📦 Repomix is a powerful tool that packs your entire repository into a single, AI-friendly file 22.7k ★
- Greptile — Code Search AI-powered codebase search and understanding 14k ★
- Fine Tuning — ai-research-skills Axolotl, LLaMA-Factory, PEFT, Unsloth 5.4k ★
README
Mem2Gen: Why Memorized Knowledge Fails to Generalize in LLM Fine-tuning
**This fork adds the J-lens transport experiments** (section [J-lens transport between layers](#j-lens-transport-between-layers-this-fork) below). The question is whether the paper's cross-layer copies work better if the residual state is moved into the target layer's coordinates with the Jacobian lens, instead of being copied raw. The rest of this README is the paper's release documentation.
J-lens transport between layers (this fork)
**Question.** The paper moves residual states between layers in two places:
- the self-patching oracle, which writes
h_sinto layertat the head-entity tokens; - LRSD, which pulls
h^ttowardsg(h^s)during fine-tuning.
Both assume every layer shares one coordinate system. The [J-lens](https://transformer-circuits.pub/2026/workspace/index.html) ([code](https://github.com/anthropics/jacobian-lens)) shows that this is not so. It fits `J_l = E[∂h_final/∂h_l]`, which maps a layer-`l` state into the final layer's basis, and early layers only read out correctly after that map.
**Method.** Both experiments run on Qwen2.5-0.5B-Instruct, which fits an 8 GB GPU, with the paper's 1000-fact injection recipe:
- Self-patching. The paper's raw
copyis compared with a J-lens transportx = h_t + R_t (J_s h_s − J_t h_t), whereR_tis a ridge inverse ofJ_twith strengthc. Without the ridge (c → 0, invertibleJ_t) this equalspinv(J_t) J_s h_s, the state whose J-lens readout at layertmatchesh_s's readout at layers; the reported run usesc = 0.1, where the readout still differs by 34% (results/jtransport/exp1.json,geometry.jlens.readout_error). Controls: matched-magnitude random perturbations (noise_copy,noise_jlens) and a scale-only fix (norm). The paper's oracle is reported, plus a cross-validated single layer pair and paired bootstrap CIs. - LRSD. The paper's raw-coordinate loss is compared with a J-space loss
Related Skills
LLM Bridge MCP
A model-agnostic Message Control Protocol (MCP) server that enables seamless integration with various Large La
Craftify Byok AI Shortcuts
Craftify — iOS application with Share Extension for contextual text processing via multiple Large Language Mod
So101 Physical AI Lab
A robot you talk to: a platform for operating, teaching and researching robot arms (SO-101 on a Jetson, Claude
Crab Agent Extension
Crab-Agent is an LLM-powered Chrome extension that automates browser tasks using natural language commands. In
Intent Router
Fine-tuned intent router in front of an LLM agent: LoRA on xlm-roberta-large beats Claude Sonnet 4.6 on BANKIN
Understanding Studio
An Agent Skill that turns complex topics and AI outputs into clear explanations, diagrams, interactive single-
Related Agents
Context Analyst David
Analyze given Bible verses from the Psalms, written by David, and provide a comprehensive understanding of the
AI Search Geo Specialist
Read-only AI-search (GEO/AEO) specialist. Use proactively during an audit to evaluate answer extractability/pa
Vibe Mentor
Method mentor for building with LLMs. Owns the plan checkpoint before implementation, phase readiness, atomic