https://github.com/kako-jun/diffai
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.7%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: kako-jun
- License: mit
- Language: Rust
- Default Branch: main
- Size: 15.6 MB
Statistics
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 11
Metadata Files
README.md
diffai
AI/ML specialized diff tool for PyTorch, Safetensors, NumPy, and MATLAB files
🤔 The Problem
Traditional diff tools fail completely with AI/ML workflows:
mermaid
graph LR
A[ML Engineer] --> B[Compare Models]
B --> C{Traditional Tools}
C --> D["❌ Binary files differ"]
C --> E["❌ No semantic understanding"]
C --> F["❌ Memory issues with GB+ files"]
D --> G[😞 No actionable insights]
E --> G
F --> G
Reality Check: When you need to compare two PyTorch models, git diff and standard tools give you nothing useful.
✨ The Solution
diffai automatically analyzes AI/ML files and provides 11 specialized ML analysis functions without any configuration:
mermaid
graph LR
A[ML Engineer] --> B[diffai model1.pt model2.pt]
B --> C[🎯 11 Auto ML Analyses]
C --> D[📊 Learning Rate Changes]
C --> E[🔍 Gradient Health]
C --> F[⚡ Quantization Effects]
C --> G[📈 Convergence Patterns]
D --> H[✅ Actionable Insights]
E --> H
F --> H
G --> H
Convention over Configuration: No setup required - diffai detects AI/ML files and runs comprehensive analysis automatically.
🆚 vs Traditional Tools
| Challenge | Traditional Tools | diffai | |-----------|------------------|---------| | Binary model files | "Binary files differ" | 11 specialized ML analyses + tensor statistics | | Large files (GB+) | Memory issues or failures | Efficient streaming with lawkit patterns | | ML semantics | No understanding | Learning rate, gradients, quantization detection | | Automation | Manual inspection required | JSON output for MLOps integration | | Scientific data | Text-only comparison | NumPy/MATLAB statistical analysis |
🚀 Quick Demo
```bash
Traditional diff: Useless for ML files
$ diff modelv1.safetensors modelv2.safetensors Binary files modelv1.safetensors and modelv2.safetensors differ
diffai: Comprehensive ML analysis automatically
$ diffai modelv1.safetensors modelv2.safetensors learningrateanalysis: old=0.001, new=0.0015, change=+50.0%, trend=increasing optimizercomparison: type=Adam, momentumchange=+2.1%, stateevolution=stable gradientanalysis: flowhealth=healthy, norm=0.021069, variancechange=+15.3% quantizationanalysis: mixedprecision=FP16+FP32, compression=12.5%, precisionloss=1.2% convergenceanalysis: status=converging, stability=0.92, plateau_detected=false
... + 6 more analyses automatically
~ fc1.weight: mean=-0.0002->-0.0001, std=0.0514->0.0716 ~ fc2.weight: mean=-0.0008->-0.0018, std=0.0719->0.0883 ```
✅ What diffai CAN do today
- PyTorch/Safetensors files: 11 automatic ML analysis functions
- NumPy/MATLAB files: Comprehensive tensor statistics (shape, mean, std, dtype)
- Multiple output formats: Human-readable CLI, JSON for automation, YAML for reports
- Memory efficient: Handles GB+ model files with streaming processing
- Zero configuration: Automatic analysis based on file format detection
- MLOps integration: JSON output for CI/CD pipelines and automation
❌ What diffai CANNOT do (be realistic)
- ❌ TensorFlow formats (.pb, .h5, SavedModel) - Use TensorBoard for these
- ❌ ONNX models - Consider netron for visualization
- ❌ Live training monitoring - Use wandb/tensorboard for real-time tracking
- ❌ Model performance prediction - Shows changes, not absolute performance
- ❌ Automatic hyperparameter tuning - Analysis only, no recommendations yet
- ❌ General text/code files - Use diffx for JSON/YAML/CSV
🔄 When to use diffai vs alternatives
| Your Goal | Use This Instead | Why | |-----------|------------------|-----| | Live training monitoring | TensorBoard, wandb | Real-time visualization during training | | Model architecture visualization | netron, torchviz | Interactive network diagrams | | Experiment tracking | MLflow, Neptune | Full experiment lifecycle management | | Performance benchmarking | MLPerf, custom scripts | Focused on inference/training speed | | General file comparison | diffx, git diff | Text-based structured data |
diffai is best for: Post-training model comparison, checkpoint analysis, and MLOps automation.
📥 Installation
```bash
From crates.io (recommended)
cargo install diffai
From source
git clone https://github.com/kako-jun/diffai.git cd diffai && cargo build --release ```
🎯 Common Use Cases
Research & Development
```bash
Compare before/after fine-tuning
diffai pretrainedmodel.pt finetunedmodel.pt
Auto-detects: parameter changes, convergence patterns, gradient health
```
MLOps & CI/CD
```bash
Automated model validation in pipelines
diffai productionmodel.safetensors candidatemodel.safetensors --output json
Pipe to automated decision making based on analysis results
```
Model Optimization
```bash
Analyze quantization effects
diffai full_precision.pt quantized.pt
Auto-detects: compression ratios, precision loss, performance impact
```
📚 Documentation
- Quick Start - Get up and running in 5 minutes
- ML Analysis - Understand the 11 automatic ML analysis functions
- File Formats - Supported formats and output options
- Examples - Real usage examples and outputs
- API Reference - Programming interfaces (Rust/Python/JavaScript)
- CLI Reference - Command-line options and usage
🔧 Technical Details
Supported Formats
- PyTorch (.pt, .pth) - Full ML analysis + tensor statistics
- Safetensors (.safetensors) - Full ML analysis + tensor statistics
- NumPy (.npy, .npz) - Tensor statistics only
- MATLAB (.mat) - Tensor statistics only
The 11 Automatic ML Analysis Functions
- Learning Rate Analysis - Training dynamics tracking
- Optimizer Comparison - Adam/SGD state analysis
- Loss Tracking - Convergence pattern detection
- Accuracy Tracking - Performance metric evolution
- Model Version Analysis - Checkpoint progression
- Gradient Analysis - Flow health, vanishing/exploding detection
- Quantization Analysis - Mixed precision (FP32/FP16/INT8/INT4) detection
- Convergence Analysis - Learning curves, plateau detection
- Activation Analysis - ReLU/GELU/Tanh distribution
- Attention Analysis - Transformer mechanism detection
- Ensemble Analysis - Multi-model structure detection
Output Formats
```bash
Human-readable (default)
diffai model1.pt model2.pt
JSON for automation
diffai model1.pt model2.pt --output json
YAML for reports
diffai model1.pt model2.pt --output yaml
Verbose diagnostics
diffai model1.pt model2.pt --verbose ```
🏗️ Built With
- Rust - Performance and memory safety
- diffx-core - Proven diff engine foundation
- lawkit patterns - Memory-efficient incremental statistics
- Convention over Configuration - Zero-setup philosophy
🤝 Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
bash
git clone https://github.com/kako-jun/diffai.git
cd diffai
cargo build && cargo test
📄 License
MIT License - see LICENSE file for details.
🔗 Related Projects
- diffx - General-purpose structured data diff (JSON, YAML, CSV, XML)
- lawkit - Memory-efficient data processing patterns
- safetensors - Safe tensor storage format
Bottom line: diffai gives you actionable insights from AI/ML model comparisons that traditional tools simply cannot provide. No setup required - just point it at your models and get comprehensive analysis automatically.
Owner
- Name: kako-jun
- Login: kako-jun
- Kind: user
- Location: Kanazawa, Japan
- Company: a taxpayer
- Website: https://llll-ll.com
- Repositories: 71
- Profile: https://github.com/kako-jun
too low visual acuity :eyeglasses: + too slow moving speed :ant: + too happy with coding :cake: === 42
GitHub Events
Total
- Create event: 23
- Issues event: 4
- Release event: 18
- Watch event: 1
- Delete event: 12
- Push event: 83
- Pull request event: 6
Last Year
- Create event: 23
- Issues event: 4
- Release event: 18
- Watch event: 1
- Delete event: 12
- Push event: 83
- Pull request event: 6
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| kako-jun | 3****n | 79 |
| github-actions[bot] | g****] | 1 |
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 2
- Total pull requests: 2
- Average time to close issues: 1 day
- Average time to close pull requests: 1 day
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 2
- Average time to close issues: 1 day
- Average time to close pull requests: 1 day
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- kako-jun (3)
Pull Request Authors
- kako-jun (5)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 4
-
Total downloads:
- cargo 9,893 total
- pypi 87 last-month
- npm 41 last-month
-
Total dependent packages: 0
(may contain duplicates) -
Total dependent repositories: 0
(may contain duplicates) - Total versions: 61
- Total maintainers: 2
pypi.org: diffai-python
AI/ML specialized diff tool for deep tensor comparison and analysis
- Homepage: https://github.com/kako-jun/diffai
- Documentation: https://github.com/kako-jun/diffai/blob/main/docs/
- License: MIT
-
Latest release: 0.3.16
published about 1 year ago
Rankings
Maintainers (1)
npmjs.org: diffai-js
A Node.js wrapper for the diffai CLI tool - AI/ML specialized diff tool for PyTorch, Safetensors, NumPy, and MATLAB files with deep tensor analysis
- Homepage: https://github.com/kako-jun/diffai
- License: MIT
-
Latest release: 0.3.16
published about 1 year ago
Rankings
Maintainers (1)
Funding
- type: github
- url: https://github.com/sponsors/kako-jun
crates.io: diffai-core
Core library for AI/ML diff analysis - PyTorch, Safetensors, tensor statistics, structured data
- Homepage: https://github.com/kako-jun/diffai
- Documentation: https://docs.rs/diffai-core/
- License: MIT
-
Latest release: 0.3.16
published about 1 year ago
Rankings
Maintainers (1)
crates.io: diffai
AI/ML specialized diff CLI - PyTorch, Safetensors model comparison, tensor analysis
- Homepage: https://github.com/kako-jun/diffai
- Documentation: https://docs.rs/diffai/
- License: MIT
-
Latest release: 0.3.16
published about 1 year ago
Rankings
Maintainers (1)
Dependencies
- 129 dependencies
- huggingface-hub >=0.20.0
- requests >=2.31.0
- urllib3 >=2.0.0