AllenAI Open Instruct Tulu 3 Post-Training with SFT, DPO, RLVR, GRPO, and Verifier-Based Evaluation AllenAI's Open Instruct framework was used to build an end-to-end post-training pipeline for a compact instruction-tuned language model, integrating Supervised Fine-Tuning, Direct Preference Optimization, and Reinforcement Learning with Verifiable Rewards using GRPO, while adapting the original multi-GPU Tulu 3 stack to fit within a 16 GB runtime. The tutorial clones the Open Instruct repository, configures LoRA adapters, prepares GSM8K data, and uses deterministic verifiers to evaluate mathematical answers, replacing distributed components like vLLM and Ray with lightweight Hugging Face and PyTorch implementations for Colab. In this tutorial, we build an end-to-end post-training pipeline for a compact instruction-tuned language model using AllenAI’s Open Instruct https://github.com/allenai/open-instruct framework. We move through three major training stages: Supervised Fine-Tuning, Direct Preference Optimization, and Reinforcement Learning with Verifiable Rewards using GRPO, while adapting the original multi-GPU Tulu 3 stack to fit within a 16 GB runtime. We clone the Open Instruct repository, selectively load its native loss and utility functions, configure LoRA adapters, prepare GSM8K data for each training stage, and use deterministic verifiers to evaluate generated mathematical answers. Throughout the workflow, we preserve the core optimization logic of Open Instruct while replacing distributed components such as vLLM, Ray actors, DeepSpeed, and asynchronous rollout queues with lightweight Hugging Face and PyTorch implementations suitable for Colab. python import os, sys, subprocess, textwrap, json, math, random, re, ast, types, dataclasses, gc, contextlib REPO URL = "https://github.com/allenai/open-instruct.git" REPO DIR = "/content/open-instruct" if os.path.isdir "/content" else "./open-instruct" PIP PKGS = "peft", "accelerate", "ray", "wandb", "beaker-py", "langdetect==1.0.9", "immutabledict==1.2.0", "nltk", "absl-py", "sympy", "antlr4-python3-runtime==4.11", "tiktoken", def sh args : print "$", " ".join args subprocess.run args, check=False def setup : sh sys.executable, "-m", "pip", "install", "-q", PIP PKGS if not os.path.isdir REPO DIR : sh "git", "clone", "--depth", "1", REPO URL, REPO DIR if REPO DIR not in sys.path: sys.path.insert 0, REPO DIR os.environ.setdefault "WANDB MODE", "disabled" os.environ.setdefault "TOKENIZERS PARALLELISM", "false" os.environ.setdefault "RAY DISABLE IMPORT WARNING", "1" setup import numpy as np import torch import torch.nn.functional as F from torch.utils.data import DataLoader from datasets import load dataset, Dataset from transformers import AutoModelForCausalLM, DataCollatorForSeq2Seq, get cosine schedule with warmup from peft import LoraConfig, get peft model DEV = "cuda" if torch.cuda.is available else "cpu" try: bf16 = DEV == "cuda" and torch.cuda.is bf16 supported including emulation=False except TypeError: bf16 = DEV == "cuda" and torch.cuda.get device properties 0 .major = 8 AMP DTYPE = torch.bfloat16 if bf16 else torch.float16 USE SCALER = AMP DTYPE is torch.float16 print f"device={DEV} autocast dtype={AMP DTYPE} gpu={torch.cuda.get device name 0 if DEV=='cuda' else '-'}" def oi load relpath, names, ns=None : src = open os.path.join REPO DIR, relpath .read tree = ast.parse src found = {n.name: n for n in tree.body if isinstance n, ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef and n.name in names} missing = set names - set found if missing: raise KeyError f"{relpath}: could not find {missing} upstream may have renamed them " ns = {} if ns is None else dict ns ns.update {"torch": torch, "F": F, "np": np, "enum": import "enum" , "dataclasses": dataclasses, "math": math, "os": os} future = ast.parse "from future import annotations" .body mod = ast.Module body=future + found n for n in names , type ignores= exec compile ast.fix missing locations mod , f"