Training a GPT-2 Level Model From Scratch Overnight, Locally
A 900M parameter GPT-2 level model, pretrained from scratch on local hardware in under 9 hours. Here's what that actually takes.

What does it actually take to pretrain a GPT-2 level model from scratch?
Pretraining a GPT-2 scale language model from scratch, roughly 900 million parameters, used to require a cluster of GPUs and days of wall clock time. That same class of run can now be done on a single local machine in under nine hours, using a forked version of Andrej Karpathy’s nanochat training stack, and land on a benchmark score comparable to OpenAI’s original GPT-2. The constraint isn’t exotic technique anymore. It’s raw compute density on one box, plus a codebase that handles the training loop end to end.
TL;DR
- A from-scratch pretraining run of a roughly 900M parameter GPT-2 class model was completed in under nine hours on local hardware, not a cloud cluster.
- The run used a fork of nanochat, the minimal training stack Andrej Karpathy released for building a ChatGPT-style model end to end, from tokenizer through base model.
- The resulting model’s benchmark score matched the original GPT-2, showing that a well-known reference point from 2019 is now reachable overnight on a single machine.
- This is a different exercise from fine-tuning: there’s no base model to inherit from, so the run has to learn language structure, grammar, and basic world knowledge entirely from raw text.
- The experiment highlights how much GPU memory and bandwidth (not clever new algorithms) have closed the gap between “needs a data center” and “runs in an office overnight.”
- It’s framed as a side curiosity next to fine-tuning work, not a production recipe, but it’s a useful benchmark for anyone asking what unit of compute now buys a GPT-2 class model.
Why pretrain from scratch instead of fine-tuning?
Fine-tuning starts from a capable base model and nudges its behavior: tone, tool calls, formatting, domain knowledge layered on via something like LoRA. Pretraining from scratch skips all of that. There’s no base model. The network starts from random weights and has to learn everything: how tokens relate to each other, basic syntax, factual associations, from a large corpus of raw text, one gradient step at a time.
That makes from-scratch pretraining a much heavier compute problem per unit of “capability gained.” Fine-tuning a 27B or 120B parameter model with LoRA touches less than 1% of the parameters and leans on a frozen base that already knows language. Pretraining has no such shortcut. Every weight in the network is being shaped from nothing, which is why pretraining runs have historically been the part of the LLM pipeline reserved for labs with large GPU fleets, not individual builders.
The appeal of trying it locally isn’t that it’s a better way to build a production model. It’s that it answers a concrete question: how much raw pretraining can one well-specified machine do in a single overnight run, and how does the result compare to a known historical benchmark.
What is nanochat, and why use it for this?
Nanochat is a minimal, from-scratch training codebase released by Andrej Karpathy, designed to take a model through the full pipeline: tokenizer training, base model pretraining, and the steps that turn a base model into something chat-like. It’s deliberately stripped down compared to production frameworks, which makes it a good fit for an experiment that’s trying to isolate “how fast can one machine pretrain a GPT-2 class model” rather than wrestle with a sprawling configuration surface.
Running a fork of nanochat rather than a heavier industrial framework keeps the experiment legible: the training loop, the data pipeline, and the model architecture are all visible and small enough to reason about, which matters when the goal is a clean before-and-after comparison against a known model (GPT-2) rather than a tuned production system.
How long did the run take, and what came out of it?
The full pretraining run, starting from random weights and ending with a trained roughly 900M parameter model, finished in under nine hours on local hardware. That’s a single overnight run, not a multi-day cluster job.
The resulting model’s benchmark score matched the original GPT-2’s. That’s a meaningful reference point because GPT-2 itself, released by OpenAI in 2019, was trained on infrastructure far beyond what a single local machine had access to at the time. The fact that an equivalent result is now achievable overnight on one box isn’t about a new algorithmic breakthrough. It’s a function of how much GPU memory, bandwidth, and raw throughput are now packed into a single high-end accelerator compared to five years ago.
| Vendor | Tier | Risk | ApprovalNEW |
|---|---|---|---|
| Northwind Supply | Tier 1 | Low | Approved |
| Acme Logistics | Tier 2 | Medium | Approve |
| Helios Data | Tier 1 | High | Pending |
| Granite Freight | Tier 3 | Low | Approved |
| Pinecrest Labs | Tier 2 | Low | Approve |
It’s worth being precise about what “matched GPT-2’s score” means here: it’s a benchmark-level comparison, not a claim that the model is broadly as capable as modern instruction-tuned models at a similar parameter count. GPT-2 itself, even in its original form, is well behind current small models in instruction following and reasoning. The achievement is reproducing that specific historical bar quickly and locally, not beating it.
Why does this matter if nobody needs a GPT-2 level model today?
Nobody is shipping a product on a GPT-2 class model in 2025. The value of this kind of experiment is diagnostic, not practical. It gives builders a concrete, reproducible unit of measurement: “one overnight run on this hardware equals roughly a GPT-2 level result.” That’s useful for a few reasons.
First, it recalibrates expectations about what local hardware can do. A lot of the conversation around training has assumed pretraining is permanently off-limits without a cloud cluster. An overnight, single-box run that hits a known historical benchmark pushes back on that assumption, at least for small-to-mid-size models.
Second, it’s a sanity check for anyone building their own training stack. If your fork of a minimal trainer can reproduce a well-documented reference result in a known time budget, you have confidence the pipeline (tokenizer, data loader, optimizer, architecture) is working correctly before you point it at something more ambitious or domain-specific.
Third, it clarifies where the real constraint sits. The bottleneck isn’t technique, since nanochat’s approach is openly published and not particularly exotic. The bottleneck is compute density: how much memory bandwidth and FLOPs you can put behind the training loop in a given time window. That’s a hardware story more than an algorithms story.
Is local from-scratch pretraining worth doing yourself?
For most builders, no, not as a production strategy. If you need a model that’s good at a task, starting from a strong open base model and fine-tuning it (with LoRA, full fine-tuning, or quantization-aware approaches) will get you a useful result with far less compute and far less risk of a broken, undertrained model. Pretraining from scratch is the expensive, slow way to get capability that a base model already has for free.
Where it’s worth doing is as a learning exercise or a controlled benchmark. Running a minimal stack like a nanochat fork end to end teaches you what pretraining actually involves: tokenizer decisions, data mixture, batch size and learning rate schedules, and how those choices show up in loss curves and downstream benchmark scores. That understanding transfers directly to evaluating or debugging any fine-tuning work you do later, because you’ve seen the full pipeline rather than just the fine-tuning slice of it.
It’s also a reasonable way to stress-test new hardware. A from-scratch pretraining run exercises sustained compute and memory bandwidth in a way that’s harder to fake than a short inference benchmark, which makes it a decent proxy for how a machine will behave under sustained training load generally.
Frequently Asked Questions
What does “GPT-2 level” actually mean here?
It refers to a model of similar parameter scale (around 900 million parameters) that reaches a benchmark score comparable to OpenAI’s original GPT-2 model, released in 2019. It’s a scale and performance comparison, not a claim of identical architecture or training data.
How is this different from fine-tuning a model like Qwen or Llama?
Fine-tuning starts from a pretrained base model that already understands language and adjusts its behavior for a specific task, usually touching a small fraction of parameters. Pretraining from scratch starts from random weights and has to learn language structure and knowledge entirely from raw text, which is far more compute-intensive per unit of capability gained.
What software was used for the from-scratch run?
A fork of nanochat, the minimal training codebase released by Andrej Karpathy that covers tokenizer training, base model pretraining, and the steps that turn a base model into a chat-capable one.
Can I reproduce a run like this on consumer hardware?
It depends heavily on how much GPU memory and bandwidth you have available. The nine-hour, overnight timeframe described here relied on a high-end single machine; consumer GPUs with less memory will take meaningfully longer or require a smaller model and shorter training run to land in a similar time budget.
Is a GPT-2 level model useful for anything today?
Not for production use. Modern small models at a similar or smaller parameter count substantially outperform GPT-2 on instruction following and reasoning. The value of reproducing GPT-2’s benchmark score is as a calibration point for training pipelines and hardware, not as a usable end product.