Optimizing FPGA-based Accelerator Design for Large-Scale Molecular Similarity Search (Special Session Paper)

Hongwu Peng, Shiyang Chen, Zhepeng Wang, Junhuan Yang, Scott A. Weitze, Tong Geng, Ang Li, Jinbo Bi, Minghu Song, Weiwen Jiang, Hang Liu, Caiwen Ding

TL;DR

This paper presents the first FPGA-based accelerators for large-scale molecular similarity search, significantly outperforming CPU and GPU implementations. By optimizing both exhaustive (BitBound & Folding) and approximate (HNSW) search algorithms, the authors achieve remarkable speedups and throughputs, paving the way for faster drug discovery.

What Problem Does This Paper Address?

In drug discovery, identifying molecules with similar structures to known compounds is crucial for finding new drugs. This process, known as molecular similarity search, involves comparing a query molecule against massive databases of chemical compounds. The challenge lies in the sheer scale of these databases, which can contain millions or even billions of molecules. Traditional methods using CPUs and GPUs, while effective, struggle to keep pace with the growing demand for speed and efficiency. Existing research has primarily focused on accelerating the core similarity calculation (Tanimoto coefficient) but has not extensively explored hardware acceleration for the entire search process on FPGAs, leaving a gap in high-performance, low-power solutions.

Methods

The authors propose and optimize FPGA designs for two main types of molecular similarity search algorithms:

  • Exhaustive Search (BitBound & Folding): They introduce a "scalable on-the-fly query engine" that integrates computation and communication in a pipelined fashion. This design aims to reduce resource utilization and pipeline latency. Key components include a Bit Count module, a Tanimoto Factor Calculation (TFC) module, and a Top-K merge sort module. They also explore the trade-offs between similarity cutoff, folding level, search speed, and accuracy.
  • Approximate Search (Hierarchical Navigable Small World - HNSW): For HNSW, they develop an FPGA-based graph traversal engine. This engine leverages a high-throughput register array-based priority queue and a fine-grained distance calculation engine to boost processing capabilities. The design focuses on optimizing the search layer traversal and the base layer search, utilizing hardware priority queues instead of traditional merge sort for efficiency.

Datasets

The primary dataset used for evaluation is the Chembl 27.1 database, which contains approximately 1.9 million molecules. The RDKit toolbox was used for generating the 1024-bit Morgan binary fingerprints from these molecules.

Key Insights and Ideas

  • FPGA as a Viable Platform: The paper demonstrates that FPGAs can be highly effective for accelerating molecular similarity search, offering significant advantages in throughput and energy efficiency over CPUs and GPUs for this specific task.
  • On-the-Fly Processing: Integrating computation and communication into a pipelined "on-the-fly" design is crucial for maximizing throughput and minimizing latency in FPGA accelerators.
  • Hardware-Algorithm Co-design: The success hinges on tailoring the FPGA architecture to the specific needs of the algorithms, such as using register arrays for priority queues in HNSW and optimizing data movement for BitBound & Folding.
  • Trade-offs in Approximate Search: For HNSW, there's a clear trade-off between search parameters (like ef and m) and performance (QPS vs. Recall). Design space exploration is vital to find optimal configurations.
  • Memory Bandwidth is Key: High Bandwidth Memory (HBM) plays a critical role in overcoming communication bottlenecks, especially for large datasets, enabling high query rates.

Key Results

  • Exhaustive Search (BitBound & Folding):
    • Achieved a throughput of 450 million compounds/second for a single query engine.
  • On the Chembl database, achieved 1638 QPS for brute-force search and 25403 QPS for BitBound & Folding with 0.97 recall.
  • Approximate Search (HNSW):
    • Achieved 103385 QPS with 0.92 recall on the Chembl database.
  • Demonstrated an average 35x speedup compared to existing CPU implementations.
  • Overall: The FPGA implementation achieved over 25x speedup on brute-force search and an average 30x speedup for BitBound & Folding compared to CPU.

Limitations and Future Work

  • Design Space Exploration: While the paper explores design spaces for both algorithms, further exploration could potentially yield even better performance or resource utilization. The authors mention that different design parameters (like ef and m for HNSW) impact performance and that more kernels can improve overall throughput.
  • Extensibility: The proposed FPGA architecture is designed to be extensible, suggesting that other algorithms within the exhaustive and approximate search categories could be accelerated using similar principles.
  • First of its Kind: The paper highlights that this is the first attempt to accelerate molecular similarity search algorithms on FPGAs, implying that this is an emerging area with significant room for future research and development.

Summary updated

Abstract

Molecular similarity search has been widely used in drug discovery to identify structurally similar compounds from large molecular databases rapidly. With the increasing size of chemical libraries, there is growing interest in the efficient acceleration of large-scale similarity search. Existing works mainly focus on CPU and GPU to accelerate the computation of the Tanimoto coefficient in measuring the pairwise similarity between different molecular fingerprints. In this paper, we propose and optimize an FPGA-based accelerator design on exhaustive and approximate search algorithms. On exhaustive search using BitBound & folding, we analyze the similarity cutoff and folding level relationship with search speedup and accuracy, and propose a scalable on-the-fly query engine on FPGAs to reduce the resource utilization and pipeline interval. We achieve a 450 million compounds-per-second processing throughput for a single query engine. On approximate search using hierarchical navigable small world (HNSW), a popular algorithm with high recall and query speed. We propose an FPGA-based graph traversal engine to utilize a high throughput register array based priority queue and fine-grained distance calculation engine to increase the processing capability. Experimental results show that the proposed FPGA-based HNSW implementation has a 103385 query per second (QPS) on the Chembl database with 0.92 recall and achieves a 35x speedup than the existing CPU implementation on average. To the best of our knowledge, our FPGA-based implementation is the first attempt to accelerate molecular similarity search algorithms on FPGA and has the highest performance among existing approaches.
BibTeX
@inproceedings{peng2021optimizing,
  author = {Hongwu Peng and Shiyang Chen and Zhepeng Wang and Junhuan Yang and Scott A. Weitze and Tong Geng and Ang Li and Jinbo Bi and Minghu Song and Weiwen Jiang and Hang Liu and Caiwen Ding},
  title = {{Optimizing FPGA-based Accelerator Design for Large-Scale Molecular Similarity Search (Special Session Paper)}},
  booktitle = {ICCAD},
  year = {2021},
  doi = {10.1109/iccad51958.2021.9643528},
}
Figure