Hugging Face Scales Infrastructure to Serve 3 Million Models

Arek Borucki from Hugging Face discusses how the platform scaled its infrastructure to serve millions of AI models and users, detailing architectural decisions and database optimizations.

7 min read
Arek Borucki from Hugging Face presenting on scaling the AI model hub.
AI Engineer

Visual TL;DR. Exponential Model Growth drives need Serve Millions Users. Serve Millions Users requires Architectural Decisions. Architectural Decisions includes Leverage MongoDB. Architectural Decisions includes Kubernetes & Beyond. Leverage MongoDB enables Optimized Search. Kubernetes & Beyond achieves Robust Scalable Platform. Optimized Search contributes to Robust Scalable Platform.

  1. Exponential Model Growth: 3 million models now hosted, a 150x increase from a few years ago
  2. Serve Millions Users: scaling infrastructure to support 14 million users and 50,000 organizations globally
  3. Architectural Decisions: core infrastructure built on specific architectural choices for high scalability
  4. Leverage MongoDB: optimizing database performance and scalability using MongoDB for model metadata
  5. Kubernetes & Beyond: scaling infrastructure with Kubernetes for container orchestration and resource management
  6. Optimized Search: efficiently searching across 3 million models for developers to discover resources
  7. Robust Scalable Platform: Hugging Face provides a robust and scalable platform for AI development
Visual TL;DR
Visual TL;DR, startuphub.ai Kubernetes & Beyond achieves Robust Scalable Platform achieves Exponential Model Growth Leverage MongoDB Kubernetes & Beyond Robust Scalable Platform From startuphub.ai · The publishers behind this format
Visual TL;DR, startuphub.ai Kubernetes & Beyond achieves Robust Scalable Platform achieves Exponential ModelGrowth Leverage MongoDB Kubernetes &Beyond Robust ScalablePlatform From startuphub.ai · The publishers behind this format
Visual TL;DR, startuphub.ai Kubernetes & Beyond achieves Robust Scalable Platform achieves Exponential Model Growth 3 million models now hosted, a 150xincrease from a few years ago Leverage MongoDB optimizing database performance andscalability using MongoDB for modelmetadata Kubernetes & Beyond scaling infrastructure with Kubernetes forcontainer orchestration and resourcemanagement Robust Scalable Platform Hugging Face provides a robust andscalable platform for AI development From startuphub.ai · The publishers behind this format
Visual TL;DR, startuphub.ai Kubernetes & Beyond achieves Robust Scalable Platform achieves Exponential ModelGrowth 3 million modelsnow hosted, a 150xincrease from a few… Leverage MongoDB optimizing databaseperformance andscalability using… Kubernetes &Beyond scalinginfrastructure withKubernetes for… Robust ScalablePlatform Hugging Faceprovides a robustand scalable… From startuphub.ai · The publishers behind this format
Visual TL;DR, startuphub.ai Exponential Model Growth drives need Serve Millions Users. Serve Millions Users requires Architectural Decisions. Architectural Decisions includes Leverage MongoDB. Architectural Decisions includes Kubernetes & Beyond. Leverage MongoDB enables Optimized Search. Kubernetes & Beyond achieves Robust Scalable Platform. Optimized Search contributes to Robust Scalable Platform drives need requires includes includes enables achieves contributes to Exponential Model Growth 3 million models now hosted, a 150xincrease from a few years ago Serve Millions Users scaling infrastructure to support 14million users and 50,000 organizationsglobally Architectural Decisions core infrastructure built on specificarchitectural choices for high scalability Leverage MongoDB optimizing database performance andscalability using MongoDB for modelmetadata Kubernetes & Beyond scaling infrastructure with Kubernetes forcontainer orchestration and resourcemanagement Optimized Search efficiently searching across 3 millionmodels for developers to discoverresources Robust Scalable Platform Hugging Face provides a robust andscalable platform for AI development From startuphub.ai · The publishers behind this format
Visual TL;DR, startuphub.ai Exponential Model Growth drives need Serve Millions Users. Serve Millions Users requires Architectural Decisions. Architectural Decisions includes Leverage MongoDB. Architectural Decisions includes Kubernetes & Beyond. Leverage MongoDB enables Optimized Search. Kubernetes & Beyond achieves Robust Scalable Platform. Optimized Search contributes to Robust Scalable Platform drives need requires includes includes enables achieves contributes to Exponential ModelGrowth 3 million modelsnow hosted, a 150xincrease from a few… Serve MillionsUsers scalinginfrastructure tosupport 14 million… ArchitecturalDecisions core infrastructurebuilt on specificarchitectural… Leverage MongoDB optimizing databaseperformance andscalability using… Kubernetes &Beyond scalinginfrastructure withKubernetes for… Optimized Search efficientlysearching across 3million models for… Robust ScalablePlatform Hugging Faceprovides a robustand scalable… From startuphub.ai · The publishers behind this format

In a presentation at the AI Engineer World's Fair, Arek Borucki, ML Platform and Database Engineer at Hugging Face, detailed the infrastructure scaling challenges and solutions behind serving millions of AI models to developers globally. Hugging Face has experienced exponential growth, now boasting over 14 million users, 3 million public models, and 1 million datasets, with more than 30% of Fortune 500 companies utilizing the platform.

Hugging Face Scales Infrastructure to Serve 3 Million Models - AI Engineer
Hugging Face Scales Infrastructure to Serve 3 Million Models — from AI Engineer

The Scale of Hugging Face

Borucki highlighted the dramatic increase in models hosted on the Hugging Face hub, from 20,000 a few years ago to 3 million today, representing a 150x growth. This rapid expansion, fueled by major model releases like Llama and DeepSeek, necessitates a robust and scalable infrastructure. The platform also manages over 1 million datasets and supports 50,000 organizations, demonstrating its central role in the AI development community.

Architectural Decisions for Scalability

The core of Hugging Face's infrastructure runs on Kubernetes, utilizing Horizontal Pod Autoscaler (HPA) to automatically adjust the number of pods based on CPU and memory utilization. This ensures the hub remains healthy during traffic spikes without manual intervention. MongoDB Atlas serves as the source of truth for all metadata, including user repositories, models, datasets, and billing information. Crucially, MongoDB does not store the actual model artifacts or tokenizer files, which are kept separately in cloud object storage like AWS S3. This separation allows for independent scaling of metadata, binary storage, and compute resources.

Optimizing Search for 3 Million Models

With the massive growth in models, the need for efficient search became paramount. Borucki explained that at 20,000 models, simple query methods sufficed, but at 3 million models, this approach breaks. Users expect instant search results, and slow performance leads to churn. To address this, Hugging Face implemented several strategies: pre-computing tokens at insert time, using a denormalized collection optimized for reads, and leveraging MongoDB's Atlas Search, which is powered by Apache Lucene. This allows for instant autocomplete functionality and faster matching of models.

Leveraging MongoDB for Performance

Borucki elaborated on the specific techniques used within MongoDB. A dedicated, denormalized read collection stores pre-computed search tokens in an array within each model document. This allows queries to efficiently search these tokens. Previously, the platform used a regex operator, which proved to be a bottleneck as the dataset grew. The switch to Atlas Search, utilizing the '$search' operator in aggregation pipelines, has resolved latency issues. The infrastructure also employs a seven-node MongoDB cluster with multiple machines to distribute read load and prevent single-node bottlenecks. A hidden analytic node is used for heavy queries and reporting, isolated from production traffic.

Scaling the Infrastructure with Kubernetes and Beyond

The Hugging Face hub's Kubernetes deployment can scale horizontally from 10 to 500 pods using HPA. To handle situations where HPA needs to add more pods but no free nodes are available, a second layer of scaling is implemented using Cast AI for node autoscaling. This ensures that infrastructure can be provisioned on demand. The team is also migrating from HPA to Kubernetes Event-Driven Autoscaling (KEDA), which allows scaling based on real application metrics like requests per second or event loop utilization, rather than just CPU and memory.

The Future of Scaling

Borucki concluded by emphasizing that while current scaling strategies are effective, the next step for handling even greater growth will involve database sharding. Sharding allows for horizontal scaling by dividing data into smaller pieces, each managed by its own replica set. This approach will scale CPU, memory, storage, reads, and writes horizontally, ensuring the continued health and performance of the Hugging Face hub as it grows.

© 2026 StartupHub.ai. All rights reserved. Do not enter, scrape, copy, reproduce, or republish this article in whole or in part. Use as input to AI training, fine-tuning, retrieval-augmented generation, or any machine-learning system is prohibited without written license. Substantially-similar derivative works will be pursued to the fullest extent of applicable copyright, database, and computer-misuse laws. See our terms.