# DraftNCraft

> Patent & technical document discovery

- **Role:** Independent Consultant
- **Company:** DraftNCraft · Private engagement
- **Period:** Sep 2025 – Apr 2026

Patent analysts need both exact claim matches and conceptually related prior art. I designed the search architecture for **1M+ patent records** at Global IP Services and built the search index, dual-index retrieval backbones, and ingestion pipeline for prior-art discovery at scale.

**Focus:** Hybrid search, Patent discovery, RapidOCR, Hunyuan-MT, FastAPI, PostgreSQL, vLLM

[Hybrid prior-art search over a dual-index patent corpus.](https://yashwardhan.space/assets/videos/hybrid_search_real.mp4)

## Overall structure

Built the **backend patent search infrastructure**: canonical records, dual retrieval engines, and indexing for multi-jurisdiction prior art.

**Take home:** Shipped the search gateway, ingestion pipeline, and dual-index backbones the product would sit on.

- **1M+** records (design target)
- **2** retrieval engines
- **L40** RapidOCR + MT co-hosted
- **Dual index** ES + Qdrant

![DraftNCraft platform map](https://yashwardhan.space/assets/images/work/draftncraft/platform-architecture.svg?v=6)

*Platform map*

*Find and Index on a shared PostgreSQL, Elasticsearch, and Qdrant backend for multi-jurisdiction prior-art search.*

## Hybrid search

Hybrid search runs **lexical and semantic recall in parallel**, merges the result sets, and reranks so analysts see both exact claim matches and conceptually related prior art. Deeper pagination favors the faster lexical path for latency.

### Why two indices

- **Lexical search** catches exact claim language, patent numbers, and OCR text from scanned filings.
- **Semantic search** catches paraphrases and conceptually related prior art that keyword lookup misses.
- Single-index search forces a tradeoff; dual recall keeps both precision and recall.

### Merge and rerank

- Both retrieval paths run in parallel, then results merge into one ranked list.
- Hits found by **both** paths rank highest; single-path hits stay in the mix at lower weight.
- Full filing text and metadata come from the **canonical store**, not the index layers.

### Production search

- Hybrid search is the default analyst path; keyword-only and semantic-only modes remain available.
- Filters for jurisdiction and patent class sit on top of the merged result set.

![DraftNCraft hybrid search](https://yashwardhan.space/assets/images/work/draftncraft/hybrid-retrieval.svg?v=6)

*Hybrid prior-art search*

*Parallel lexical and semantic recall, merged and reranked for prior-art discovery.*

## Indexing pipeline

Each filing moves through ingest → text extraction → language normalization → canonical write → dual-index build. Query-time hybrid search is a separate path over the same corpus.

### OCR for scanned filings

- **RapidOCR** runs on scanned pages where native text extraction is insufficient.
- Native PDF text extraction runs first to avoid unnecessary OCR cost and latency.
- Benchmarked against GLM OCR on patent layouts; RapidOCR won on accuracy and latency for single-GPU serving.

### Translation

- Non-English filings normalize to English before chunking and embedding.
- Language detection gates translation so English filings skip the extra step.

### GPU serving

- RapidOCR and Hunyuan-MT co-host on one **L40 GPU** with warm-loaded weights at startup.
- Heavy indexing jobs serialize on the GPU so OCR and translation do not contend at peak load.

![DraftNCraft indexing pipeline](https://yashwardhan.space/assets/images/work/draftncraft/ingestion-pipeline.svg?v=6)

*Indexing pipeline*

*Five-step flow from filing PDF to searchable prior-art record.*

## What I built

Hands-on work across the search gateway, indexing pipeline, database setup, and OCR/translation serving, designed for **1M+ patent records** across USPTO, EPO, and WIPO corpora.

### Indexing pipeline

- End-to-end workflow from filing ingest through canonical write and dual-index build.
- Single and bulk indexing paths with status tracking in the canonical store.

### Hybrid search

- Parallel lexical + semantic retrieval with merge, rerank, and pagination.
- Hybrid, keyword-only, and semantic-only modes over the same indexed corpus.

### Infrastructure

- PostgreSQL schema, Elasticsearch mappings, and Qdrant collections for million-scale prior art.
- Multi-jurisdiction ingest paths for USPTO, EPO, WIPO, and other patent offices.

## Scale

Architecture and core stack for **1M+ patent records** across multi-jurisdiction corpora: hybrid search, indexing pipeline, canonical store, and **RapidOCR** + Hunyuan-MT on one L40. Delivered the **search index** and retrieval backbones that anchor the platform.

- **1M+** records (design target)
- **Multi-office** USPTO · EPO · WIPO
- **Dual index** Elasticsearch + Qdrant
- **Delivered** search + indexing API

## Impact

Search gateway, indexing pipeline, and dual-index backbones (PostgreSQL + Elasticsearch + Qdrant) designed for 1M+ multi-jurisdiction patent records.

- Hybrid search: parallel lexical + semantic recall, merged and reranked for prior-art discovery
- Indexing pipeline: ingest → extract/OCR → translate → canonical store → dual-index build
- RapidOCR and Hunyuan-MT on one L40 for million-scale filing ingestion

---

[Back to portfolio](https://yashwardhan.space/) · [HTML case study](https://yashwardhan.space/work.html?p=draftncraft)
