diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..15d34d2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,50 @@ +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +.env +venv/ +ENV/ +env/ + +# Jupyter Notebook +.ipynb_checkpoints +*.ipynb_checkpoints/ + +# IDEs +.vscode/ +.idea/ +*.swp +*.swo +*~ +.DS_Store + +# Node modules +node_modules/ +npm-debug.log +yarn-error.log + +# Temporary files +*.tmp +*.log +.cache/ diff --git a/README.md b/README.md index bc391ca..7a1ef7c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,119 @@ -# MechanisticInterpretabilityShowcase -Mechanistic Interpretability tools we are developing. +# Mechanistic Interpretability Showcase + +A research showcase page demonstrating mechanistic interpretability tools developed by the Precision Neuro Lab. This project aims to make neural networks more transparent and understandable through visualization and analysis techniques. + +## Features + +- **Clean, Professional Interface**: Modern web design showcasing research and tools +- **Responsive Design**: Works seamlessly across desktop, tablet, and mobile devices +- **Interactive Navigation**: Smooth scrolling and intuitive user experience +- **Extensible Structure**: Easy to add demos, research papers, and interactive visualizations + +## Getting Started + +### Prerequisites + +No build tools or dependencies required! This is a pure HTML/CSS/JavaScript project. + +### Running Locally + +1. Clone the repository: + ```bash + git clone https://github.com/PrecisionNeuroLab/MechanisticInterpretabilityShowcase.git + cd MechanisticInterpretabilityShowcase + ``` + +2. Open `index.html` in your web browser: + - **Option 1**: Double-click `index.html` + - **Option 2**: Use a local server (recommended for development): + ```bash + # Using Python 3 + python -m http.server 8000 + + # Using Node.js (if http-server is installed) + npx http-server + ``` + - **Option 3**: Use VS Code Live Server extension + +3. Navigate to `http://localhost:8000` in your browser + +## Project Structure + +``` +MechanisticInterpretabilityShowcase/ +├── index.html # Main HTML page +├── styles.css # Styling and layout +├── script.js # Interactive functionality +├── docs/ # Documentation and examples +├── README.md # This file +└── LICENSE # License information +``` + +## Customization + +### Adding New Research Cards + +Edit `index.html` and add new cards in the `research-section`: + +```html +
+

Your Research Title

+

Description of your research.

+
+``` + +### Adding Interactive Demos + +Add demo cards in the `demos-section` of `index.html`: + +```html +
+

Demo Title

+

Demo description.

+ Try Demo +
+``` + +### Styling + +Modify colors and styles in `styles.css`. Key CSS variables are defined at the top: + +```css +:root { + --primary-color: #2563eb; + --secondary-color: #7c3aed; + /* Add more custom variables */ +} +``` + +## Contributing + +We welcome contributions! Please feel free to submit issues or pull requests. + +1. Fork the repository +2. Create your feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes (`git commit -m 'Add some amazing feature'`) +4. Push to the branch (`git push origin feature/amazing-feature`) +5. Open a Pull Request + +## Future Enhancements + +- [ ] Add interactive visualizations using D3.js or Three.js +- [ ] Integrate Jupyter notebooks for live demos +- [ ] Add research paper listings with links +- [ ] Create video tutorials section +- [ ] Add team member profiles +- [ ] Implement search functionality + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +## Contact + +For questions or collaborations, please visit our [GitHub repository](https://github.com/PrecisionNeuroLab/MechanisticInterpretabilityShowcase). + +## Acknowledgments + +- Inspired by research in mechanistic interpretability +- Built for the Precision Neuro Lab community diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..074950a --- /dev/null +++ b/docs/README.md @@ -0,0 +1,35 @@ +# Documentation + +Welcome to the Mechanistic Interpretability Showcase documentation! + +## Contents + +- [Getting Started](getting-started.md) - Quick start guide +- [Examples](examples.md) - Example use cases and demos +- [Contributing](contributing.md) - How to contribute to the project + +## Overview + +This showcase demonstrates tools and techniques for understanding neural network behavior through mechanistic interpretability. Our goal is to make AI systems more transparent and interpretable. + +## What is Mechanistic Interpretability? + +Mechanistic interpretability is the study of understanding neural networks by identifying and analyzing the specific algorithms and circuits they learn. Rather than treating neural networks as black boxes, this approach aims to reverse-engineer their internal mechanisms. + +### Key Concepts + +1. **Feature Visualization**: Understanding what individual neurons or layers respond to +2. **Circuit Analysis**: Identifying computational pathways within networks +3. **Activation Patterns**: Analyzing how information flows through the network +4. **Intervention Studies**: Testing hypotheses about network behavior through targeted modifications + +## Resources + +- [Main Showcase Page](../index.html) +- [GitHub Repository](https://github.com/PrecisionNeuroLab/MechanisticInterpretabilityShowcase) + +## Quick Links + +- **Research**: Learn about our latest findings +- **Demos**: Try interactive demonstrations +- **Tools**: Access our open-source tools diff --git a/docs/examples.md b/docs/examples.md new file mode 100644 index 0000000..0c7a02a --- /dev/null +++ b/docs/examples.md @@ -0,0 +1,218 @@ +# Examples + +This document provides examples of how to extend the Mechanistic Interpretability Showcase. + +## Adding New Research Cards + +To showcase a new research topic, add a card to the research section: + +```html +
+

Attention Head Analysis

+

Methods for understanding and visualizing attention mechanisms in transformer models.

+
+``` + +## Creating Interactive Demos + +### Example 1: Simple Visualization Demo + +Create a new HTML file `demos/attention-viz.html`: + +```html + + + + + + Attention Visualization Demo + + + +
+ +
+ +
+
+

Attention Visualization Demo

+
+ +
+
+
+ + + + +``` + +### Example 2: Adding External Libraries + +To use visualization libraries like D3.js: + +```html + + + + + +``` + +### Example 3: Jupyter Notebook Integration + +To embed Jupyter notebooks: + +1. Export your notebook as HTML: + ```bash + jupyter nbconvert --to html your_notebook.ipynb + ``` + +2. Add a link in the demos section: + ```html +
+

Circuit Analysis Notebook

+

Interactive Python notebook exploring circuit analysis techniques.

+ Open Notebook +
+ ``` + +## Styling Examples + +### Custom Color Scheme + +Update CSS variables in `styles.css`: + +```css +:root { + --primary-color: #10b981; /* Green theme */ + --secondary-color: #3b82f6; /* Blue accent */ + --dark-bg: #111827; +} +``` + +### Adding Animations + +Add custom animations: + +```css +@keyframes fadeInUp { + from { + opacity: 0; + transform: translateY(30px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +.research-card { + animation: fadeInUp 0.6s ease-out; +} +``` + +## JavaScript Examples + +### Example 1: Dynamic Content Loading + +```javascript +// Load research papers dynamically +async function loadResearchPapers() { + const response = await fetch('data/papers.json'); + const papers = await response.json(); + + const container = document.querySelector('.research-grid'); + papers.forEach(paper => { + const card = document.createElement('div'); + card.className = 'research-card'; + card.innerHTML = ` +

${paper.title}

+

${paper.description}

+ Read More + `; + container.appendChild(card); + }); +} +``` + +### Example 2: Interactive Filters + +```javascript +// Add filtering functionality +function setupFilters() { + const filterButtons = document.querySelectorAll('.filter-btn'); + const cards = document.querySelectorAll('.research-card'); + + filterButtons.forEach(button => { + button.addEventListener('click', () => { + const category = button.dataset.category; + + cards.forEach(card => { + if (category === 'all' || card.dataset.category === category) { + card.style.display = 'block'; + } else { + card.style.display = 'none'; + } + }); + }); + }); +} +``` + +## Common Patterns + +### Responsive Images + +```html +Descriptive text +``` + +### Modal Dialogs + +```javascript +function createModal(title, content) { + const modal = document.createElement('div'); + modal.className = 'modal'; + modal.innerHTML = ` + + `; + document.body.appendChild(modal); + + modal.querySelector('.close').onclick = () => modal.remove(); +} +``` + +## Best Practices + +1. **Keep it Simple**: Start with simple examples and add complexity gradually +2. **Mobile First**: Design for mobile devices first, then enhance for desktop +3. **Accessibility**: Use semantic HTML and ARIA labels +4. **Performance**: Optimize images and minimize JavaScript +5. **Documentation**: Comment your code and update docs when adding features + +## Additional Resources + +- [MDN Web Docs](https://developer.mozilla.org/) - Web development reference +- [D3.js Gallery](https://observablehq.com/@d3/gallery) - Visualization examples +- [Three.js Examples](https://threejs.org/examples/) - 3D visualization examples diff --git a/docs/getting-started.md b/docs/getting-started.md new file mode 100644 index 0000000..03bfab8 --- /dev/null +++ b/docs/getting-started.md @@ -0,0 +1,99 @@ +# Getting Started + +## Quick Start + +This guide will help you get started with the Mechanistic Interpretability Showcase. + +### Viewing the Showcase + +The easiest way to view the showcase is to open `index.html` in your web browser. + +#### Method 1: Direct File Opening + +Simply double-click the `index.html` file in your file explorer, and it will open in your default browser. + +#### Method 2: Local Web Server (Recommended) + +Using a local web server provides a better development experience: + +**Using Python:** +```bash +# Navigate to the project directory +cd MechanisticInterpretabilityShowcase + +# Start a simple HTTP server +python -m http.server 8000 + +# Open http://localhost:8000 in your browser +``` + +**Using Node.js:** +```bash +# Install http-server globally (one-time setup) +npm install -g http-server + +# Start the server +http-server + +# Open http://localhost:8080 in your browser +``` + +**Using VS Code:** +1. Install the "Live Server" extension +2. Right-click `index.html` +3. Select "Open with Live Server" + +### Project Structure + +``` +MechanisticInterpretabilityShowcase/ +├── index.html # Main HTML page +├── styles.css # Styling and layout +├── script.js # Interactive functionality +├── docs/ # Documentation +│ ├── README.md # Documentation home +│ ├── getting-started.md # This file +│ └── examples.md # Example use cases +├── .gitignore # Git ignore file +├── README.md # Project README +└── LICENSE # License information +``` + +### Customizing the Showcase + +#### 1. Update Content + +Edit `index.html` to modify: +- Hero section text +- Research topics +- Demo descriptions +- About section + +#### 2. Change Styling + +Edit `styles.css` to customize: +- Colors (defined in CSS variables) +- Fonts +- Layout +- Animations + +#### 3. Add Interactivity + +Edit `script.js` to add: +- Custom animations +- Interactive features +- Data visualizations +- User interactions + +### Next Steps + +1. Explore the [Examples](examples.md) to see what you can build +2. Check out the main [README](../README.md) for contribution guidelines +3. Visit the showcase page to see the interface + +## Need Help? + +If you encounter any issues or have questions: +- Check the documentation in the `docs/` folder +- Open an issue on [GitHub](https://github.com/PrecisionNeuroLab/MechanisticInterpretabilityShowcase/issues) +- Review the examples for common patterns diff --git a/index.html b/index.html new file mode 100644 index 0000000..c9e289b --- /dev/null +++ b/index.html @@ -0,0 +1,99 @@ + + + + + + Mechanistic Interpretability Showcase + + + +
+ +
+ +
+
+
+

Mechanistic Interpretability Tools

+

Exploring and understanding the inner workings of neural networks

+ +
+
+ +
+
+

Our Research

+

+ We develop cutting-edge tools and techniques for understanding how neural networks process information + and make decisions. Our work focuses on making AI systems more transparent and interpretable. +

+
+
+

Feature Visualization

+

Tools for visualizing what neurons and layers learn in neural networks.

+
+
+

Circuit Analysis

+

Methods for identifying and understanding computational circuits within models.

+
+
+

Activation Patterns

+

Techniques for analyzing how information flows through network architectures.

+
+
+
+
+ +
+
+

Interactive Demos

+

+ Explore our interactive demonstrations to see mechanistic interpretability in action. +

+
+
+

Coming Soon

+

Interactive demos will be added here to showcase our interpretability tools.

+
+
+
+
+ +
+
+

About

+

+ This showcase presents mechanistic interpretability tools developed by the Precision Neuro Lab. + Our mission is to make neural networks more understandable and transparent through rigorous + analysis and visualization techniques. +

+
+

Get Involved

+

Check out our GitHub repository to learn more or contribute.

+
+
+
+
+ + + + + + diff --git a/script.js b/script.js new file mode 100644 index 0000000..1e6d66b --- /dev/null +++ b/script.js @@ -0,0 +1,68 @@ +// Smooth scrolling for navigation links +document.querySelectorAll('a[href^="#"]').forEach(anchor => { + anchor.addEventListener('click', function (e) { + e.preventDefault(); + const target = document.querySelector(this.getAttribute('href')); + if (target) { + target.scrollIntoView({ + behavior: 'smooth', + block: 'start' + }); + } + }); +}); + +// Add active state to navigation links based on scroll position +const sections = document.querySelectorAll('section[id]'); +const navLinks = document.querySelectorAll('.nav-links a'); + +function updateActiveNavLink() { + let current = ''; + sections.forEach(section => { + const sectionTop = section.offsetTop; + const sectionHeight = section.clientHeight; + if (window.scrollY >= sectionTop - 100) { + current = section.getAttribute('id'); + } + }); + + navLinks.forEach(link => { + link.classList.remove('active'); + if (link.getAttribute('href').slice(1) === current) { + link.classList.add('active'); + } + }); +} + +window.addEventListener('scroll', updateActiveNavLink); +window.addEventListener('load', updateActiveNavLink); + +// Add animation on scroll for cards +const observerOptions = { + threshold: 0.1, + rootMargin: '0px 0px -100px 0px' +}; + +const observer = new IntersectionObserver(function(entries) { + entries.forEach(entry => { + if (entry.isIntersecting) { + entry.target.style.opacity = '1'; + entry.target.style.transform = 'translateY(0)'; + } + }); +}, observerOptions); + +// Observe all cards +document.addEventListener('DOMContentLoaded', function() { + const cards = document.querySelectorAll('.research-card, .demo-card'); + cards.forEach(card => { + card.style.opacity = '0'; + card.style.transform = 'translateY(20px)'; + card.style.transition = 'opacity 0.6s ease, transform 0.6s ease'; + observer.observe(card); + }); +}); + +// Add console message for developers +console.log('%c🧠 Mechanistic Interpretability Showcase', 'font-size: 20px; font-weight: bold; color: #2563eb;'); +console.log('Exploring the inner workings of neural networks. Check out our GitHub: https://github.com/PrecisionNeuroLab/MechanisticInterpretabilityShowcase'); diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..2192982 --- /dev/null +++ b/styles.css @@ -0,0 +1,302 @@ +/* Reset and Base Styles */ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +:root { + --primary-color: #2563eb; + --secondary-color: #7c3aed; + --dark-bg: #1e293b; + --light-bg: #f8fafc; + --text-dark: #1e293b; + --text-light: #64748b; + --white: #ffffff; + --border-radius: 8px; + --transition: all 0.3s ease; +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; + line-height: 1.6; + color: var(--text-dark); + background-color: var(--white); +} + +.container { + max-width: 1200px; + margin: 0 auto; + padding: 0 2rem; +} + +/* Navigation */ +.navbar { + background-color: var(--dark-bg); + padding: 1rem 0; + position: sticky; + top: 0; + z-index: 1000; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); +} + +.navbar .container { + display: flex; + justify-content: space-between; + align-items: center; +} + +.logo { + color: var(--white); + font-size: 1.5rem; + font-weight: 700; +} + +.nav-links { + display: flex; + list-style: none; + gap: 2rem; +} + +.nav-links a { + color: var(--white); + text-decoration: none; + transition: var(--transition); + font-weight: 500; +} + +.nav-links a:hover { + color: var(--primary-color); +} + +.nav-links a.active { + color: var(--primary-color); + position: relative; +} + +.nav-links a.active::after { + content: ''; + position: absolute; + bottom: -8px; + left: 0; + width: 100%; + height: 2px; + background-color: var(--primary-color); +} + +/* Hero Section */ +.hero { + background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); + color: var(--white); + padding: 6rem 0; + text-align: center; +} + +.hero-title { + font-size: 3rem; + font-weight: 800; + margin-bottom: 1rem; + line-height: 1.2; +} + +.hero-subtitle { + font-size: 1.25rem; + margin-bottom: 2rem; + opacity: 0.95; +} + +.hero-buttons { + display: flex; + gap: 1rem; + justify-content: center; + flex-wrap: wrap; +} + +/* Buttons */ +.btn { + padding: 0.75rem 2rem; + border-radius: var(--border-radius); + text-decoration: none; + font-weight: 600; + transition: var(--transition); + display: inline-block; + cursor: pointer; + border: 2px solid transparent; +} + +.btn-primary { + background-color: var(--white); + color: var(--primary-color); +} + +.btn-primary:hover { + transform: translateY(-2px); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); +} + +.btn-secondary { + background-color: transparent; + color: var(--white); + border-color: var(--white); +} + +.btn-secondary:hover { + background-color: var(--white); + color: var(--primary-color); +} + +/* Sections */ +section { + padding: 5rem 0; +} + +.section-title { + font-size: 2.5rem; + font-weight: 700; + margin-bottom: 1rem; + text-align: center; + color: var(--text-dark); +} + +.section-description { + font-size: 1.125rem; + color: var(--text-light); + text-align: center; + max-width: 800px; + margin: 0 auto 3rem; +} + +/* Research Section */ +.research-section { + background-color: var(--light-bg); +} + +.research-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); + gap: 2rem; + margin-top: 3rem; +} + +.research-card { + background-color: var(--white); + padding: 2rem; + border-radius: var(--border-radius); + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + transition: var(--transition); +} + +.research-card:hover { + transform: translateY(-4px); + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); +} + +.research-card h3 { + font-size: 1.5rem; + color: var(--primary-color); + margin-bottom: 1rem; +} + +.research-card p { + color: var(--text-light); +} + +/* Demos Section */ +.demos-section { + background-color: var(--white); +} + +.demos-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); + gap: 2rem; + margin-top: 3rem; +} + +.demo-card { + background-color: var(--light-bg); + padding: 2rem; + border-radius: var(--border-radius); + border: 2px dashed var(--text-light); + text-align: center; +} + +.demo-card h3 { + font-size: 1.5rem; + margin-bottom: 1rem; + color: var(--text-dark); +} + +.demo-card p { + color: var(--text-light); +} + +/* About Section */ +.about-section { + background-color: var(--light-bg); +} + +.about-text { + max-width: 800px; + margin: 0 auto 2rem; + font-size: 1.125rem; + color: var(--text-light); + text-align: center; +} + +.cta { + background-color: var(--white); + padding: 2rem; + border-radius: var(--border-radius); + text-align: center; + max-width: 600px; + margin: 0 auto; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); +} + +.cta h3 { + color: var(--primary-color); + margin-bottom: 1rem; +} + +.cta a { + color: var(--primary-color); + text-decoration: none; + font-weight: 600; +} + +.cta a:hover { + text-decoration: underline; +} + +/* Footer */ +footer { + background-color: var(--dark-bg); + color: var(--white); + text-align: center; + padding: 2rem 0; +} + +/* Responsive Design */ +@media (max-width: 768px) { + .hero-title { + font-size: 2rem; + } + + .hero-subtitle { + font-size: 1rem; + } + + .nav-links { + gap: 1rem; + } + + .section-title { + font-size: 2rem; + } + + .research-grid, + .demos-grid { + grid-template-columns: 1fr; + } +}