Executive Overview
For the artificial intelligence research community, the sheer velocity of innovation is both a blessing and a systemic challenge. Thousands of papers, pre-prints, and code repositories are published monthly, making the task of tracking state-of-the-art (SOTA) methodologies and discovering foundational artifacts nearly impossible through traditional search avenues. Three months ago, Hugging Face initiated a comprehensive revival of Papers with Code—a platform originally conceived to make open AI research accessible, digestible, and directly connected to its underlying implementation artifacts.
At the core of this revival lies a sophisticated engineering undertaking: replacing legacy retrieval mechanics with a modern, production-grade hybrid search engine. Built to serve both human researchers and autonomous AI agents (via the pwc search CLI and associated agent skills), this system bridges the gap between exact keyword matching and semantic, vector-based understanding. Processing over 110,000 current papers sourced dynamically from arXiv and Daily Papers, the newly designed search architecture deftly handles fuzzy conceptual queries, incomplete titles, and navigational requests while gracefully absorbing infrastructure volatility.
By separating heavy batch processing from latency-sensitive production queries, employing strict embedding contracts, leveraging S3-like Storage Buckets as an immutable integration contract, and utilizing Reciprocal Rank Fusion (RRF), Hugging Face has established a robust blueprint for modern retrieval-augmented AI platforms. This article explores the architectural decisions, production methodologies, and empirical lessons learned while scaling this system to power the wave of research that may lead to the next defining Transformer.

Detailed Chronology: From Concept to Production Architecture
The Genesis of the Revival
The initial push to revitalize Papers with Code began three months ago, announced via community channels like Reddit and X (formerly Twitter). The core mandate was clear: to power the foundational research lifecycle by making artifacts instantaneously discoverable. However, the existing infrastructure could not sustain the semantic complexity demanded by modern AI developers.
Traditional text search engines fail when confronted with queries like "small language models for code generation" if those exact words do not appear contiguously in a paper’s text. Similarly, users frequently enter navigational requests—such as "the original BERT paper"—or type queries peppered with typos and incomplete titles. To solve this, the engineering team turned to a hybrid retrieval model, drawing heavily on their prior consulting and development experience at ML6 building production-grade Retrieval-Augmented Generation (RAG) systems.
Splitting the Pipeline: Offline Corpus Build vs. Online Search Service
A central design philosophy of the new Papers with Code architecture is the strict separation of throughput-oriented batch workloads from latency-sensitive online queries.

[PostgreSQL Database Snapshot]
│
▼ (Streaming JSONL Shards)
[Hugging Face Storage Buckets] ◄─── Immutable Run Artifacts
│
▼ (Mount via hf-mount)
[Hugging Face Jobs (L4 GPU)] ────► [Batch Vector Generation]
│
▼
[PostgreSQL + pgvector (HNSW Index)] ◄─── [Online Hybrid Search Engine]
│ ▲
│ │ (Query Text)
└───────────────────────── [Hugging Face Inference Endpoint (TEI)]
1. The Offline Corpus Build (Batch Workload)
Generating dense embeddings for over 110,000 academic papers is a resource-intensive task. Hugging Face utilized Hugging Face Jobs, executing Python-based scripts via uv on an l4x1 hardware flavor equipped with an NVIDIA L4 GPU (24GB VRAM).
- Data Export: The process begins by exporting a repeatable-read snapshot of every paper from the core PostgreSQL database. Rather than loading the entire catalog into memory, the exporter streams rows, writes bounded JSONL shards, and compiles a manifest containing row counts and cryptographic SHA-256 checksums.
- Storage Sync: This immutable run directory is synced directly to a private Hugging Face Storage Bucket and mounted read-write into the Job container using
hf-mount. - Worker Execution: The worker validates checksums, processes shards in parallel, and writes out compressed Parquet files containing the dense vectors alongside completion markers. This allows interrupted jobs to resume gracefully without re-computing verified work.
2. The Online Search Service (Latency-Sensitive Path)
While document embeddings are computed asynchronously in batches, user queries must be embedded in real time. The system deploys the embedding model (Qwen/Qwen3-Embedding-0.6B) behind an authenticated Inference Endpoint powered by Text Embeddings Inference (TEI).
- When a user submits a query, the Inference Endpoint converts the text into a 256-dimensional L2-normalized vector.
- The application layer executes a cosine-distance search against the active
pgvectorgeneration using an HNSW (Hierarchical Navigable Small World) index. - To guarantee high availability, the endpoint is configured with scale-to-zero capabilities. If the endpoint is cold, throttling, or unreachable, the application immediately falls back to pure lexical search, ensuring that users never experience hanging requests or downtime due to model infrastructure hiccups.
Supporting Context & Metrics: Engineering Decisions Under the Hood
Strict Embedding Contracts and Model Selection
Embedding pipelines frequently break due to subtle silent failures: prompt drift, model revisions, vector truncation mismatches, or desynchronized updates between abstracts and stored vectors. To eliminate these failure modes, the engineering team instituted a strict, versioned embedding contract:
$$textInput String = textnormalized title + mathttbackslash nbackslash n + textnormalized abstract$$

Using the MTEB (Massive Text Embedding Benchmark) Leaderboard as a guiding metric, the team selected Qwen/Qwen3-Embedding-0.6B. Crucially, the system utilizes Matryoshka representation learning, pinning vectors to a compressed 256 dimensions.
Empirical pilots on a 5,000-paper test set revealed remarkable efficiency gains:
- Recall Performance: The 256-dimensional Qwen index achieved 0.9955 Recall@20 compared to an exact search baseline.
- Latency: HNSW lookup latency achieved a p50 of 1.31 ms and a p95 of 2.21 ms.
- Storage Footprint: The 256-dimensional table and index consumed roughly 27% of the storage required by a standard 1024-dimensional layout while sacrificing virtually zero retrieval accuracy.
Storage Buckets as Immutable Boundaries
Storage Buckets act as mutable, S3-like object storage optimized for AI workflows, establishing a clear contract between three distinct system lifecycles: compute jobs, data verification pipelines, and production databases.

Artifacts are segregated under strictly enforced, immutable run prefixes:
runs/<run-id>/
├── input/
│ ├── manifest.json
│ └── papers-*.jsonl
└── output/
├── manifest.json
├── embeddings-*.parquet
└── embeddings-*.complete.json
Data is never loaded directly into production from a raw job execution. Instead, an importer service re-checks schemas, checksums, dimensions, L2-normalization constraints, unique paper IDs, and content hashes. Only after passing these rigorous gates are the vectors inserted into PostgreSQL, indexed via HNSW, and atomically marked as active.
Reciprocal Rank Fusion (RRF) in Practice
To combine the complementary strengths of lexical search (PostgreSQL full-text search) and semantic search (pgvector), the system applies Reciprocal Rank Fusion (RRF). RRF merges candidate lists based on their relative ranks rather than raw similarity scores, which often vary across heterogeneous systems:

$$textscore(d) = sum_r ,in, textlexical,, textsemantic fracw_rk + textrank_r(d)$$
Using a rank constant $k=60$ and balanced weights ($w_r$), papers that rank highly in both keyword matching and semantic vector space bubble to the top. This guarantees that exact acronyms, model names, and arXiv identifiers are never washed out by loose semantic associations, while conceptual queries still successfully retrieve relevant literature.
Official Insights & System Takeaways
Reflecting on the deployment of this production hybrid architecture, the Hugging Face engineering team published several core design principles and lessons learned:

- Separate Throughput from Latency: Corpus embedding and query embedding utilize the same model, but they belong to entirely different infrastructural domains. Jobs must be optimized for cost and throughput, whereas inference endpoints must be optimized for availability and sub-millisecond response times.
- Storage as an Explicit Contract: S3-like storage buckets provide an invaluable boundary layer. Checksummed, manifest-driven artifacts allow engineers to thoroughly inspect and audit generated vectors before they ever touch production databases.
- Pin More Than Just the Model Name: True reproducibility requires pinning the model revision, output dimensions, prompt formatting, normalization functions, and input tokenization schemes simultaneously.
- Design for Cold Starts: Scale-to-zero infrastructure is financially attractive for intermittent workloads, but client applications must be engineered to handle cold starts gracefully via robust, automatic fallbacks (e.g., falling back to instant lexical search if an embedding endpoint is spinning up).
- Smaller Vectors as a Systems Feature: Matryoshka embeddings are not just a theoretical novelty; they provide an exceptional systems lever, shrinking memory footprints and network payloads while preserving near-identical approximate nearest neighbor (ANN) recall.
- Boring Atomic Activation: Deploying new embedding generations should be an unexciting background procedure. By building indices independently alongside active data and cutting over atomically, rollbacks become simple configuration switches rather than emergency data-recomputation crises.
Future Outlook
The deployment of the hybrid search engine marks a major milestone for Papers with Code, but it also establishes a foundation for deeper AI-driven discovery tools. Beyond standard web search, the underlying document embeddings now power related-paper recommendations instantaneously on individual paper pages without requiring real-time model inferences.
Furthermore, by integrating external citation graphs via the Semantic Scholar API and custom CLI tools like s2-cli, the platform is uniquely positioned to empower autonomous agent workflows. Researchers can interact directly with the literature via natural language interfaces at Papers with Code Chat, querying deep conceptual relationships across more than 110,000 academic works.
As Hugging Face continues to refine these systems—exploring advanced multi-stage pipelines incorporating rerankers such as the Qwen3-Reranker family—the platform stands ready to index the next generation of breakthrough AI research, ensuring that open science remains thoroughly searchable, digestible, and actionable for the global community.
