{"id":142650,"date":"2025-05-29T23:37:09","date_gmt":"2025-05-29T23:37:09","guid":{"rendered":"https:\/\/www.europesays.com\/uk\/142650\/"},"modified":"2025-05-29T23:37:09","modified_gmt":"2025-05-29T23:37:09","slug":"harnessing-llms-for-scientific-computing","status":"publish","type":"post","link":"https:\/\/www.europesays.com\/uk\/142650\/","title":{"rendered":"Harnessing LLMs for Scientific Computing"},"content":{"rendered":"<p>Large language models (LLMs)\u00a0have developed dramatically in the past few years, with applications ranging from text processing to predicting virus variants. As the datasets on which LLM models are trained become increasingly massive \u2014 including trillions of parameters \u2014 there is a growing need for strategies to make these models\u00a0less costly and more effective for scientific uses such as code translation, visualization, compression, privacy protection, and prediction.<\/p>\n<p>Researchers in the Mathematics and Computer Science (MCS) division at the U.S. Department of Energy\u2019s Argonne National Laboratory have addressed this need in several ways.\u00a0<\/p>\n<p>Converting Code\u00a0<\/p>\n<p>A key problem in science is converting legacy Fortran codes to C++. Although Fortran is highly performant, its support for heterogeneous platforms is inferior to that of C++. Manual translation has been the typical approach, but the process is nontrivial, requiring extensive knowledge of both languages and can be extremely labor intensive.\u00a0<\/p>\n<p>\u201cThis is where CodeScribe shines,\u201d said Anshu Dubey, a senior computational scientist and lead PI for the research.<\/p>\n<p>CodeScribe is a new tool that combines user supervision with chat completion \u2014 a technique that uses structured conversations to craft the most effective \u200b\u201cprompts\u201d that produce the desired output. To enhance the process, CodeScribe leverages emerging generative AI technologies. First, it maps the project structure by indexing subroutines, modules, and functions across various files. Next, it generates a draft of the C++ code for a given Fortran source file. The generated results are reviewed, and errors are addressed manually by the developer or sent for regeneration by updating the original prompt.<\/p>\n<p>\u201cCodeScribe automates many aspects, but human expertise remains essential for the final review,\u201d said Akash Dhruv, an assistant computational scientist and primary developer of the new tool.<\/p>\n<p>CodeScribe was motivated by scientists\u2019 desire to convert MCFM \u2014 a Monte Carlo code that simulates particle interactions observed at the Large Hadron Collider \u2014 so the code would be interoperable with other high-energy physics codes and libraries. The researchers used several generative AI models for the MCFM\u00a0code conversion, each with distinct parameter counts and capabilities. While GPT-4o emerged as the most effective model in this context. (see Fig. 1), the performance also revealed opportunities for optimization, particularly concerning the manual review and testing processes associated with such translations.<\/p>\n<p><a href=\"https:\/\/www.hpcwire.com\/wp-content\/uploads\/2025\/05\/Harness-LLM-2-LLMbased_web.jpg\" rel=\"nofollow noopener\" target=\"_blank\"><img fetchpriority=\"high\" decoding=\"async\" class=\" wp-image-180846\" src=\"https:\/\/www.europesays.com\/uk\/wp-content\/uploads\/2025\/05\/Harness-LLM-2-LLMbased_web-300x169.jpg\" alt=\"\" width=\"478\" height=\"269\"  \/><\/a>Figure 1: Schematic of the workflow for LLM-based code conversion process. Steps in blue are managed using CodeScribe, while steps in red are manual and require developer intervention.<\/p>\n<p>In ongoing work, the researchers are applying CodeScribe to other applications. For example, they use CodeSource to build GPU compatibility between the Flash-X open-source multiphase simulation software and the AMRex framework for block-structured adaptive mesh refinement applications. The researchers envision CodeScribe as a valuable tool that empowers developers in scientific computing to leverage generative AI effectively.<\/p>\n<p>For further information, see A. Dhruv and A. Dubey, \u200b\u201cLeveraging Large Language Models for Code Translation and Software Development in Scientific Computing,\u201d accepted by the <a href=\"https:\/\/\u200bdoi\u200b.org\/\u200b1\u200b0\u200b.\u200b4\u200b8\u200b5\u200b5\u200b0\u200b\/\u200ba\u200br\u200bX\u200bi\u200bv\u200b.\u200b2\u200b4\u200b1\u200b0\u200b.\u200b24119\" rel=\"nofollow\">Platform for Advanced Scientific Computing conference.<\/a><\/p>\n<p>Making LLMs More Manageable\u00a0<\/p>\n<p>Another major challenge facing LLMs is making them accessible with significantly reduced computational resources.\u00a0Pruning has emerged as an important compression strategy to enhance memory and computational efficiency, but traditional global pruning has been impractical for LLMs because of scalability issues.<\/p>\n<p>Researchers from Emory University and Argonne have developed SparseLLM to address this challenge.\u00a0This innovative method redefines the global pruning process into multiple local optimization subproblems coordinated by auxiliary variables. The researchers introduced an alternating optimization strategy in which some subproblems are optimized while others are kept fixed; the process is then repeated with a different subset. For the optimization, they leveraged sparsity-aware algorithms to optimize both the pruning mask selection and weight reconstruction simultaneously, ensuring minimal performance degradation (see Fig. 2).<\/p>\n<p><a href=\"https:\/\/www.hpcwire.com\/wp-content\/uploads\/2025\/05\/Harness-LLM-3-sparsellm.jpg\" rel=\"nofollow noopener\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-180847\" src=\"https:\/\/www.europesays.com\/uk\/wp-content\/uploads\/2025\/05\/Harness-LLM-3-sparsellm-300x169.jpg\" alt=\"\" width=\"437\" height=\"246\"  \/><\/a>Figure 2: SparseLLM decomposes the global pruning of LLMs into manageable subproblems by leveraging the chain of modules and auxiliary variables<\/p>\n<p>\u201cBy not optimizing all the variables at the same time, we can achieve more scalable training while reducing the computational cost,\u201d said Kibaek Kim, a computational mathematician and one of the developers of SparseLLM.<\/p>\n<p>For further information, see the paper by Guangji Bai, Yijiang Li, Kibaek Kim, and Liang Zhao, \u200b\u201cTowards Global Pruning for Pre-trained Language Models,\u201d <a class=\"editor-rtfLink\" href=\"https:\/\/arxiv.org\/abs\/2402.17946\" target=\"_blank\" rel=\"noopener nofollow\">arXivL2402.17946<\/a>; poster at NeurlPS\u00a0 2024.<\/p>\n<p>Reasoning with LLMs<\/p>\n<p>Whether LLMs can reason has become a highly debated issue. Some studies cite achievements in multistep planning and prediction as demonstrating LLMs\u2019 reasoning capabilities; others argue that \u200b\u201ctrue reasoning\u201d goes beyond LLMs\u2019 ability to recognize patterns and apply logical rules. In a recent study, Argonne and the University of Pennsylvania researchers joined the debate by focusing on a new aspect \u2014 LLM token biases when solving logical problems.<\/p>\n<p>They introduced a hypothesis-testing framework to evaluate multiple commercial and open-source LLMs. They applied tests on matched problem pairs to detect performance shifts when logically irrelevant tokens, such as names or quantifiers, were altered. The results showed that many state-of-the-art LLMs fail to generalize logical reasoning across minor perturbations, suggesting they often rely on superficial token patterns rather than formal logical reasoning (see Fig. 3).<\/p>\n<p><a href=\"https:\/\/www.hpcwire.com\/wp-content\/uploads\/2025\/05\/Harness-LLM-4-claude-3-n12-n21.jpg\" rel=\"nofollow noopener\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-180848\" src=\"https:\/\/www.europesays.com\/uk\/wp-content\/uploads\/2025\/05\/Harness-LLM-4-claude-3-n12-n21-300x169.jpg\" alt=\"\" width=\"501\" height=\"282\"  \/><\/a>Figure 3: Experimental results in which the perturbed problems add the names of trustworthy news agencies and universities to alter the narratives of syllogisms. LLMs tend to falsely believe that these narratives are more trustworthy and hence ignore the logical fallacy in them.<\/p>\n<p>\u201cWe demonstrated statistically that apparent reasoning success may stem from token bias rather than actual understanding,\u201d said Tanwi Mallick, an assistant computer scientist. \u200b\u201cThe study provides new insights into the reliability of LLMs and opens avenues for future work on ways to improve LLMs\u2019 logical reasoning ability.\u201d<\/p>\n<p>For further information, see the paper by Bowen Jiang, Yangxinyu Xie, Zhuoqun Hao, Xiaomeng Wang, Tanwi Mallick, Weijie J Su, Camillo J Taylor, and Dan Roth, \u200b\u201c<a class=\"editor-rtfLink\" href=\"https:\/\/arxiv.org\/abs\/2406.11050\" target=\"_blank\" rel=\"noopener nofollow\">A Peek into Token Bias: Large Language Models Are Not Yet Genuine Reasoners<\/a>,\u201d in Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, <a href=\"https:\/\/\u200baclan\u200bthol\u200bo\u200bgy\u200b.org\/\u200b2\u200b0\u200b2\u200b4\u200b.\u200be\u200bm\u200bn\u200bl\u200bp\u200b-\u200bm\u200ba\u200bi\u200bn\u200b.\u200b2\u200b7\u200b2.pdf\" rel=\"nofollow\">pp. 4722\u20134756<\/a>.<\/p>\n<p>Visualizing with an LLM<\/p>\n<p>Creating scientific visualizations is challenging, consuming considerable time, and requiring data analysis and visualization expertise. Four researchers from Argonne\u2019s MCS Division have proposed a new approach:\u00a0synthetic software generation using an LLM. To this end, they have developed\u00a0an AI assistant, ChatVis, that allows the user to specify a chain of analysis\/visualization operations in natural language.\u00a0<\/p>\n<p>ChatVis generates a Python script for the desired operations and iterates until the script executes correctly, prompting the LLM to revise the script as needed. Moreover, the LLMs are\u00a0not trained in esoteric visualization operations; instead, ChatVis allows commonly available LLMs, such as ChatGPT, to generate correct visualizations without retraining or fine-tuning.\u00a0<\/p>\n<p>\u201cChatVis employs a friendly human-centric natural-language interface,\u201d said Orcun Yildiz, an assistant computer scientist. \u200b\u201cDomain scientists, managers, administrators, and decision-makers who are not visualization experts can now generate their own\u00a0high-quality visualizations.\u201d<\/p>\n<p>The Argonne team compared visualizations against five state-of-the-art LLM models with and without ChatVis. With ChatVis, they generated all five visualizations successfully; without ChatVis, the best LLM could generate only one of the five cases correctly. Figure 4 shows how closely ChatVis matched the ground truth.<\/p>\n<p><a href=\"https:\/\/www.hpcwire.com\/wp-content\/uploads\/2025\/05\/Harness-LLM-5-ChatVis.jpg\" rel=\"nofollow noopener\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-180849\" src=\"https:\/\/www.europesays.com\/uk\/wp-content\/uploads\/2025\/05\/Harness-LLM-5-ChatVis-300x169.jpg\" alt=\"\" width=\"499\" height=\"281\"  \/><\/a>Figure 4: Generated images for volume rendering. ChatVis produced a screenshot identical to the ground truth except for a different color palette because the user prompt did not specify one.<\/p>\n<p>For the full study, see the paper by Tanwi Mallick, Orcun Yildiz, David Lenz, and Tom Peterka,<strong> \u200b\u201c<\/strong>ChatVis: Automating Scientific Visualization with a Large Language Model,\u201d in\u00a0SC24-W: Workshops of the International Conference for High-Performance Computing,\u00a0Networking, Storage and Analysis, <a href=\"https:\/\/\u200barx\u200biv\u200b.org\/\u200bh\u200bt\u200bm\u200bl\u200b\/\u200b2\u200b4\u200b1\u200b0\u200b.\u200b11863.\" rel=\"nofollow\">pp. 49-55<\/a>.<\/p>\n<p>Pruning and Privacy with LLMs\u00a0<\/p>\n<p>The enormous size of LLM datasets means they have high computational and storage demands. Pruning can reduce model size, but most methods assume public access to the data, hindering their use in privacy-sensitive applications.<\/p>\n<p>Researchers at Argonne and Emory University have now proposed the first federated learning framework designed specifically for pruning LLMs over distributed data silos. Called FedSpaLLM, the new framework enables clients to prune their models locally based on private datasets, each owned by a different institution. The approach allows collaboration without sharing the raw data; only the model updates (e.g., weights or parameters) are shared, thus ensuring data privacy.<\/p>\n<p>The researchers introduce three innovations in FedSpaLLM: a specialized aggregation function to handle sparse model updates, an adaptive mask expansion technique to ensure that the global model meets the target sparsity, and a layer sampling strategy that allows clients to prune subsets of model layers based on their computational resources, enabling personalized pruning and reducing communication costs.<\/p>\n<p>Extensive experiments show the efficacy of the approach. The key metric used with FedSpaLLM to evaluate the models was \u200b\u201cperplexity,\u201d a well-known metric considered well-suited for assessing the accuracy of compression methods and thus measuring the performance of the compressed models.\u00a0<\/p>\n<p>\u201cPerplexity seems an odd name, but it reflects the confidence the model has in making a prediction,\u201d said Yijiang Li, a postdoctoral appointee. \u200b\u201cLower perplexity means greater confidence.\u201d<\/p>\n<p>As shown in Fig. 5, FedSpaLLM consistently outperforms \u200b\u201cstandalone\u201d client models in achieving lower perplexity. Random pruning (not shown) suffers from perplexity, an order of magnitude higher than the standalone models and FedSpaLLM.<\/p>\n<p><a href=\"https:\/\/www.hpcwire.com\/wp-content\/uploads\/2025\/05\/Harness-LLM-6-MCSGraph_web.jpg\" rel=\"nofollow noopener\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-180850\" src=\"https:\/\/www.europesays.com\/uk\/wp-content\/uploads\/2025\/05\/Harness-LLM-6-MCSGraph_web-300x169.jpg\" alt=\"\" width=\"460\" height=\"259\"  \/><\/a>Figure 5: Performance improvements in the metric perplexity from FedSpaLLM over client \u200b\u201cstandalone\u201d models.<\/p>\n<p>In general, as the target sparsity increases, the perplexity of the global model (e.g., FedSpaLLM) improves more than that of the client models (e.g., standalone).\u00a0<\/p>\n<p>The results highlight the benefits of FedSpaLLM as a promising solution for resource-constrained applications where privacy is critical.<\/p>\n<p>For further information, see the preprint by Guangji Bai, Yijiang Li, Zilinghan Li, Liang Zhao, and Kibaek Kim. \u200b\u201c<a class=\"editor-rtfLink\" href=\"https:\/\/arxiv.org\/abs\/2410.14852\" target=\"_blank\" rel=\"noopener nofollow\">FedSpaLLM: Federated Pruning of Large Language Models<\/a>,\u201d to appear in NAACL 2025.<\/p>\n<p>Originally posted by <a href=\"https:\/\/www.anl.gov\/mcs\/article\/harnessing-llms-for-scientific-computing\" rel=\"nofollow noopener\" target=\"_blank\">Argonne National Lab MCS<\/a>, reprinted here with permission.<\/p>\n","protected":false},"excerpt":{"rendered":"Large language models (LLMs)\u00a0have developed dramatically in the past few years, with applications ranging from text processing to&hellip;\n","protected":false},"author":2,"featured_media":142651,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_share_on_mastodon":"0"},"categories":[3164],"tags":[31553,3284,13814,61677,61678,61679,32594,28397,61680,61681,53,16,15,61682],"class_list":["post-142650","post","type-post","status-publish","format-standard","has-post-thumbnail","category-computing","tag-argonne-national-laboratory","tag-computing","tag-llms","tag-mathematical-modeling","tag-modeling-and-simulation","tag-monte-carlo-simulation","tag-optimization","tag-perplexity","tag-scientific-data-management","tag-sparse-llm","tag-technology","tag-uk","tag-united-kingdom","tag-visualization"],"share_on_mastodon":{"url":"https:\/\/pubeurope.com\/@uk\/114593755715998391","error":""},"_links":{"self":[{"href":"https:\/\/www.europesays.com\/uk\/wp-json\/wp\/v2\/posts\/142650","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.europesays.com\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.europesays.com\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/uk\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/uk\/wp-json\/wp\/v2\/comments?post=142650"}],"version-history":[{"count":0,"href":"https:\/\/www.europesays.com\/uk\/wp-json\/wp\/v2\/posts\/142650\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/uk\/wp-json\/wp\/v2\/media\/142651"}],"wp:attachment":[{"href":"https:\/\/www.europesays.com\/uk\/wp-json\/wp\/v2\/media?parent=142650"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.europesays.com\/uk\/wp-json\/wp\/v2\/categories?post=142650"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.europesays.com\/uk\/wp-json\/wp\/v2\/tags?post=142650"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}