Skip to main content

A library for doing research on developmental interpretability

Project description

DevInterp

PyPI version Python version Contributors Docs

A Python Library for Developmental Interpretability Research

DevInterp is a python library for conducting research on developmental interpretability, a novel AI safety research agenda rooted in Singular Learning Theory (SLT). DevInterp proposes tools for detecting, locating, and ultimately controlling the development of structure over training.

Read more about developmental interpretability.

:warning: This library is still in early development. Don't expect things to work on a first attempt. We are actively working on improving the library and adding new features.

Installation

To install devinterp, simply run pip install devinterp. (Note: This has PyTorch as a dependency.)

Minimal Example

from devinterp.slt.sampler import  sample, LLCEstimator
from devinterp.optim import SGLD
from devinterp.utils import default_nbeta

# Assuming you have a PyTorch Model assigned to model, and DataLoader assigned to trainloader
llc_estimator = LLCEstimator(..., nbeta=default_nbeta(trainloader))
sample(model, trainloader, ..., callbacks = [llc_estimator])

llc_mean = llc_estimator.get_results()["llc/mean"]

Advanced Usage

To see DevInterp in action, check out our example notebooks:

For more advanced usage, see the Diagnostics notebook Open In Colab and for a quick guide on picking hyperparameters, see the above Grokking Demo Open In Colab or the the Calibration notebook. Open In Colab. Documentation can be found here. Docs

For papers that either inspired or used the DevInterp package, click here.

Known Issues

  • LLC Estimation is currently more of an art than a science. It will take some time and pain to get it work reliably.

If you run into issues not mentioned here, please first check the github issues, then ask in the DevInterp Discord, and only then make a new github issue.

Contributing

See CONTRIBUTING.md for guidelines on how to contribute.

Credits & Citations

This package was created by Timaeus. The main contributors to this package are Stan van Wingerden, Jesse Hoogland, George Wang, and William Zhou. Zach Furman, Matthew Farrugia-Roberts, Rohan Hitchcock, and Edmund Lau also made valuable contributions or provided useful advice.

If this package was useful in your work, please cite it as:

   @misc{devinterp2024,
      title = {DevInterp},
      author = {Stan van Wingerden, Jesse Hoogland, George Wang, and William Zhou},
      year = {2024},
      howpublished = {\url{https://github.com/timaeus-research/devinterp}},
   }

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devinterp-1.2.0.tar.gz (40.5 kB view details)

Uploaded Source

Built Distribution

devinterp-1.2.0-py3-none-any.whl (50.6 kB view details)

Uploaded Python 3

File details

Details for the file devinterp-1.2.0.tar.gz.

File metadata

  • Download URL: devinterp-1.2.0.tar.gz
  • Upload date:
  • Size: 40.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for devinterp-1.2.0.tar.gz
Algorithm Hash digest
SHA256 c07c8735d50b0434547fb6766c10feb477dcec348514922d9ed74339fd3f63db
MD5 4faccca77363abe58e1606eb21bd1618
BLAKE2b-256 56c378a253a81d5ca966aaccd427ea65d5c998d5ff3f7aafd5ba12818abd0137

See more details on using hashes here.

File details

Details for the file devinterp-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: devinterp-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 50.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for devinterp-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15cc195d3605e9aab161c6ed266bf2008bcfaf532bfa847e8bd6a03395297b95
MD5 d87da1258d11e54bbcc629e3025079ef
BLAKE2b-256 ec645881019d85782d1e46107903dd6707e6623918375f9c064393d10a0e8751

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page