Files
papers/hanzo-search/sections/02-system-architecture.tex

35 lines
1.5 KiB
TeX

\section{System Architecture}
\label{sec:architecture}
\subsection{Overview}
Hanzo Search processes queries through five stages:
\begin{algorithm}[H]
\caption{Hanzo Search Pipeline}
\label{alg:pipeline}
\begin{algorithmic}[1]
\Require Query $q$, index $\mathcal{I}$, model $M$
\State $q' \gets \text{QueryUnderstanding}(q)$ \Comment{Parse, expand, classify}
\State $\mathcal{D} \gets \text{HybridRetrieve}(q', \mathcal{I})$ \Comment{Retrieve candidates}
\State $\mathcal{D}^* \gets \text{Rerank}(q', \mathcal{D})$ \Comment{Cross-encoder reranking}
\State $\mathcal{P} \gets \text{ExtractPassages}(\mathcal{D}^*)$ \Comment{Passage extraction}
\State $(a, \mathcal{C}) \gets \text{Generate}(M, q', \mathcal{P})$ \Comment{Answer + citations}
\State $\text{UI} \gets \text{RenderGenUI}(a, \mathcal{C}, q'.\text{intent})$
\State \Return $\text{UI}$
\end{algorithmic}
\end{algorithm}
\subsection{Index Construction}
Hanzo Search maintains a dual index:
\begin{itemize}[leftmargin=1.1em]
\item \textbf{Sparse index}: Lucene-based inverted index with BM25 scoring, shingle analysis, and language-specific tokenization. Updated via continuous web crawling (50M pages/day).
\item \textbf{Dense index}: HNSW vector index~\cite{malkov2018efficient} storing 768-dimensional embeddings from a fine-tuned BGE-large model~\cite{xiao2023bge}. Re-indexed daily with incremental updates.
\end{itemize}
The dual index resides on a distributed cluster of 24 nodes with 8TB RAM total, supporting sub-100ms retrieval latency for both index types.