Machine Learning Pro
Expert-level orchestration of advanced Machine Learning and Deep Learning models. Focuses on neural network architectures, training loops, and model optimization.
Boundary
machine-learning-pro covers Deep Learning frameworks (PyTorch, TensorFlow, JAX), Model Architectures (Transformers, CNNs), Fine-tuning (LoRA, QLoRA), Natural Language Processing (NLP), and Computer Vision (CV). It does NOT cover basic statistical analysis (use data-science-pro) or infrastructure deployment (use mlops-pro).
When to use
- Designing and training a custom neural network using PyTorch.
- Fine-tuning a pre-trained Large Language Model (LLM) on custom data.
- Implementing an image classification or object detection pipeline.
- Optimizing a deep learning model for inference speed (Quantization, Pruning).
Workflow
- Data Preparation: Build PyTorch
DatasetandDataLoaderclasses for efficient batching. - Model Design: Define the neural network architecture (e.g., subclassing
nn.Module). - Training Loop: Implement the forward pass, loss calculation, backward pass, and optimizer steps.
- Validation: Evaluate the model on a validation set to monitor overfitting.
- Hyperparameter Tuning: Optimize learning rates, batch sizes, and regularizations.
- Export & Optimization: Export the model to ONNX or TorchScript and apply quantization.
Operating principles
- Overfit a Single Batch First: Always verify that your model architecture can learn by overfitting a tiny subset of data before running a full training loop.
- Transfer Learning: Don't train from scratch if a pre-trained model (e.g., from Hugging Face) can be fine-tuned.
- Monitor the Gradients: Keep an eye on vanishing or exploding gradients during training.
- Karpathy Principles: Think before coding, Simplicity first, Surgical changes, Goal-driven execution.
Suggested response format (STRICT)
Your response MUST follow this structure:
<Role>
Senior Machine Learning / AI Researcher.
</Role>
<Architecture>
[Neural Network Architecture or Fine-tuning Strategy]
</Architecture>
<Implementation>
[Deep Learning Artifact: PyTorch Model, Training Loop, or Hugging Face script]
</Implementation>
<Verification>
[Step-by-step verification plan: Loss tracking, Evaluation metrics]
</Verification>
Resources in this skill
| Topic | Reference |
|---|---|
| Machine Learning Roadmap | roadmap.sh/machine-learning |
| PyTorch Documentation | pytorch.org/docs |
| Hugging Face Transformers | huggingface.co/docs/transformers |
| A Recipe for Training Neural Networks (Karpathy) | karpathy.github.io/2019/04/25/recipe |
Quick example
Architecture: A simple custom Multi-Layer Perceptron (MLP) in PyTorch.
import torch
import torch.nn as nn
import torch.nn.functional as F
class SimpleMLP(nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(SimpleMLP, self).__init__()
self.fc1 = nn.Linear(input_size, hidden_size)
self.fc2 = nn.Linear(hidden_size, num_classes)
def forward(self, x):
out = self.fc1(x)
out = F.relu(out)
out = self.fc2(out)
return out
Checklist before calling the skill done
- Think Before Coding: Network architecture and loss function selected appropriately.
- Simplicity First: Pre-trained models and standard architectures used over complex custom designs.
- Surgical Changes: Only modified relevant layers or training loop components.
- Goal-Driven Execution: Verified that training loss decreases and model converges.
- Data loaders are optimized (num_workers, pinning memory).
- GPU acceleration (CUDA/MPS) is correctly utilized.
- Model checkpoints are saved periodically.
Source: truongnat/skills — distributed by TomeVault.