Ml Engineering logo

Ml Engineering

CommunityPopular
stas00
ml-engineering

Field-tested methodology and concrete recipes for training and operating large-scale LLM/VLM/multi-modal models end to end - choosing and benchmarking accelerators, storage and network; SLURM/Kubernetes orchestration; maximizing training throughput and fitting models in memory; diagnosing and surviving training instabilities, NaN/Inf, and hardware/job failures; checkpointing and fault tolerance; inference performance and memory; debugging multi-node/ multi-GPU hangs; and writing/running tests. Use when the user is training or fine-tuning large models, hits low TFLOPS/MFU, OOM, slow dataloading, a loss spike/divergence, a NCCL/InfiniBand or multi-node hang, node/GPU failures, checkpoint or preemption problems, storage/network bottlenecks, or needs to pick GPUs/cloud/file-systems or size inference latency/throughput. Distilled from "Machine Learning Engineering", the latest version of which can be found at https://github.com/stas00/ml-engineering The latest SKILL.md version can be found at https://github.com/stas00/ml-engineering/blob/master/SKILL.md

Overview

Publisherstas00
Repositoryml-engineering
Skill nameml-engineering
Stars
19K
Forks
1.2K
Bundled files
182
LicenseCC-BY-SA-4.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 182 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by stas00 on GitHub. Read the source before you install it.

Installation

Install the Ml Engineering AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/stas00/ml-engineering.git \
  .claude/skills/ml-engineering
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Ml Engineering in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Ml Engineering on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Ml Engineering is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Machine Learning Engineering

Distilled from Machine Learning Engineering Open Book by Stas Bekman - source: https://github.com/stas00/ml-engineering (CC BY-SA 4.0). Know-how from training BLOOM-176B, IDEFICS-80B and production RAG and RL training and inference systems. This skill is a condensed index; each section links back to the full chapter for depth, scripts, and benchmarks.

A field-tested, end-to-end guide to training and serving large models (LLMs, VLMs, multi-modal, RAG) on real hardware at scale - distilled from actually training BLOOM-176B and IDEFICS-80B and building production inference/RAG systems. It is a practitioner's brain dump: opinionated guidance backed by copy-paste scripts, benchmark tools, and comparison tables, written for the engineers and operators who have to make expensive clusters actually deliver a finished model.

It spans the entire stack that decides whether a run succeeds and how much it costs: selecting and benchmarking accelerators, storage, and network so the fast compute is never starved; orchestrating jobs with SLURM/Kubernetes; maximizing throughput (MFU) and fitting models in memory via parallelism (DP/TP/PP/ZeRO), activation recomputation, and offload; keeping training numerically stable through loss spikes and NaN/Inf; and surviving the inevitable hardware and job failures with frequent checkpointing, spare capacity, and automatic restarts. On the serving side it covers inference latency/throughput/cost trade-offs, KV-cache and memory sizing, and framework selection - plus diagnosing multi-node/multi-GPU hangs and testing the whole thing.

Use it as an operator's runbook: figure out which resource is actually the bottleneck (compute? memory? network? storage? dataloader?), then jump to the targeted recipe. For pure debugging technique (gdb/strace/py-spy/CUDA), pair this with The Art of Debugging.

Core principles

  • Measure, don't assume. Vendor/theoretical TFLOPS are marketing; benchmark your hardware and software stack before optimizing or buying. Track MFU/throughput, not vibes.
  • Find the actual bottleneck. A training step is gated by the slowest of: accelerator compute, memory bandwidth/capacity, inter/intra-node network, storage IO, or CPU dataloading. Optimizing anything else is wasted effort.
  • At scale, failure is the steady state. With hundreds/thousands of accelerators, hardware will fail mid-run. Design for frequent checkpoints, automatic restarts, spare nodes, and kill/save switches from day one.
  • Reproduce small and fast. Debug on a tiny model / few layers / one node before burning cluster time - see The Art of Debugging.
  • Watch the logbooks. Others have already hit your instability; training chronicles document the loss spikes and the fixes. See LLM/VLM chronicles.

Compute / accelerators

Full chapter: Compute · Accelerators.

Storage (IO)

Full chapter: Storage.

  • Pick the file system for the job: distributed/parallel FS for shared checkpoints and datasets; fast local NVMe beats network storage for scratch/hot data. See which file system to choose and local storage beats cloud storage.
  • Benchmark IO before you trust it (checkpoint save/load and dataset streaming are common stalls). See storage benchmarks.
  • Gotchas that bite at scale: you often get less usable capacity than sold; some clouds put backups on the same partition; always keep checksums. Clean up instead of overpaying - see why pay for more storage.

Network

Full chapter: Network.

Orchestration & SLURM

Full chapter: Orchestration · SLURM · Kubernetes.

  • Verify the cluster before the big run: every GPU on every node must talk to every other. Run torch-distributed-gpu-test.py across all nodes first.
  • SLURM day-to-day: the users cheatsheet covers sbatch/srun/salloc, job arrays, dependencies, and inspecting the queue; keep the allocation and re-srun for fast debug iterations.
  • Launchers (torchrun/accelerate/deepspeed under SLURM): see launchers.

Training: performance & memory

Full chapter: Performance.

Training: stability (instabilities & NaN/Inf)

Full chapter: Instabilities.

Training: fault tolerance & checkpoints

Full chapter: Fault tolerance · Checkpoints.

Inference

Full chapter: Inference.

Debugging distributed / PyTorch at scale

Full chapter: Debugging · PyTorch.

Testing

Full chapter: Testing.

  • Run tests surgically (select, parametrize, repeat, control output/parallelism): running tests.
  • Write robust tests (fixtures, temp dirs, RNG control for reproducibility, distributed tests): writing tests.
  • When a test misbehaves: debugging tests.

Key tools

NeedTool
Verify all GPUs/nodes can talk & allocatetorch-distributed-gpu-test.py
Real network throughput (all-reduce busbw)all_reduce_bench.py
Actual achievable matmul FLOPS of an acceleratormamf-finder.py
Tiny models/tokenizers/datasets for fast iterationmake-tiny guide
Better trace for distributed hangsNicerTrace

Pick the fix by symptom

SymptomReach for
Low TFLOPS / MFU, "GPUs feel idle"Find the bottleneck: mamf-finder, performance checklist, DataLoader, NUMA, dim divisibility
Training OOMMemory anatomy → activation checkpointing/offload/parallelism; profile; PYTORCH_ALLOC_CONF
Slow steps but GPUs busy on commsBenchmark network (all_reduce_bench), check intra/inter-node, NCCL settings
Slow dataloading / GPU starvationDataLoader, local NVMe, prefetch/workers
Loss spike / divergence / NaNLogbooks, init/STD, underflow-overflow detection, tensor scans
Multi-node/GPU hang or deadlocktorch-distributed-gpu-test.pypy-spy all ranks → NCCL_DEBUG=INFO
Node/GPU dies mid-runSpare nodes, frequent checkpoints, auto-restart, kill/save switch
Job keeps getting preemptedforced preemption, queue chained jobs
Checkpoint save/load is slowBenchmark storage, choose FS, local vs shared
Choosing GPUs / cloud / storageComparison tables, MAMF, choose a cloud provider
Inference too slow / won't fitMetrics (TTFT/TPOT), KV-cache memory, framework choice, model-load speedups

Notes for AI agents

  • Diagnose before optimizing. Identify which resource (compute/memory/network/storage/dataloader) is the actual bottleneck with a measurement; don't tune blindly.
  • Prefer measured numbers over spec sheets. Use the provided benchmark scripts on the target hardware/software stack before recommending changes or purchases.
  • Assume failures at scale. For any long/large run, verify checkpointing, restart, spare capacity, and a kill switch exist before worrying about peak speed.
  • Verify the cluster first. Run the distributed connectivity test before blaming model code for a multi-node problem.
  • Reuse the community's hard-won lessons. Check the training logbooks for known instabilities and fixes before re-deriving them.
  • Read the linked chapter section before applying a recipe - each has worked examples, exact commands, caveats, and scripts.
  • For deep single-process/tool debugging (gdb, strace, py-spy, cProfile, core files), use the companion skill: The Art of Debugging.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

and 122 more files.

Frequently asked questions

What does the Ml Engineering AI skill do?

Field-tested methodology and concrete recipes for training and operating large-scale LLM/VLM/multi-modal models end to end - choosing and benchmarking accelerators, storage and network; SLURM/Kubernetes orchestration; maximizing training throughput and fitting models in memory; diagnosing and surviving training instabilities, NaN/Inf, and hardware/job failures; checkpointing and fault tolerance; inference performance and memory; debugging multi-node/ multi-GPU hangs; and writing/running tests. Use when the user is training or fine-tuning large models, hits low TFLOPS/MFU, OOM, slow dataload...

Why use Ml Engineering on TypingMind?

Because you install it once and use it with any model. Ml Engineering is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Ml Engineering in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/stas00/ml-engineering/tree/master. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Ml Engineering?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Ml Engineering?

As many as you like. As long as a model supports skills, you can use Ml Engineering with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Ml Engineering AI skill free?

Yes. It is published on GitHub by stas00 under the CC-BY-SA-4.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇