Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 9 min read Case study mediumAdept

Migrating the Hub from Git LFS to Xet

Hugging Face moved 500,000 repositories and about 20 PB from Git LFS to its Xet content-addressed storage with almost no user disruption. Two pieces made that possible. A Git LFS Bridge lets older clients keep working by returning presigned URLs and reconstructing files from chunks in S3. A webhook-driven background pipeline, with an orchestrator batching files into jobs of 1,000 files or 500 MB for worker pods, migrates LFS content without locks. Scaling to multi-petabyte accounts exposed three problems: a cross-mount `/tmp` move bug that filled disks, an undersized CAS, and network/EBS I/O bottlenecks on the workers. After fixes, CAS throughput rose from about 35 Gb/s to peaks near 300 Gb/s.

Assumes: Git LFS basicscontent-addressed storageobject storage like S3

Related posts

  • Xet is on the Hub

    Hugging Face mediumAdept

    Hugging Face migrated its first model and dataset repositories from Git LFS to Xet storage, which uses content-defined chunking (~64 KB chunks aggregated into ~64 MB blocks) so that only changed bytes are uploaded. The migration moved 4.5 TB and ~6% of Hub download traffic in one day and exposed two production issues. First, unaligned range requests from hf_transfer forced CAS to stream whole blocks, a 4:1 read amplification. Adding chunk-length metadata to the block format fixed this and cut GET latency ~35%. Second, unflushed page cache during uploads caused disk throttling and pod load imbalance, which was mitigated with per-pod concurrent upload limits. The core lesson is that incremental migrations of real traffic surface problems test environments can't.

  • Rearchitecting Hugging Face Uploads and Downloads

    Hugging Face mediumAdept

    Hugging Face's Xet team is replacing the Hub's direct-to-S3 uploads and CloudFront downloads with a content-addressed store (CAS) built on "dumb reads, smart writes": reads fetch reconstruction info from CAS, and writes are chunked, deduplicated and validated before reaching S3. Byte-level handling gets around CloudFront's 50GB file limit, enables format-aware dedup and compression for Parquet and Safetensors, and adds audit telemetry. Analysis of 8.2M upload requests (130.8 TB from 88 countries) in one day showed the top 7 countries produce 80% of bytes, so CAS nodes will run in three AWS regions: us-east-1 and eu-west-3 with 4 nodes each, and ap-southeast-1 with 2. Hugging Face accepts an estimated 12% drop in aggregate first-hop bandwidth, expecting other optimizations to offset it.

  • From Files to Chunks: Improving HF Storage Efficiency

    Hugging Face mediumAdept

    Hugging Face's Xet team plans to replace file-level Git LFS storage with content-defined chunking (CDC), where a rolling hash over a sliding window sets variable-size chunk boundaries and chunks are deduplicated in a content-addressed store, so edits only upload and store changed chunks. A prior XetHub benchmark on the CORD-19 dataset showed roughly 50% gains, with storage dropping from 8.9 GB to 3.52 GB and download time from 51 to 19 minutes. On two versions of GPT-2's safetensors file, CDC cut total storage by 53%. Fine-tuned models and checkpoints show 30-85% dedup ratios, which could save about 100 TB immediately, and Xet-backed repos are targeted for early 2025.

  • From Chunks to Blocks: Accelerating Uploads and Downloads on the Hub

    Hugging Face mediumAdept

    Hugging Face's Xet storage backend uses content-defined chunking for deduplication but avoids per-chunk overhead by aggregating chunks into content-addressed blocks of up to 64MB and using shards to map files to chunks. That cuts CAS entries roughly 1,000x. A global index over key chunks, a 0.1% subset picked by hash modulo, exploits spatial locality to find shards for deduplication without a network query per chunk. On a 191GB repo of 29 Gemma-2-9B GGUF quantizations, only about 97GB of unique blocks were stored, nearly halving upload time. Local chunk caching also avoids re-downloading unchanged data.

  • Inside GitHub’s new Git storage architecture

    GitHub Engineering hardMaster

    GitHub's new Git storage architecture, Rubicon, rests on one observation: only reference updates need ordering. Git objects go to Azure Blob Storage, and refs plus the pack manifest go to a small quorum-replicated compare-and-swap log called Ref-CAS. Disposable virtual replicas serve reads and writes from a rebuildable cache, while separate lease-based compaction nodes merge packs in the background, so storage, serving and maintenance scale independently. Ref-CAS replaced blob-based ref logs, which topped out at the mid-hundreds of writes per second or traded away read latency. It reaches tens of thousands of ref operations per second, and internal tests sustained 7,200 pushes per second from 5,000 concurrent agents on one repository.

The quest for software engineering knowledge.

Look:
Layout: