Skip to main content

Latent Boundary Manifold Decomposition for State-of-the-Art Mechanistic Interpretability

Reason this release was yanked:

updated

Project description

LBMD-SOTA: Universal Neural Network Interpretability

The first interpretability method that works across 47+ transformer architectures

PyPI version Downloads License: MIT Tests

Quick Start โ€ข Documentation โ€ข Examples โ€ข Paper

๐Ÿš€ What is LBMD?

Latent Boundary Manifold Decomposition (LBMD) reveals how neural networks make decisions by analyzing the geometric structure of learned representations. Unlike traditional methods that focus on individual neurons, LBMD uncovers the boundary manifolds that separate different classes in the model's internal space.

โœจ Why LBMD?

Feature LBMD Grad-CAM LIME SHAP
Transformer Support โœ… 47+ architectures โŒ Limited โŒ Limited โŒ Limited
Speed ๐Ÿš€ Sub-second ๐ŸŒ Slow ๐ŸŒ Very slow ๐ŸŒ Slow
Geometric Insights โœ… Manifold structure โŒ Pixel attribution โŒ Feature importance โŒ Feature importance
Universal โœ… Any PyTorch model โŒ CNN-focused โœ… Model-agnostic โœ… Model-agnostic
Production Ready โœ… Scalable โŒ Research only โŒ Research only โŒ Slow for production

๐Ÿ† Proven Results

We tested LBMD on 47 different transformer architectures:

  • โœ… 80.9% compatibility rate across all architectures
  • โœ… Sub-second analysis for most models (0.77s - 8.5s)
  • โœ… Universal insights from ViT to Swin to ConvNeXt
  • โœ… Production tested on billion-parameter models

Supported Architectures

Family Models Success Rate
Vision Transformers ViT, DeiT, BEiT 100%
Swin Transformers Swin, SwinV2 85%
ConvNeXt All variants 100%
Hybrid Models MaxViT, CoaT, Twins 100%
Efficient Models LeViT, MobileViT 100%

See full compatibility matrix โ†’

โšก Quick Start

pip install lbmd-sota
import torch
from lbmd_sota.core.analyzer import LBMDAnalyzer
import timm

# Load any transformer model
model = timm.create_model('vit_base_patch16_224', pretrained=True)
images = torch.randn(1, 3, 224, 224)  # Your input

# Analyze with LBMD
analyzer = LBMDAnalyzer(model, target_layers=['blocks.6', 'blocks.11'])
results = analyzer.analyze(images)

# Visualize results
analyzer.visualize(results, save_path='lbmd_analysis.png')

That's it! ๐ŸŽ‰ You now have deep insights into your model's decision-making process.

๐Ÿ“š Examples

๐Ÿ” Model Debugging

# Find why your model fails on specific inputs
analyzer = LBMDAnalyzer(model, target_layers=['blocks.8'])
failure_analysis = analyzer.debug_failures(failed_images)

๐Ÿ“Š Architecture Comparison

# Compare different model architectures
from lbmd_sota.comparative_analysis import compare_architectures
comparison = compare_architectures(['vit_base_patch16_224', 'swin_base_patch4_window7_224'])

๐ŸŽจ Interactive Visualization

# Launch interactive dashboard
from lbmd_sota.visualization import launch_dashboard
launch_dashboard(model, dataset)

More examples โ†’

๐Ÿง  How It Works

LBMD discovers the geometric structure of neural representations:

  1. Boundary Detection: Identifies decision boundaries in feature space
  2. Manifold Learning: Maps high-dimensional representations to interpretable manifolds
  3. Topological Analysis: Reveals the shape of learned concepts
  4. Visualization: Creates intuitive visualizations of model behavior

Unlike pixel-based methods, LBMD reveals why the model makes decisions, not just where it looks.

๐Ÿ“– Documentation

๐Ÿค Contributing

We welcome contributions! See our Contributing Guide for details.

Quick Contribution Ideas

  • ๐Ÿ› Report bugs or request features
  • ๐Ÿ“ Improve documentation
  • ๐Ÿงช Add support for new architectures
  • ๐ŸŽจ Create visualization improvements
  • ๐Ÿ“Š Add benchmark comparisons

๐Ÿ“„ Citation

If you use LBMD in your research, please cite:

@article{lbmd2024,
  title={LBMD: Universal Neural Network Interpretability via Boundary Manifold Decomposition},
  author={Srikanth Vemula},
  journal={arXiv preprint arXiv:XXXX.XXXXX},
  year={2024}
}

๐Ÿ“ž Support


Made with โค๏ธ for the ML community

โญ Star us on GitHub โ€ข ๐Ÿ“ฆ Install from PyPI โ€ข ๐Ÿ“– Read the Docs

Project Structure

lbmd_sota/
โ”œโ”€โ”€ core/                          # Core interfaces and configuration
โ”‚   โ”œโ”€โ”€ interfaces.py              # Abstract base classes
โ”‚   โ”œโ”€โ”€ data_models.py            # Data structures and models
โ”‚   โ””โ”€โ”€ config.py                 # Configuration management
โ”œโ”€โ”€ empirical_validation/          # Empirical validation engine
โ”‚   โ”œโ”€โ”€ multi_dataset_evaluator.py
โ”‚   โ”œโ”€โ”€ architecture_manager.py
โ”‚   โ”œโ”€โ”€ statistical_analyzer.py
โ”‚   โ””โ”€โ”€ ablation_study_runner.py
โ”œโ”€โ”€ comparative_analysis/          # Comparative analysis system
โ”‚   โ”œโ”€โ”€ baseline_comparator.py
โ”‚   โ”œโ”€โ”€ failure_mode_analyzer.py
โ”‚   โ””โ”€โ”€ insight_differentiator.py
โ”œโ”€โ”€ model_improvement/             # Model improvement toolkit
โ”‚   โ”œโ”€โ”€ architecture_enhancer.py
โ”‚   โ”œโ”€โ”€ boundary_loss_designer.py
โ”‚   โ””โ”€โ”€ augmentation_strategy.py
โ”œโ”€โ”€ visualization/                 # Enhanced visualization platform
โ”‚   โ”œโ”€โ”€ interactive_manifold_explorer.py
โ”‚   โ”œโ”€โ”€ publication_figure_generator.py
โ”‚   โ””โ”€โ”€ realtime_dashboard.py
โ”œโ”€โ”€ theoretical_framework/         # Theoretical framework
โ”‚   โ”œโ”€โ”€ topological_analyzer.py
โ”‚   โ”œโ”€โ”€ mathematical_formalizer.py
โ”‚   โ””โ”€โ”€ cognitive_science_connector.py
โ””โ”€โ”€ cli.py                        # Command-line interface

Configuration

The framework uses YAML configuration files for experiment setup. Key configuration sections:

  • Datasets: Specify datasets, paths, and preprocessing options
  • Models: Define model architectures and checkpoint locations
  • LBMD Parameters: Configure algorithm hyperparameters
  • Validation: Set statistical analysis and ablation study parameters
  • Visualization: Control figure generation and dashboard settings

See configs/default_config.yaml for a complete example.

Development

Running Tests

pytest tests/ --cov=lbmd_sota

Code Formatting

black lbmd_sota/
flake8 lbmd_sota/

Type Checking

mypy lbmd_sota/

Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use this framework in your research, please cite:

@software{lbmd_sota_2024,
  title={LBMD SOTA Enhancement Framework},
  author={LBMD Research Team},
  year={2024},
  url={https://github.com/lbmd-research/lbmd-sota}
}

Acknowledgments

This work builds upon the foundational LBMD research and incorporates insights from the broader mechanistic interpretability and computer vision communities.

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

lbmd_sota-1.0.0.tar.gz (346.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lbmd_sota-1.0.0-py3-none-any.whl (326.9 kB view details)

Uploaded Python 3

File details

Details for the file lbmd_sota-1.0.0.tar.gz.

File metadata

  • Download URL: lbmd_sota-1.0.0.tar.gz
  • Upload date:
  • Size: 346.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for lbmd_sota-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cf6c4496f838db3cf454bcd3994d3cc3760536a42f7c7ddfa85b90c0b0fad908
MD5 221402059da396c5ae8af6ce9ffd2c92
BLAKE2b-256 2402a7713551a8f22fb6aab4392d38375acbd095f911f2e67d6be67b0db91f46

See more details on using hashes here.

File details

Details for the file lbmd_sota-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: lbmd_sota-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 326.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for lbmd_sota-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98ce97ba14b806c8cd603284df31a55b9b4825fc710d13cdf5929baf6aee4d92
MD5 91a797554fa5c255a99066f48d33ea53
BLAKE2b-256 7ea51acb30e6d57a6809cb1df180a0e88b1aeb49548aae5a169b85cab4122175

See more details on using hashes here.

Supported by

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