Table of Contents
Fetching ...

AMGPT: a Large Language Model for Contextual Querying in Additive Manufacturing

Achuth Chandrasekhar, Jonathan Chan, Francis Ogoke, Olabode Ajenifujah, Amir Barati Farimani

TL;DR

AMGPT tackles the lack of domain-specific guidance in general LLMs for metal additive manufacturing by combining a pre-trained LLaMA2-7B with a retrieval-augmented generation pipeline. The approach integrates ~50 AM papers and texts via a dual-encoder RAG setup, using an embedding model and a vector store to ground responses in primary sources, and employs a Streamlit UI for interactive querying. Key contributions include an end-to-end open-source pipeline (Hugging Face integration, LangChain/LlamaIndex backends, Mathpix TeX conversion) and a systematic analysis of inference parameters (temperature, max tokens, top_k) to optimize factuality and coherence. The results demonstrate solid domain grounding relative to pure LLMs, with potential for further enhancements through memory, fine-tuning, and richer document processing, enabling researchers to navigate AM literature more effectively. This work advances practical, literature-grounded AM guidance by showing how RAG-enabled, medium-sized LLMs can outperform generic models in specialized domains while remaining computationally feasible for research settings. It demonstrates a replicable path to building domain experts from existing corpora, with implications for rapid knowledge synthesis in fast-moving scientific fields. The combination of open-source tools and a transparent workflow lowers barriers for researchers to deploy similar domain-specific assistants in other technical domains.

Abstract

Generalized large language models (LLMs) such as GPT-4 may not provide specific answers to queries formulated by materials science researchers. These models may produce a high-level outline but lack the capacity to return detailed instructions on manufacturing and material properties of novel alloys. Enhancing a smaller model with specialized domain knowledge may provide an advantage over large language models which cannot be retrained quickly enough to keep up with the rapid pace of research in metal additive manufacturing (AM). We introduce "AMGPT," a specialized LLM text generator designed for metal AM queries. The goal of AMGPT is to assist researchers and users in navigating the extensive corpus of literature in AM. Instead of training from scratch, we employ a pre-trained Llama2-7B model from Hugging Face in a Retrieval-Augmented Generation (RAG) setup, utilizing it to dynamically incorporate information from $\sim$50 AM papers and textbooks in PDF format. Mathpix is used to convert these PDF documents into TeX format, facilitating their integration into the RAG pipeline managed by LlamaIndex. Expert evaluations of this project highlight that specific embeddings from the RAG setup accelerate response times and maintain coherence in the generated text.

AMGPT: a Large Language Model for Contextual Querying in Additive Manufacturing

TL;DR

AMGPT tackles the lack of domain-specific guidance in general LLMs for metal additive manufacturing by combining a pre-trained LLaMA2-7B with a retrieval-augmented generation pipeline. The approach integrates ~50 AM papers and texts via a dual-encoder RAG setup, using an embedding model and a vector store to ground responses in primary sources, and employs a Streamlit UI for interactive querying. Key contributions include an end-to-end open-source pipeline (Hugging Face integration, LangChain/LlamaIndex backends, Mathpix TeX conversion) and a systematic analysis of inference parameters (temperature, max tokens, top_k) to optimize factuality and coherence. The results demonstrate solid domain grounding relative to pure LLMs, with potential for further enhancements through memory, fine-tuning, and richer document processing, enabling researchers to navigate AM literature more effectively. This work advances practical, literature-grounded AM guidance by showing how RAG-enabled, medium-sized LLMs can outperform generic models in specialized domains while remaining computationally feasible for research settings. It demonstrates a replicable path to building domain experts from existing corpora, with implications for rapid knowledge synthesis in fast-moving scientific fields. The combination of open-source tools and a transparent workflow lowers barriers for researchers to deploy similar domain-specific assistants in other technical domains.

Abstract

Generalized large language models (LLMs) such as GPT-4 may not provide specific answers to queries formulated by materials science researchers. These models may produce a high-level outline but lack the capacity to return detailed instructions on manufacturing and material properties of novel alloys. Enhancing a smaller model with specialized domain knowledge may provide an advantage over large language models which cannot be retrained quickly enough to keep up with the rapid pace of research in metal additive manufacturing (AM). We introduce "AMGPT," a specialized LLM text generator designed for metal AM queries. The goal of AMGPT is to assist researchers and users in navigating the extensive corpus of literature in AM. Instead of training from scratch, we employ a pre-trained Llama2-7B model from Hugging Face in a Retrieval-Augmented Generation (RAG) setup, utilizing it to dynamically incorporate information from 50 AM papers and textbooks in PDF format. Mathpix is used to convert these PDF documents into TeX format, facilitating their integration into the RAG pipeline managed by LlamaIndex. Expert evaluations of this project highlight that specific embeddings from the RAG setup accelerate response times and maintain coherence in the generated text.
Paper Structure (24 sections, 4 figures, 6 tables)

This paper contains 24 sections, 4 figures, 6 tables.

Figures (4)

  • Figure 1: A flowchart depicting the process of querying a database using an embedding model to provide context to a Large Language Model (LLM), which in turn generates an answer.
  • Figure 2: Text embeddings are a fundamental technique in natural language processing (NLP) that translate words, sentences, or even entire documents into numerical vectors of real numbers. This process effectively converts discrete textual information into a form that can be understood and processed by machine learning algorithms. The figure shown above illustrates this process of abstraction by means of an embedding model. The primary aim of text embeddings is to encapsulate the semantic meaning of text, reflecting nuances of language such as context, tone, and similarity between words or phrases.
  • Figure 3: Illustration of a Retrieval-Augmented Generation (RAG) workflow. Documents are loaded and processed into chunks, which are then embedded using an embedding model, creating vectors stored in a database. The query engine utilizes these vectors to match user queries against document chunks, and retrieves the most relevant content. Finally, the retrieved information is enhanced by the LLaMA2-7B language model to generate comprehensive and contextual responses.
  • Figure 4: Chat Interface for AMGPT built using Streamlit