System Design: Model Hub (Walnut Hub: Chunked Uploads, Versions, Downloads Through a CDN, Dedup, Gated Access, Safety Scans, Hosted Inference)
We design a model hub and call it Walnut Hub. A model hub is a website and an API where people publish machine learning models and datasets for others to find and download.
A model here is mostly one big thing: its weights. Weights are the numbers a model learned in training, and a large model has hundreds of billions of them, at 2 bytes each. So the hub stores files of hundreds of gigabytes, keeps every version, and sends one file to thousands of people in an hour.
Walnut Hub also decides who may read each file and scans every upload for harmful code. It runs popular models behind an API, with a few free calls a month.
Every number here is our own planning assumption, and the design is our own. All times are US Eastern. All people, companies, models and IDs in the story are made up; the cities are real.
1. Requirements
1.1 What we are building
Walnut Hub serves about 20 million accounts and 8 million repos. A repo is a versioned folder that holds one model or one dataset.
Its main jobs are to take huge uploads, keep every version and send downloads fast to anyone allowed. It stores bytes that many repos share only once, which we call dedup. Around them sit access, safety scans, search and a hosted Inference API.
The story, in the second week of November 2026:
- Mon 9 Nov, 18:05. In Seattle, Maya Chen uploads Cedar AI's new model cedar-ai/orion-200b: 400 GB in 86 files. It is private for now. It takes 21 minutes.
- 21:05. Maya and her colleague Jordan Lee edit the model's README at the same second. Jordan's edit lands and Maya's is refused. Her second try lands 3 minutes later, keeping Jordan's edit.
- Tue 10 Nov, 09:00. orion-200b turns public and gated: anyone may download it after accepting the license. In the next hour, 2,500 people download all 400 GB. That is about 1 PB, almost all from caches filled at 08:30.
- 09:01. In Chicago, Emily Davis downloads it for her lab. Her connection drops halfway. The download resumes where it stopped and ends at 09:08:35.
- 09:20. In Charlotte, Ryan Brooks pulls one fixed version into Harbor Insurance's mirror. His 64 servers load from the mirror, so Walnut Hub sends the model once.
- 09:30. Olivia Turner accepts the license for her startup, Turner Labs. From 10:00 it calls orion-200b through our Inference API: 100 free calls, then call 101 paid from its credit. One call to a model that is not loaded waits 1 minute.
- 10:15. Daniel Ortiz publishes a 1.2 TB dataset of city permits. Its page shows the first rows within 70 seconds.
- 11:20. Ben Carter uploads five smaller copies of orion-200b, 740 GB in all. He sends only 656 GB.
- 13:05. In Denver, Sofia Ramirez uploads her medical fine-tune of orion-200b. She sends 72 GB, not 400 GB.
- 13:40. An account named cedar-ai-labs appears. At 14:02 it uploads a file that runs a shell command on any machine that loads it. The file is never served.
- 15:12. Alex Moreno, a Cedar AI intern, pushes a notebook with his write token in it to a public repo. The token is canceled 20 seconds later, unused.
- Wed 11 Nov, 10:00. Ben deletes one broken copy and squashes, and his quota drops by 98 GB. His 81.2 GB of stored bytes are freed on Sunday 29 November, after two weekly checks and a week of grace.
- Thu 12 Nov, 11:40. Our US object store fails for 85 minutes, with Nina Patel on call. The most downloaded repos come from our European copy within a minute.
- Fri 13 Nov, 10:00. A legal order says one part of Daniel's dataset holds home addresses and must go. Only the bytes that the named files use are removed.
The hard part has four sides:
- Huge files that change a little. Sofia's fine-tune shares 328 GB of its 400 GB with orion-200b.
- A skewed curve. One launch can be 40% of a busy hour's downloads.
- Strangers upload. Anyone can upload, and some model formats run code when a program loads them.
- History and deletion. Every version is kept and bytes are shared, yet a user or a court must be able to delete.
1.2 Words we use
Models and their files:
| Word | Meaning here |
|---|---|
| Layer, tensor | A layer is one step of a model's computation; the last are the top layers. A tensor is one named table of weights |
| Fine-tune | A model trained further from another model |
| Quantized copy | A smaller copy that stores each weight in fewer bits, such as 4. GGUF is a single-file format used for them |
| Safetensors | A model file format of only numbers and a header. Loading it never runs code |
| Pickle | Python's own format for saving objects. Loading one can run any code the file names |
| Model card | A model repo's README.md. Its first lines hold fields such as license |
| Split | One named part of a dataset, such as "inspections" |
| Parquet | A file format that stores data by column, in row groups. The footer at the end indexes them |
Repos and versions:
| Word | Meaning here |
|---|---|
| Commit, commit hash | A commit is one saved change to a repo. It names its parent, the commit it was built on. Its hash is its name: 40 hex characters made from its content, shown as 7, such as a5f4078 |
| Branch, ref | A branch is a movable name for a commit, such as main; the commit it names is the branch head. A ref is a branch, a tag or a pull request ref |
| Compare-and-swap | Change a value only if it still holds the value the writer expected. Commits move branches this way |
| Revision, pin | A revision is a ref or a full commit hash. To pin is to use a full commit hash, so files never change |
| Outbox | Events written in the same transaction as the change, then copied to the Event stream by a job |
| Sequence number | A per-repo counter that rises by 1 with each event, so jobs apply events in order |
How we store bytes:
| Word | Meaning here |
|---|---|
| Hash | A short code made from bytes. The same bytes always give the same hash |
| Chunk | A piece of a file, cut where the file's own bytes say, about 64 KB on average |
| Block | Up to 64 MB of new chunks, packed in upload order and stored once, under its hash |
| Term | One block and a range of chunks inside it |
| File map | The list of terms that rebuilds one large file, stored under the file hash and a version. It never changes |
| File hash | A large file's hash, made from its chunk hashes |
| Pointer | A small text file in git standing for a large file: its file hash, file map version and size |
| CAS service | Our content-addressed storage service: it stores and finds bytes by their hash |
| Dedup domain | The blocks a repo's uploads may match, such as public US |
| Key chunk | A chunk dedup looks up: each file's first chunk and about 1 in 1,024 others |
| Keyed hash | A chunk hash mixed with a one-time key, so it helps only someone who holds the bytes |
| Condemned | A block the weekly sweep found unused twice. It waits a week, then is deleted |
| Epoch | A counter on a block, raised each time a new file map uses it |
| LFS | Large File Storage, git's own protocol for large files |
| Proof hash | A hash the uploader makes from chunks it holds, to prove it has them |
| Quota | The storage an account may use, counted at full file size whatever dedup saved |
Reading, access and running models:
| Word | Meaning here |
|---|---|
| Recipe | How to rebuild a file: its terms, with a signed URL for each |
| Signed URL | A link with an expiry time and a signature. It opens only its byte range of one block |
| CDN edge | One site of a CDN, a content delivery network that keeps popular bytes in many cities, near users |
| Shield | Our own cache servers in 12 places, between the CDN edges and our Block store |
| Token | A secret string a program sends instead of a password. A fine-grained token names the repos and actions it allows |
| Revocation list | Each region's list of canceled tokens, checked by every door |
| Warm model | A model whose weights are already in GPU memory. A cold one must load first |
| KV cache | GPU memory where a model keeps the text of a call so far |
Where things run:
| Word | Meaning here |
|---|---|
| Region, zone | A region is a part of the world where we run servers: the US or the EU. A zone is one of its three data center buildings |
| Shard | One part of a split store, with some of the rows |
| Primary, failover | The primary is the one database copy that takes writes. When it dies, another copy takes over: a failover |
| Head repos, head copy | The top 1% of repos by downloads in 30 days. The head copy is their blocks, copied to the EU |
| p99, p95 | The value that 99, or 95, of every 100 requests stay under |
IDs in the story. Every ID is made up.
| ID | What it names | Example from the story |
|---|---|---|
| a5f4078 | A commit hash | Maya's first commit of orion-200b, Monday 18:26 |
| 1cb5bd5 | A commit hash | Jordan's README edit, Monday 21:05 |
| 2e8414b | A commit hash | Maya's README edit on top of Jordan's; main from Monday 21:08 |
| e8867ea | A commit hash | Ben's five quantized copies, Tuesday 11:55 |
| 0afde56 | A commit hash | The look-alike account's harmful commit |
| blk 7d41e2 | A block hash | The first block of orion-200b's model-00001 file |
| mf 19d13e | A file hash | The file map of model-00001, stored under its file hash |
| tok_4471 | A token ID | Emily's read token |
| tok_6020 | A token ID | Ryan's read-only token for Harbor's mirror |
| tok_9183 | A token ID | Alex's write token, the one that leaks |
| ar_20511 | An access request ID | Emily's request to read orion-200b |
| vj_8805 | A viewer job ID | The job that turns part of Daniel's CSV into Parquet |
| pg_118 | A purge job ID | The job that removes the bytes named by the legal order |
| call_TL101 | An inference call ID | Olivia's call 101, the first one she pays for |
1.3 Every kind of request and change
| Kind | What it is | How big or how often | Part that handles it | Outside company that takes part |
|---|---|---|---|---|
| Upload of large files | New blocks, then one file map per file | 2 PB a day offered, 1 PB new after dedup | Hub client, CAS service, Block store, Dedupe index | The cloud company that runs the object store |
| Commit | Small files inline, pointers for large ones | 2 million a day | Hub API, Commit service, Git service, Metadata store | none |
| Resolve | Which commit and bytes a revision means | 1.5 billion a day | Hub API, Access service | none |
| Download of bytes | 4 MB slices of blocks, by signed URL | 20 PB a day | CDN edges, Shields, Block store | A CDN company |
| Old-client push or read | Plain git large-file pushes, and curl reads | About 5% of download bytes, 1 PB a day | LFS bridge | none |
| Scheduled launch | A repo that turns public at a set time | A few a day | Scheduler, Pre-warmer | none |
| Access request | A request to read a gated repo | About 300,000 a day | Hub API, Access service | none |
| Token change | Make, cancel or swap one | About 100,000 a day | Hub API, Access service | none |
| Search and listing | Repos by name, task or license; counts, trending | About 500 million calls a day | Hub API, Search index | none |
| Inference call | Text in, answer out | About 50 million a day | Inference API, Inference router, GPU pool | A card payment company, for credit bought by card |
| Dataset viewer page | A dataset's first rows, on its page | At most about 2 million commits to convert a day | Viewer queue, Viewer workers | none |
| Delete or squash | A delete commit, or a branch's history replaced by one commit | About 50,000 a day | Commit service, Sweeper | none |
| Legal takedown | An order to remove named files now | A few a week | Purge job | none |
| Leaked token | A token found in a public file | About 200 a day | Token scanner | none |
1.4 Functional requirements
- Repos. Model and dataset repos under a user or an org: public, private or gated, in the US or EU region.
- Upload. Files of up to 500 GB each, in commits. A broken upload resumes without resending bytes.
- Versions. Every commit kept, with branches, tags and pull request refs. Two writers never erase each other's work.
- Download. Any file at any revision, resumable, with pinned commits.
- Store once. Shared bytes stored once, without letting anyone learn what is in a private repo.
- Access. Gated repos with access requests, fine-grained tokens and org roles.
- Safety. Scan every new file, never serve files that run harmful code, and cancel leaked tokens.
- Discovery. Search over model cards, the model tree, download counts and trending.
- Run models. A hosted Inference API: 100 free calls a month per account, then calls paid from prepaid credit.
- Datasets and deletion. Show a dataset's first rows, free the storage of deleted files, and remove files a legal order names.
Out of scope:
- hosting users' own apps;
- training models;
- dedicated GPUs for one customer, priced by the GPU-second;
- the insides of the CDN company and the object store.
1.5 Non-functional requirements
- Resolve fast. 150 ms at p99 for a client near one of our regions.
- Download fast. 500 MB/s or more for one client when the bytes are already at its CDN edge.
- Durable. An acknowledged commit's blocks and file maps are in 3 zones, its git objects in at least 2 of 3.
- Correct bytes. The client checks each term's length and file's hash before use.
- Commits in order. A branch moves only from the parent the writer named. Readers see a new commit within 5 seconds at p99.
- Access. Private or gated bytes leave only through URLs signed after an access check, valid 10 minutes. Within 60 seconds, a canceled token gets no new resolve or recipe in any region.
- Available. Resolves and downloads work 99.95% of a month, about 22 minutes down. Uploads and commits work 99.9%, about 43 minutes. A whole region's object store outage breaks this for repos outside the head copy.
- Fresh. At p95, a commit reaches search within 60 seconds and a new file has a scan result within 15 minutes.
- Region loss. If the US region is lost, head repos can be pulled from the EU within 15 minutes.
- Inference. A warm model starts its answer within 2 seconds at p99. A cold model of 400 GB is ready within 2 minutes.
1.6 The numbers
The daily average spreads a day's total over 86,400 seconds. The busy hour is 3 times that. Gb/s and Tb/s count bits, and 1 byte is 8 bits.
| Number | How we get it | Result | What it decides |
|---|---|---|---|
| Stored bytes | 250 PB after dedup. Users offer 2 PB a day, and half is already stored, so 1 PB is new. 1 PB ÷ 250 PB = 0.4% a day. Uploads grow with the store, so this compounds and doubles it in about 174 days. A fixed 1 PB a day would take 250 days | 250 PB, growing 0.4% a day; it doubles in about 6 months | Bytes are about a million times the metadata: 250 PB ÷ 200 GB. So bytes and metadata live in separate systems |
| Uploads | 1 PB of new bytes a day ÷ 86,400 seconds = 11.6 GB/s, about 93 Gb/s. The busy hour is 3 times that | About 280 Gb/s at the busy hour | Uploads go straight to the CAS service's own write servers, never through the Hub API |
| Downloads | 20 PB a day ÷ 86,400 = 231 GB/s, about 1.85 Tb/s. The busy hour is 5.6 Tb/s, and 90% comes from CDN copies | 5.6 Tb/s at the busy hour; 560 Gb/s from our own stores | Bytes go out through a CDN with a shield tier. The Hub API only signs URLs |
| Resolves | 1.5 billion a day ÷ 86,400 = 17,400 a second. The busy hour is 3 times that | 52,000 a second at the busy hour | Each Hub API server caches branch heads for 5 seconds. Everything under a commit hash is cached forever |
| Commits | 2 million a day ÷ 86,400 = 23 a second. Metadata is 8 million repos × 25 KB, about 200 GB | 70 commits a second at the busy hour | One primary database holds all metadata, with copies for reads |
| Index of stored bytes | One row per chunk: 250 PB ÷ 64 KB = 3.9 trillion rows × 40 bytes = 160 TB. One row per block: 250 PB ÷ 64 MB = 3.9 billion rows × 100 bytes | 390 GB, not 160 TB | The index counts blocks, not chunks. With block_refs, 280 GB more, it is 670 GB on 16 shards, small enough to keep in memory as well as on disk |
| Dedup lookups | One key chunk in 1,024 is one lookup per 64 MB. 2 PB a day ÷ 64 MB = 31 million a day, 360 a second | About 1,100 a second at the busy hour | A small Dedupe index: 3.9 trillion ÷ 1,024 = 3.8 billion entries × 48 bytes, about 180 GB |
| Free inference | 20 million accounts × 5% who use it = 1 million users, each with 100 calls a month. Output: 100 calls × 1,000 tokens × 1 million = 100 billion tokens, at our cost of $0.90 per million. Input: 100 calls × 2,000 tokens × 1 million = 200 billion tokens, at our cost of $0.10 per million | $90,000 + $20,000 = about $110,000 a month | 100 free calls a month, warm models only. A free call never loads a model |
What these numbers tell us. The design has two parts. Metadata is small, about 200 GB, written 70 times a second. Bytes are huge at 250 PB and never change once written.
Bytes have hot spots: one launch is 1 PB in one hour.