LLM Ripper
A production-oriented framework for modular deconstruction, analysis, and recomposition of knowledge in Transformer-based language models.
- Extract interpretable components from LLMs (embeddings, heads, FFNs)
- Analyze and catalog attention/MLP behaviors
- Transplant knowledge across models with safety gates
- Validate outcomes with quantitative checks and reports
Table of contents
- Features
- Installation
- Quickstart
- CLI overview
- Examples
- Configuration
- Architecture
- Development
- Troubleshooting
- License
Features
- Modular pipeline: capture → analyze → extract → transplant → validate
- Safe model loading with explicit
--trust-remote-codeflow - Reproducible runs with standardized artifact layout (see RunContext)
- Studio (static) viewer for quick inspection of outputs
- Interop utilities for adapters and merges
Installation
pip install -r requirements.txt
pip install -e . # editable install for development
# Optional extras
# pip install .[viz]
# pip install .[spacy]
# pip install .[wandb]
# pip install .[nlp]
GPU users: see make install-cuda to install a CUDA-enabled torch build.
Beginner-friendly Quickstart
New to ML repos? Start here.
# 1) Set up your environment
python -m venv .venv
# Windows: .venv\\Scripts\\activate
# macOS/Linux:
source .venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -e .
pre-commit install
# 2) Run the beginner demo (no downloads)
make beginner
This will create a demo run and open the Studio at http://localhost:8000.
For a more complete flow, see Quickstart below.
Quickstart
Minimal end-to-end using provided Makefile targets (customize variables):
# 1) Extract components to a knowledge bank directory
make extract MODEL=<hf_model_or_path> OUT=./knowledge_bank DEVICE=cuda E8=1 TRUST=0
# 2) Capture activations (optional)
make capture MODEL=<hf_model_or_path> ACT=./activations.h5 DEVICE=cuda E8=1
# 3) Analyze knowledge bank and activations
make analyze OUT=./knowledge_bank ACT=./activations.h5 ANALYSIS=./analysis DEVICE=cuda
# 4) Transplant from source KB to a target model
make transplant OUT=./knowledge_bank MODEL=<target_model> TRANSPLANTED=./transplanted DEVICE=cuda
# 5) Validate the transplanted model
make validate TRANSPLANTED=./transplanted MODEL=<baseline_model> VALIDATION=./validation_results DEVICE=cuda
Prefer CLI directly?
python -m llm_ripper.cli extract --model <hf_model> --output-dir ./knowledge_bank --device cuda
python -m llm_ripper.cli analyze --knowledge-bank ./knowledge_bank --activations ./activations.h5 --output-dir ./analysis
python -m llm_ripper.cli transplant --source ./knowledge_bank --target <target_model> --output-dir ./transplanted
python -m llm_ripper.cli validate --model ./transplanted --baseline <baseline_model> --output-dir ./validation_results
CLI overview
python -m llm_ripper.cli --help
extract— build a knowledge bank from a donor modelcapture— collect activations into HDF5 or similar formatsanalyze— run analyses over KB/activations and produce catalogstransplant— inject selected components into a target modelvalidate— run quantitative and qualitative checks on outputsinspect— quick JSON summary of a KBtrace,uq,report,merge,adapters— advanced modules (see docs)
Flags of interest: --device (cuda|cpu|mps), --load-in-8bit, --load-in-4bit, --trust-remote-code, --verbose, --quiet, --log-format (text|json), and --dry-run.
Beginner shortcut command (no Makefile needed):
python -m llm_ripper.cli quickstart --open
# or just
llm-ripper quickstart --open
Examples
- End-to-end scripts in
examples/run_full_pipeline.py,run_extraction_only.py,run_complete_pipeline.py
- Quick offline smoke test (no downloads):
make smoke-offline
Configuration
- Environment variables may be supplied via
.env(see.env.example). - JSON configs for some flows are supported; see
tests/test_config_validation.pyandsrc/llm_ripper/utils/config.py. - Standardized run layout under
runs/<timestamp>/with directories:knowledge_bank,activations,analysis,transplants,validation,causal,traces,counterfactuals,uq,catalog,provenance,reports.
Studio
Studio interface screenshot will be added soon.
Architecture
See the docs page Architecture. High-level view:
flowchart LR
A[Donor] --> B[Extract]
B --> C[Knowledge Bank]
C --> D[Transplant]
D --> E[Validate]
C --> G[Analyze]
E --> H[Studio]
Maintainers
See the Maintainers guide for enabling Pages, Codecov and PyPI: docs/maintainers.md
Development
See CONTRIBUTING.md.
- Install dev deps:
pip install -r requirements-dev.txt && pip install -e . - Set up pre-commit:
pre-commit install - Quality:
make lint,make test,make test-cov - Matrix locally:
tox - Docs:
mkdocs serve
Troubleshooting
See TROUBLESHOOTING.md.
Security
Use --trust-remote-code only when you understand the risk. See SECURITY.md for guidance.
License
Apache-2.0. See LICENSE.
Metadata
Release files for llm-ripper 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| llm_ripper-1.0.0.tar.gz | 229.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llm_ripper-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 463.7 kB
Release files / llm_ripper-1.0.0.tar.gz
| Download URL | llm_ripper-1.0.0.tar.gz |
|---|---|
| Size | 229.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7dce37d50b60bee68f92bec52bfab53e02022cb5e7bdf9c185fa24137a320ff
|
|
BLAKE2b-256 checksum How to use checksums |
54451be8a4bc45667eb3df62d3670a98c7f9e93aaf4a1212fb96c01491abe7aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / llm_ripper-1.0.0-py3-none-any.whl
| Download URL | llm_ripper-1.0.0-py3-none-any.whl |
|---|---|
| Size | 233.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13de3a105f3a9d8ea4f93436b0e4af34f1f633073105a022b4e50e512b99fb51
|
|
BLAKE2b-256 checksum How to use checksums |
a6c0032a19456bff4c64b5cc8ec15cc1f129f014b8a2dc694b826a777f9dc384
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Security for llm-ripper 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.