{"id":13015,"date":"2025-09-10T15:05:43","date_gmt":"2025-09-10T14:05:43","guid":{"rendered":"https:\/\/www.blopig.com\/blog\/?p=13015"},"modified":"2025-09-10T15:06:49","modified_gmt":"2025-09-10T14:06:49","slug":"accelerating-alphafold-3-for-high-throughput-structure-prediction","status":"publish","type":"post","link":"https:\/\/www.blopig.com\/blog\/2025\/09\/accelerating-alphafold-3-for-high-throughput-structure-prediction\/","title":{"rendered":"Accelerating AlphaFold 3 for high-throughput structure prediction"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Introduction<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Recently, I have been conducting a project in which I need to predict the structures of a dataset comprising a few thousand protein sequences using AlphaFold 3. Taking a naive approach, it was taking an hour or two per entry to get a predicted structure. With a few thousand structures, it seemed that it would take months to be able to run\u2026<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this blog post, I will go through some tips I found to help accelerate the structure predictions and make all of the predictions I needed in under a week. In general, following the tips in the <a href=\"https:\/\/github.com\/google-deepmind\/alphafold3\/blob\/main\/docs\/performance.md\">AlphaFold 3 performance<\/a> documentation is a useful starting place. Most of the tips I provide are related to accelerating the MSA generation portion of the predictions because this was the biggest bottleneck in my case.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h1 class=\"wp-block-heading\">Tip 1: Split MSA generation and structure prediction<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">TLDR: The CPU-limited MSA generation steps and the GPU-limited structure folding portions of AlphaFold can be split up using the <code>--norun_inference<\/code> and <code>--norun_data_pipeline<\/code> flags.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first thing I tried was parallelising the workflow, but this quickly ran into issues because I only had 1 GPU and the predictions competed for the GPU memory, causing errors. My structures contain roughly a thousand residues (~7.5k atoms), which equates to needing an entire GPU card with 40GB of GPU memory to predict each structure. However, when I looked at what was involved in making the predictions, I could see that most of the time was spent creating the multiple sequence alignments (MSAs) on the CPU, and only 1-2 minutes of the hour was spent using the GPU for predictions. Following the instructions <a href=\"https:\/\/github.com\/google-deepmind\/alphafold3\/blob\/main\/docs\/performance.md#running-the-pipeline-in-stages\">in the AlphaFold 3 docs<\/a>, I split the workflow up into different steps: the data pipeline (<code>--norun_inference<\/code>) and the inference stage (<code>--norun_data_pipeline<\/code>). This then allowed me to parallelise the MSA generation step and then run the inference steps serially afterwards. Additionally, doing this means that retroactively adding seeds or other modifications to the inference stage does not require re-running MSAs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It\u2019s important to note that each MSA stage itself makes use of parallel programming. Using the default settings, 32 worker threads are spawned (8 threads for each of the 4 databases to search) as well as 4 parent threads to launch and orchestrate the 8 worker threads (36 threads total). Take this account based on your own system specs to decide how many MSA builds you can do at once on your system.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Tip 2: Look for redundancy in MSA generation<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">My dataset comprised T cell antigen receptors (TCRs) binding to peptides presented by major histocompatibility molecule complexes (pMHCs). Although each TCR:pMHC complex is a unique combination, there are many cases of duplicate chains, either the same MHCs presenting different peptides, or duplicate alpha or beta chains of the TCRs binding to different pMHCs. Since each chain is considered separately during the MSA building process, there is no need to re-run the MSA searches for the same chain in different contexts. Therefore, I created a deduplicated set of all of the unique protein chains and ran MSAs for these once. This cut down the total number of MSA generations by a factor of 8.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Additionally, although the short peptides presented by the MHCs take a long time to run the MSA search, the entries came back empty, as there are no short comparable sequences in the databases to compare with. For these, I spoofed the empty MSAs that were returned to save more MSA running time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After generating the MSAs, the inputs for the inference stage can be made by recombining the correct MSAs for each chain.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Tip 3: Use alternative databases for MSA generation<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Neither of the previous tips changes the output from AlphaFold, as they reproduce all of the information for each step; however, the biggest speed gain came from using different databases to search during the MSA building stage, which does produce different results from the original workflow. Thus, following this tip requires careful evaluation of the predicted structures to ensure they are adequate for the intended use.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the <a href=\"https:\/\/academic.oup.com\/nar\/article\/51\/W1\/W569\/7151345\">TCRmodel2 paper<\/a>, the authors highlight how, in the task of predicting proteins in the same family, the MSAs do not vary much between predictions. The authors use this to create TCR:pMHC specific subsets of the AlphaFold sequence databases by running a handful of examples of these proteins through the MSA pipeline and collating the deduplicated hits into new subsets of the databases. Since the subsets are much smaller than the original databases, they are much faster to search through and take up a fraction of the storage space.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ultimately, implementing this resulted in the largest speed-up of my prediction workflow and validation of these structures showed comparable results to using the original AlphaFold databases.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Other tips<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Other tips that might be helpful are that AlphaFold can be run using Singularity\/Apptainer instead of Docker on HPC setups where Docker might not be supported (<a href=\"https:\/\/github.com\/google-deepmind\/alphafold3\/blob\/main\/docs\/installation.md#running-using-singularity-instead-of-docker\">see here for instructions<\/a>). Also, alternative tools that are more performant could be used to generate the MSAs. ColabFold uses MMSeqs2 over jackhmmer to build MSAs and <a href=\"https:\/\/github.com\/sokrypton\/ColabFold?tab=readme-ov-file#saving-msas-in-alphafold3-compatible-json-format\">has instructions on how to use this to generate AlphaFold 3-compatible outputs<\/a>. There are also options to use <a href=\"https:\/\/github.com\/sokrypton\/ColabFold?tab=readme-ov-file#gpu-accelerated-search-with-colabfold_search\">GPUs to accelerate MSA generation using MMSeqs2<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This blog has focused on improving performance in MSA generation, but if that is not a bottleneck for you, the AlphaFold 3 docs have some suggestions for <a href=\"https:\/\/github.com\/google-deepmind\/alphafold3\/blob\/main\/docs\/performance.md#accelerator-hardware-requirements\">improving inference performance<\/a> as well.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Recently, I have been conducting a project in which I need to predict the structures of a dataset comprising a few thousand protein sequences using AlphaFold 3. Taking a naive approach, it was taking an hour or two per entry to get a predicted structure. With a few thousand structures, it seemed that it [&hellip;]<\/p>\n","protected":false},"author":109,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","wikipediapreview_detectlinks":true,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ngg_post_thumbnail":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[633,296,14,189,229,228,202],"tags":[876,24,5,58],"ppma_author":[714],"class_list":["post-13015","post","type-post","status-publish","format-standard","hentry","category-ai","category-hints-and-tips","category-howto","category-machine-learning","category-protein-folding","category-protein-structure","category-proteins","tag-alphafold-3","tag-bioinformatics","tag-protein-structure","tag-protein-structure-prediction"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"authors":[{"term_id":714,"user_id":109,"is_guest":0,"slug":"benjamin","display_name":"Benjamin McMaster","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/d08cff80235bc80063c59072381da602325bce09b5774c2bc0db69545176f359?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/13015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/users\/109"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/comments?post=13015"}],"version-history":[{"count":1,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/13015\/revisions"}],"predecessor-version":[{"id":13016,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/13015\/revisions\/13016"}],"wp:attachment":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/media?parent=13015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/categories?post=13015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/tags?post=13015"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=13015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}