Stay Ahead, Stay ONMINE

LLM + RAG: Creating an AI-Powered File Reader Assistant

Introduction AI is everywhere.  It is hard not to interact at least once a day with a Large Language Model (LLM). The chatbots are here to stay. They’re in your apps, they help you write better, they compose emails, they read emails…well, they do a lot. And I don’t think that that is bad. In fact, my opinion is the other way – at least so far. I defend and advocate for the use of AI in our daily lives because, let’s agree, it makes everything much easier. I don’t have to spend time double-reading a document to find punctuation problems or type. AI does that for me. I don’t waste time writing that follow-up email every single Monday. AI does that for me. I don’t need to read a huge and boring contract when I have an AI to summarize the main takeaways and action points to me! These are only some of AI’s great uses. If you’d like to know more use cases of LLMs to make our lives easier, I wrote a whole book about them. Now, thinking as a data scientist and looking at the technical side, not everything is that bright and shiny.  LLMs are great for several general use cases that apply to anyone or any company. For example, coding, summarizing, or answering questions about general content created until the training cutoff date. However, when it comes to specific business applications, for a single purpose, or something new that didn’t make the cutoff date, that is when the models won’t be that useful if used out-of-the-box – meaning, they will not know the answer. Thus, it will need adjustments. Training an LLM model can take months and millions of dollars. What is even worse is that if we don’t adjust and tune the model to our purpose, there will be unsatisfactory results or hallucinations (when the model’s response doesn’t make sense given our query). So what is the solution, then? Spending a lot of money retraining the model to include our data? Not really. That’s when the Retrieval-Augmented Generation (RAG) becomes useful. RAG is a framework that combines getting information from an external knowledge base with large language models (LLMs). It helps AI models produce more accurate and relevant responses. Let’s learn more about RAG next. What is RAG? Let me tell you a story to illustrate the concept. I love movies. For some time in the past, I knew which movies were competing for the best movie category at the Oscars or the best actors and actresses. And I would certainly know which ones got the statue for that year. But now I am all rusty on that subject. If you asked me who was competing, I would not know. And even if I tried to answer you, I would give you a weak response.  So, to provide you with a quality response, I will do what everybody else does: search for the information online, obtain it, and then give it to you. What I just did is the same idea as the RAG: I obtained data from an external database to give you an answer. When we enhance the LLM with a content store where it can go and retrieve data to augment (increase) its knowledge base, that is the RAG framework in action. RAG is like creating a content store where the model can enhance its knowledge and respond more accurately. User prompt about Content C. LLM retrieves external content to aggregate to the answer. Image by the author. Summarizing: Uses search algorithms to query external data sources, such as databases, knowledge bases, and web pages. Pre-processes the retrieved information. Incorporates the pre-processed information into the LLM. Why use RAG? Now that we know what the RAG framework is let’s understand why we should be using it. Here are some of the benefits: Enhances factual accuracy by referencing real data. RAG can help LLMs process and consolidate knowledge to create more relevant answers  RAG can help LLMs access additional knowledge bases, such as internal organizational data  RAG can help LLMs create more accurate domain-specific content  RAG can help reduce knowledge gaps and AI hallucination As previously explained, I like to say that with the RAG framework, we are giving an internal search engine for the content we want it to add to the knowledge base. Well. All of that is very interesting. But let’s see an application of RAG. We will learn how to create an AI-powered PDF Reader Assistant. Project This is an application that allows users to upload a PDF document and ask questions about its content using AI-powered natural language processing (NLP) tools.  The app uses Streamlit as the front end. Langchain, OpenAI’s GPT-4 model, and FAISS (Facebook AI Similarity Search) for document retrieval and question answering in the backend. Let’s break down the steps for better understanding: Loading a PDF file and splitting it into chunks of text. This makes the data optimized for retrieval Present the chunks to an embedding tool. Embeddings are numerical vector representations of data used to capture relationships, similarities, and meanings in a way that machines can understand. They are widely used in Natural Language Processing (NLP), recommender systems, and search engines. Next, we put those chunks of text and embeddings in the same DB for retrieval. Finally, we make it available to the LLM. Data preparation Preparing a content store for the LLM will take some steps, as we just saw. So, let’s start by creating a function that can load a file and split it into text chunks for efficient retrieval. # Imports from langchain_community.document_loaders import PyPDFLoader from langchain.text_splitter import RecursiveCharacterTextSplitter def load_document(pdf): # Load a PDF “”” Load a PDF and split it into chunks for efficient retrieval. :param pdf: PDF file to load :return: List of chunks of text “”” loader = PyPDFLoader(pdf) docs = loader.load() # Instantiate Text Splitter with Chunk Size of 500 words and Overlap of 100 words so that context is not lost text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=100) # Split into chunks for efficient retrieval chunks = text_splitter.split_documents(docs) # Return return chunks Next, we will start building our Streamlit app, and we’ll use that function in the next script. Web application We will begin importing the necessary modules in Python. Most of those will come from the langchain packages. FAISS is used for document retrieval; OpenAIEmbeddings transforms the text chunks into numerical scores for better similarity calculation by the LLM; ChatOpenAI is what enables us to interact with the OpenAI API; create_retrieval_chain is what actually the RAG does, retrieving and augmenting the LLM with that data; create_stuff_documents_chain glues the model and the ChatPromptTemplate. Note: You will need to generate an OpenAI Key to be able to run this script. If it’s the first time you’re creating your account, you get some free credits. But if you have it for some time, it is possible that you will have to add 5 dollars in credits to be able to access OpenAI’s API. An option is using Hugging Face’s Embedding.  # Imports from langchain_community.vectorstores import FAISS from langchain_openai import OpenAIEmbeddings from langchain.chains import create_retrieval_chain from langchain_openai import ChatOpenAI from langchain.chains.combine_documents import create_stuff_documents_chain from langchain_core.prompts import ChatPromptTemplate from scripts.secret import OPENAI_KEY from scripts.document_loader import load_document import streamlit as st This first code snippet will create the App title, create a box for file upload, and prepare the file to be added to the load_document() function. # Create a Streamlit app st.title(“AI-Powered Document Q&A”) # Load document to streamlit uploaded_file = st.file_uploader(“Upload a PDF file”, type=”pdf”) # If a file is uploaded, create the TextSplitter and vector database if uploaded_file :     # Code to work around document loader from Streamlit and make it readable by langchain     temp_file = “./temp.pdf”     with open(temp_file, “wb”) as file:         file.write(uploaded_file.getvalue())         file_name = uploaded_file.name     # Load document and split it into chunks for efficient retrieval.     chunks = load_document(temp_file)     # Message user that document is being processed with time emoji     st.write(“Processing document… :watch:”) Machines understand numbers better than text, so in the end, we will have to provide the model with a database of numbers that it can compare and check for similarity when performing a query. That’s where the embeddings will be useful to create the vector_db, in this next piece of code. # Generate embeddings     # Embeddings are numerical vector representations of data, typically used to capture relationships, similarities,     # and meanings in a way that machines can understand. They are widely used in Natural Language Processing (NLP),     # recommender systems, and search engines.     embeddings = OpenAIEmbeddings(openai_api_key=OPENAI_KEY,                                   model=”text-embedding-ada-002″)     # Can also use HuggingFaceEmbeddings     # from langchain_huggingface.embeddings import HuggingFaceEmbeddings     # embeddings = HuggingFaceEmbeddings(model_name=”sentence-transformers/all-MiniLM-L6-v2″)     # Create vector database containing chunks and embeddings     vector_db = FAISS.from_documents(chunks, embeddings) Next, we create a retriever object to navigate in the vector_db. # Create a document retriever     retriever = vector_db.as_retriever()     llm = ChatOpenAI(model_name=”gpt-4o-mini”, openai_api_key=OPENAI_KEY) Then, we will create the system_prompt, which is a set of instructions to the LLM on how to answer, and we will create a prompt template, preparing it to be added to the model once we get the input from the user. # Create a system prompt     # It sets the overall context for the model.     # It influences tone, style, and focus before user interaction starts.     # Unlike user inputs, a system prompt is not visible to the end user.     system_prompt = (         “You are a helpful assistant. Use the given context to answer the question.”         “If you don’t know the answer, say you don’t know. ”         “{context}”     )     # Create a prompt Template     prompt = ChatPromptTemplate.from_messages(         [             (“system”, system_prompt),             (“human”, “{input}”),         ]     )     # Create a chain     # It creates a StuffDocumentsChain, which takes multiple documents (text data) and “stuffs” them together before passing them to the LLM for processing.     question_answer_chain = create_stuff_documents_chain(llm, prompt) Moving on, we create the core of the RAG framework, pasting together the retriever object and the prompt. This object adds relevant documents from a data source (e.g., a vector database) and makes it ready to be processed using an LLM to generate a response. # Creates the RAG      chain = create_retrieval_chain(retriever, question_answer_chain) Finally, we create the variable question for the user input. If this question box is filled with a query, we pass it to the chain, which calls the LLM to process and return the response, which will be printed on the app’s screen. # Streamlit input for question     question = st.text_input(“Ask a question about the document:”)     if question:         # Answer         response = chain.invoke({“input”: question})[‘answer’]         st.write(response) Here is a screenshot of the result. Screenshot of the final app. Image by the author. And this is a GIF for you to see the File Reader Ai Assistant in action! File Reader AI Assistant in action. Image by the author. Before you go In this project, we learned what the RAG framework is and how it helps the Llm to perform better and also perform well with specific knowledge. AI can be powered with knowledge from an instruction manual, databases from a company, some finance files, or contracts, and then become fine-tuned to respond accurately to domain-specific content queries. The knowledge base is augmented with a content store. To recap, this is how the framework works: 1️⃣ User Query → Input text is received. 2️⃣ Retrieve Relevant Documents → Searches a knowledge base (e.g., a database, vector store). 3️⃣ Augment Context → Retrieved documents are added to the input. 4️⃣ Generate Response → An LLM processes the combined input and produces an answer. GitHub repository https://github.com/gurezende/Basic-Rag About me If you liked this content and want to learn more about my work, here is my website, where you can also find all my contacts. https://gustavorsantos.me References https://cloud.google.com/use-cases/retrieval-augmented-generation https://www.ibm.com/think/topics/retrieval-augmented-generation https://python.langchain.com/docs/introduction https://www.geeksforgeeks.org/how-to-get-your-own-openai-api-key

Introduction

AI is everywhere. 

It is hard not to interact at least once a day with a Large Language Model (LLM). The chatbots are here to stay. They’re in your apps, they help you write better, they compose emails, they read emails…well, they do a lot.

And I don’t think that that is bad. In fact, my opinion is the other way – at least so far. I defend and advocate for the use of AI in our daily lives because, let’s agree, it makes everything much easier.

I don’t have to spend time double-reading a document to find punctuation problems or type. AI does that for me. I don’t waste time writing that follow-up email every single Monday. AI does that for me. I don’t need to read a huge and boring contract when I have an AI to summarize the main takeaways and action points to me!

These are only some of AI’s great uses. If you’d like to know more use cases of LLMs to make our lives easier, I wrote a whole book about them.

Now, thinking as a data scientist and looking at the technical side, not everything is that bright and shiny. 

LLMs are great for several general use cases that apply to anyone or any company. For example, coding, summarizing, or answering questions about general content created until the training cutoff date. However, when it comes to specific business applications, for a single purpose, or something new that didn’t make the cutoff date, that is when the models won’t be that useful if used out-of-the-box – meaning, they will not know the answer. Thus, it will need adjustments.

Training an LLM model can take months and millions of dollars. What is even worse is that if we don’t adjust and tune the model to our purpose, there will be unsatisfactory results or hallucinations (when the model’s response doesn’t make sense given our query).

So what is the solution, then? Spending a lot of money retraining the model to include our data?

Not really. That’s when the Retrieval-Augmented Generation (RAG) becomes useful.

RAG is a framework that combines getting information from an external knowledge base with large language models (LLMs). It helps AI models produce more accurate and relevant responses.

Let’s learn more about RAG next.

What is RAG?

Let me tell you a story to illustrate the concept.

I love movies. For some time in the past, I knew which movies were competing for the best movie category at the Oscars or the best actors and actresses. And I would certainly know which ones got the statue for that year. But now I am all rusty on that subject. If you asked me who was competing, I would not know. And even if I tried to answer you, I would give you a weak response. 

So, to provide you with a quality response, I will do what everybody else does: search for the information online, obtain it, and then give it to you. What I just did is the same idea as the RAG: I obtained data from an external database to give you an answer.

When we enhance the LLM with a content store where it can go and retrieve data to augment (increase) its knowledge base, that is the RAG framework in action.

RAG is like creating a content store where the model can enhance its knowledge and respond more accurately.

Diagram: User prompts and content using LLM + RAG
User prompt about Content C. LLM retrieves external content to aggregate to the answer. Image by the author.

Summarizing:

  1. Uses search algorithms to query external data sources, such as databases, knowledge bases, and web pages.
  2. Pre-processes the retrieved information.
  3. Incorporates the pre-processed information into the LLM.

Why use RAG?

Now that we know what the RAG framework is let’s understand why we should be using it.

Here are some of the benefits:

  • Enhances factual accuracy by referencing real data.
  • RAG can help LLMs process and consolidate knowledge to create more relevant answers 
  • RAG can help LLMs access additional knowledge bases, such as internal organizational data 
  • RAG can help LLMs create more accurate domain-specific content 
  • RAG can help reduce knowledge gaps and AI hallucination

As previously explained, I like to say that with the RAG framework, we are giving an internal search engine for the content we want it to add to the knowledge base.

Well. All of that is very interesting. But let’s see an application of RAG. We will learn how to create an AI-powered PDF Reader Assistant.

Project

This is an application that allows users to upload a PDF document and ask questions about its content using AI-powered natural language processing (NLP) tools. 

  • The app uses Streamlit as the front end.
  • Langchain, OpenAI’s GPT-4 model, and FAISS (Facebook AI Similarity Search) for document retrieval and question answering in the backend.

Let’s break down the steps for better understanding:

  1. Loading a PDF file and splitting it into chunks of text.
    1. This makes the data optimized for retrieval
  2. Present the chunks to an embedding tool.
    1. Embeddings are numerical vector representations of data used to capture relationships, similarities, and meanings in a way that machines can understand. They are widely used in Natural Language Processing (NLP), recommender systems, and search engines.
  3. Next, we put those chunks of text and embeddings in the same DB for retrieval.
  4. Finally, we make it available to the LLM.

Data preparation

Preparing a content store for the LLM will take some steps, as we just saw. So, let’s start by creating a function that can load a file and split it into text chunks for efficient retrieval.

# Imports
from  langchain_community.document_loaders import PyPDFLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter

def load_document(pdf):
    # Load a PDF
    """
    Load a PDF and split it into chunks for efficient retrieval.

    :param pdf: PDF file to load
    :return: List of chunks of text
    """

    loader = PyPDFLoader(pdf)
    docs = loader.load()

    # Instantiate Text Splitter with Chunk Size of 500 words and Overlap of 100 words so that context is not lost
    text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=100)
    # Split into chunks for efficient retrieval
    chunks = text_splitter.split_documents(docs)

    # Return
    return chunks

Next, we will start building our Streamlit app, and we’ll use that function in the next script.

Web application

We will begin importing the necessary modules in Python. Most of those will come from the langchain packages.

FAISS is used for document retrieval; OpenAIEmbeddings transforms the text chunks into numerical scores for better similarity calculation by the LLM; ChatOpenAI is what enables us to interact with the OpenAI API; create_retrieval_chain is what actually the RAG does, retrieving and augmenting the LLM with that data; create_stuff_documents_chain glues the model and the ChatPromptTemplate.

Note: You will need to generate an OpenAI Key to be able to run this script. If it’s the first time you’re creating your account, you get some free credits. But if you have it for some time, it is possible that you will have to add 5 dollars in credits to be able to access OpenAI’s API. An option is using Hugging Face’s Embedding. 

# Imports
from langchain_community.vectorstores import FAISS
from langchain_openai import OpenAIEmbeddings
from langchain.chains import create_retrieval_chain
from langchain_openai import ChatOpenAI
from langchain.chains.combine_documents import create_stuff_documents_chain
from langchain_core.prompts import ChatPromptTemplate
from scripts.secret import OPENAI_KEY
from scripts.document_loader import load_document
import streamlit as st

This first code snippet will create the App title, create a box for file upload, and prepare the file to be added to the load_document() function.

# Create a Streamlit app
st.title("AI-Powered Document Q&A")

# Load document to streamlit
uploaded_file = st.file_uploader("Upload a PDF file", type="pdf")

# If a file is uploaded, create the TextSplitter and vector database
if uploaded_file :

    # Code to work around document loader from Streamlit and make it readable by langchain
    temp_file = "./temp.pdf"
    with open(temp_file, "wb") as file:
        file.write(uploaded_file.getvalue())
        file_name = uploaded_file.name

    # Load document and split it into chunks for efficient retrieval.
    chunks = load_document(temp_file)

    # Message user that document is being processed with time emoji
    st.write("Processing document... :watch:")

Machines understand numbers better than text, so in the end, we will have to provide the model with a database of numbers that it can compare and check for similarity when performing a query. That’s where the embeddings will be useful to create the vector_db, in this next piece of code.

# Generate embeddings
    # Embeddings are numerical vector representations of data, typically used to capture relationships, similarities,
    # and meanings in a way that machines can understand. They are widely used in Natural Language Processing (NLP),
    # recommender systems, and search engines.
    embeddings = OpenAIEmbeddings(openai_api_key=OPENAI_KEY,
                                  model="text-embedding-ada-002")

    # Can also use HuggingFaceEmbeddings
    # from langchain_huggingface.embeddings import HuggingFaceEmbeddings
    # embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")

    # Create vector database containing chunks and embeddings
    vector_db = FAISS.from_documents(chunks, embeddings)

Next, we create a retriever object to navigate in the vector_db.

# Create a document retriever
    retriever = vector_db.as_retriever()
    llm = ChatOpenAI(model_name="gpt-4o-mini", openai_api_key=OPENAI_KEY)

Then, we will create the system_prompt, which is a set of instructions to the LLM on how to answer, and we will create a prompt template, preparing it to be added to the model once we get the input from the user.

# Create a system prompt
    # It sets the overall context for the model.
    # It influences tone, style, and focus before user interaction starts.
    # Unlike user inputs, a system prompt is not visible to the end user.

    system_prompt = (
        "You are a helpful assistant. Use the given context to answer the question."
        "If you don't know the answer, say you don't know. "
        "{context}"
    )

    # Create a prompt Template
    prompt = ChatPromptTemplate.from_messages(
        [
            ("system", system_prompt),
            ("human", "{input}"),
        ]
    )

    # Create a chain
    # It creates a StuffDocumentsChain, which takes multiple documents (text data) and "stuffs" them together before passing them to the LLM for processing.

    question_answer_chain = create_stuff_documents_chain(llm, prompt)

Moving on, we create the core of the RAG framework, pasting together the retriever object and the prompt. This object adds relevant documents from a data source (e.g., a vector database) and makes it ready to be processed using an LLM to generate a response.

# Creates the RAG
     chain = create_retrieval_chain(retriever, question_answer_chain)

Finally, we create the variable question for the user input. If this question box is filled with a query, we pass it to the chain, which calls the LLM to process and return the response, which will be printed on the app’s screen.

# Streamlit input for question
    question = st.text_input("Ask a question about the document:")
    if question:
        # Answer
        response = chain.invoke({"input": question})['answer']
        st.write(response)

Here is a screenshot of the result.

Screenshot of the AI-Powered Document Q&A
Screenshot of the final app. Image by the author.

And this is a GIF for you to see the File Reader Ai Assistant in action!

GIF of the File Reader AI Assistant in action
File Reader AI Assistant in action. Image by the author.

Before you go

In this project, we learned what the RAG framework is and how it helps the Llm to perform better and also perform well with specific knowledge.

AI can be powered with knowledge from an instruction manual, databases from a company, some finance files, or contracts, and then become fine-tuned to respond accurately to domain-specific content queries. The knowledge base is augmented with a content store.

To recap, this is how the framework works:

1️⃣ User Query → Input text is received.

2️⃣ Retrieve Relevant Documents → Searches a knowledge base (e.g., a database, vector store).

3️⃣ Augment Context → Retrieved documents are added to the input.

4️⃣ Generate Response → An LLM processes the combined input and produces an answer.

GitHub repository

https://github.com/gurezende/Basic-Rag

About me

If you liked this content and want to learn more about my work, here is my website, where you can also find all my contacts.

https://gustavorsantos.me

References

https://cloud.google.com/use-cases/retrieval-augmented-generation

https://www.ibm.com/think/topics/retrieval-augmented-generation

https://youtu.be/T-D1OfcDW1M?si=G0UWfH5-wZnMu0nw

https://python.langchain.com/docs/introduction

https://www.geeksforgeeks.org/how-to-get-your-own-openai-api-key

Shape
Shape
Stay Ahead

Explore More Insights

Stay ahead with more perspectives on cutting-edge power, infrastructure, energy,  bitcoin and AI solutions. Explore these articles to uncover strategies and insights shaping the future of industries.

Shape

SolarWinds launches Avior AI agents to automate network operations

The first Avior offering is a network engineering agent that can automate alert management, configuration automation, compliance checks, and incident remediation. “We started there because [the network is] kind of our bread and butter,” Childress explains. “Many of our customers, a large portion of our customers, are on our network

Read More »

Equinor plans tieback of Grimsnes discovery to Oseberg platform in North Sea

Equinor Energy AS made an oil and gas discovery in the Grimsnes prospect near Oseberg field in the North Sea about 15 km southwest of the Oseberg Sør (South) platform and 145 km west of Bergen in 96 m of water. Well 30/8-7 S, the fifth exploration well in production license (PL) 190, was drilled by the Deepsea Bergen semi-submersible drilling rig to a vertical depth of 3,752 m subsea. It was terminated in the Drake formation in the Lower Jurassic, the Norwegian Offshore Directorate reported. The primary exploration target was to prove petroleum in Middle Jurassic reservoir rocks in the Tarbert formation. The secondary target was to prove petroleum in Middle Jurassic rocks in the Ness and Etive formations. The well encountered a combined oil and gas column totaling 54 m (39-m gas column, 15-m oil column) in the Tarbert formation. The total thickness of the Tarbert formation was 264 m, 111 m of which were sandstone with moderate to good reservoir properties. In the secondary exploration target in the Ness formation, the well encountered a sandstone layer totaling 289 m with variable reservoir quality from poor to very good. The reservoir was aquiferous with a few potential hydrocarbon-filled zones. In the Etive formation, the well encountered aquiferous sandstones totaling 10 m, with moderate reservoir quality. The preliminary volume estimate of the discovery is 19-50 MMboe (3-8 million std cu m). Data has been collected and samples have been taken. The well has been permanently plugged, and the Deepsea Bergen rig will now proceed to Visund Sør field to drill a development well. Equinor plans to quickly tie the discovery back to existing subsea infrastructure and produce the volumes through the Oseberg Sør platform. Grimsnes will most likely be developed with 2-3 wells in a standard 4-slot template. The discovery

Read More »

DOE Alternative Fuels and Feedstocks Office Announces Intent to Award Up to $60 Million for Innovative Chemical, Fuel, and Fertilizer Technologies

WASHINGTON—The U.S. Department of Energy’s (DOE) Alternative Fuels and Feedstocks Office (AFFO) today announced its intent to award up to $60 million to expand domestic energy production and distribution through novel, high-impact chemicals, fertilizers, fuels, and feedstock technologies. The funding opportunity is in accordance with President Trump’s Executive Order, Unleashing American Energy, which calls for expanding domestic supply chains and the production of American energy to lower prices for hardworking Americans, including farmers, ranchers, and small businesses. “President Trump’s administration is strengthening America’s agricultural and energy sectors – both critical backbones of our prosperity and security – enabling our energy independence and benefiting all hardworking American families,” said Assistant Secretary Audrey Robertson. “Under President Trump’s and Energy Secretary Chris Wright’s leadership, we are empowering farmers, ranchers, and energy producers to lower prices, unleash American-made energy dominance, build a strong multi-generational workforce, and ensure the long-term prosperity and success for our great country.” DOE will seek research, development and scale-up projects that harness existing biomass, hydrogen, and pipeline resources to expand domestic energy production, distribution, and fertilizer technologies. AFFO expects to issue a notice of funding opportunity (NOFO) in November 2026, addressing the following topic areas: Topic Area 1: Biointermediate Depots – Enhance the production of liquid intermediate-products that are made from biomass and establish pilot sites to produce traditional intermediate products such as high impact chemicals, sugars, bio-crudes, or bio-oils, from biomass and wastes.  Topic Area 2: Refinery Integration – Advance the production of commodity chemicals and fuels from alternative feedstocks using existing refinery assets and achieving production-costs that enable competitive market pricing.  Topic Area 3: Pilot Site for Hydrogen/Natural Gas Blending – Establish pilot sites for hydrogen and natural gas blending and the distribution/utilization of those blends to improve the reliability, scalability, suitability, performance and durability of distribution networks.

Read More »

Energy Department Releases Emissions Value Request Process for 45Z Fuel Production Credit

WASHINGTON—The U.S. Department of Energy (DOE) Alternative Fuels and Feedstocks Office (AFFO) released a pre-publication draft of a federal register notice announcing the Emissions Value Request (EVR) process for the 45Z fuel production tax credit. Modified and extended under the Working Families Tax Cut, the Clean Fuel Production Tax Credit (Internal Revenue Code Section 45Z) provides a production incentive for certain feedstocks produced in the United States, Mexico, or Canada. “Thanks to President Trump’s Working Families Tax Cut, we are creating new opportunities for American farmers and fuel producers to strengthen domestic energy production, reduce costs, and unleash American energy dominance,” said Assistant Secretary of Energy Audrey Robertson. “Through the Department of Energy’s new 45Z Emissions Value Request process, we are expanding opportunities for American fuel producers to access critical tax incentives, supporting rural economies, and bringing more American-made fuels to market. In short: putting American energy first.” Transportation fuel producers seeking to claim the tax credit must obtain the life cycle greenhouse gas emissions rate of their transportation fuel using the applicable rate table for Section 45Z. If the fuel’s type, primary feedstock, or pathway is not included in the rate table, fuel producers must petition the Secretary of Treasury for a provisional emission rate (PER). The 45Z EVR process is the route through which fuel producers can obtain a rate value from DOE and petition U.S. Treasury for a PER. To request an emissions value from DOE, stakeholders must follow the EVR Application Instructions to submit the following requested materials: Engineering information/analyses consistent with the specified section of the front-end engineering and design (FEED) study or similar indication of project maturity, as determined by DOE. A completed EVR form. In addition to the required documents, an applicant also has the option to include additional information that may be

Read More »

IEA: Oil supply rebound remains fragile; diesel tightness persists

Supply recovery at risk Global oil supply increased by 2.5 million b/d month over month to 102.3 million b/d in September. OPEC+ accounted for 2.1 million b/d of the increase, led by Saudi Arabia. Renewed attacks on tankers and energy infrastructure threaten further gains, IEA warned. Despite September’s rebound, global supply is forecast to decline by 5.8 million b/d to 100.7 million b/d this year, before rising by 7.7 million b/d in 2027. Next year’s recovery remains contingent on sustained improvements in Hormuz flows. “Crude oil exports from Gulf producers, led by Saudi Arabia, surged by 4.4 million b/d to 13.9 million b/d in September, reaching over 75% of pre-war levels as supply recovered strongly and inventories were drawn down. Robust Gulf of Oman ship-to-ship transfers helped lift total oil flows through the Strait of Hormuz by 3.7 million b/d to 10.9 million b/d, while the swift return of East-West pipeline flows increased overall bypass exports by 970,000 b/d to 5.6 million b/d. The strong rebound raised estimated global supply for third-quarter 2026 by 190,000 b/d compared with last month’s Report. However, due to heightened security concerns amid increased Houthi attacks in the region in October, we have left the projections for the remainder of the year largely unchanged,” IEA said. North Sea Dated averaged $116.89/bbl in September, up $26.17/bbl from August. Diesel, inventories under pressure Global diesel exports in September were nearly 700,000 b/d below year-earlier levels, as increased shipments from other suppliers only partly offset losses from Russia and the Middle East. IEA expects diesel market tightness to extend well into 2027. “Refined product and LPG shipments from the Middle East have risen much more slowly than crude oil flows and remain below half of their pre-war levels. Refined products rose by 210,000 b/d to 1.9 million b/d

Read More »

Energy Department Awards $49.8 Million to Advance Methane Hydrate Production Research on Alaska North Slope

WASHINGTON — The U.S. Department of Energy’s (DOE) Hydrocarbons and Geothermal Energy Office (HGEO) today announced a five-year contract valued at up to $49.8 million awarded to ASRC Consulting and Environmental Services, LLC (ACES), a subsidiary of Arctic Slope Regional Corporation Energy Services Alaska, Inc. (AES). The contract will advance research and production testing of methane hydrates, a potential source of natural gas found in subsurface formations on Alaska’s North Slope.  The award supports President Trump’s goal of unleashing American energy and U.S. Energy Secretary Chris Wright’s focus on advancing energy addition and American innovation by building the scientific and engineering knowledge needed to evaluate methane hydrates as a potential future domestic energy resource. The work will build on technical insights from prior production testing while maintaining a unique research site in the Prudhoe Bay Unit for potential follow-on operations.  “President Trump has made clear that America should use its extraordinary energy resources and innovation to strengthen our energy security and global leadership,” said DOE Acting Assistant Secretary of the Hydrocarbons and Geothermal Energy Office Curt Coccodrilli. “This investment will help build on years of field research in Alaska to move methane hydrate research from scientific discovery toward the real-world testing needed to determine its commercial production potential.”  Gas hydrates are naturally occurring, ice-like crystalline solids that hold vast quantities of natural gas beneath the permafrost and offshore. Unlocking these resources represents a vital component of the United States’ long-term energy strategy to secure abundant domestic supplies. Alaska’s North Slope research site provides a unique setting for long-duration field research because hydrate-bearing reservoirs can be studied using established infrastructure and continuously monitored wells.  The project will proceed in two phases. Phase 1 will maintain the existing research site and supporting equipment and develop detailed plans for a potential follow-on production test. Should

Read More »

HPCL taps Technip Energies for EPC on new Mumbai refinery unit

Hindustan Petroleum Corp. Ltd. (HPCL) has awarded Technip Energies an engineering, procurement, and construction (EPC) contract for two major units in the lube modernization and bottoms upgradation (LMBU) project at its 9.5-million tonne/year (tpy) Mumbai refinery in Maharashtra, India. The work covers a 550,000-tpy integrated hydrocracker and catalytic dewaxing (IHCD) unit and an 850,000-tpy solvent deasphalting (SDA) unit. Both will be integrated into the operating refinery, Technip Energies said in a release Oct. 12. The new units aim to increase production of lube oil base stocks (LOBS) used in automotive engine oils and industrial lubricants, while upgrading heavier refinery streams into higher-value products, according to the service provider. While Technip Energies did not reveal the precise value of the contract, the company confirmed the order would amount to between €250-500 million of revenue. This latest EPC contract for the project’s IHCD and SDA units follows HPCL’s earlier award to Chevron Lummus Global for licensing of technologies to outfit the IHCD unit. Project overview HPCL’s LMBU project is designed to raise the Mumbai refinery’s output of LOBS to 764,000 tpy from 475,000 tpy, including production of Group II+ and Group III base stocks. The project is also expected to increase bitumen production by about 487,000 tpy through fuel oil upgrading, as well as improve the refinery’s yield of distillate by about 4%, HPCL said in a release Jan. 23, 2025. HPCL began work on the LMBU project during the third quarter of its 2025 fiscal year at an estimated project cost of 46.79 billion rupees (US$541.1 million). Scheduled to be fully completed in March 2028, the LMBU project had reached 9.9% physical completion as of Mar. 31, 2026, at a then-current project cost of 57.40 billion rupees (US$600.4 million), HPCL said in an investor presentation dated May 13, 2026.

Read More »

Virginia’s New Data Center Bargain: Power, Permits and the Right to Build

What Took Effect—and What Still Requires Legislation Spanberger laid out the administration’s rationale in announcing the framework: “In the years before I took office, data centers came to Virginia and the Commonwealth did not have a clear or coordinated plan to address their impacts on Virginians — on their electric bills, their water, their land, their air, or their quality of life. That changes today. I have said many times that Virginia should be leading the nation in setting the highest standards for this industry. And now, I believe we are doing just that.” The distinction between what Virginia has already implemented and what the administration intends to pursue is consequential. Executive Order 22 establishes immediate directives for state agencies, while significant portions of the broader Data Center Accountability Framework remain proposals for the 2027 General Assembly or future regulatory action. Among the immediate changes, executive-branch agencies are prohibited from entering into or enforcing new nondisclosure agreements that conceal material information about proposed commercial data centers, public incentives, resource demands or community impacts. Existing contractual commitments are preserved, with limited exceptions contemplated for extraordinary circumstances, including national security. The prohibition does not yet extend automatically to local governments. The order also excludes new data center projects with anticipated peak electrical demand of 25 MW or greater from the Virginia Business Ready Sites Program and similar discretionary state site-readiness and expedited-review assistance. A separate, potentially more consequential proposal would eliminate by-right development approval for data centers using more than 25 MW, requiring local approval even for projects with prior authorizations. That provision has not been enacted statewide and could introduce significant legal questions concerning established development rights. The administration is also accelerating environmental oversight. Within 120 days of the order, the Office of the Chief Energy Officer must publish an initial

Read More »

OCP 2026: Agentic AI Drives the Data Center’s Chip-to-Grid Transformation

NVIDIA Opens More of the AI Factory Architecture NVIDIA’s Ian Buck closed the opening keynote program with an extensive presentation covering Vera Rubin systems, open rack designs, networking, power delivery and AI factory software. The company announced additional contributions to OCP based on its third-generation MGX 1.2 reference architecture. The specification includes high-density liquid-cooled computing systems, improved cooling connections, standardized power interfaces and modular mechanical designs. Buck emphasized that these developments are as much about manufacturing and serviceability as they are about computational performance. He described how NVIDIA reduced the assembly time for a compute tray from approximately 90 minutes in the Grace Blackwell generation to roughly one minute for Vera Rubin through simplified mechanical construction and more automated assembly. At the scale of thousands of racks, those manufacturing improvements can materially influence deployment schedules. NVIDIA also previewed its next-generation Vera Rubin Ultra architecture, designed to interconnect 576 GPUs using an advanced NVLink fabric with co-packaged optics. Open Data Center and Grid Resilience Specifications For data center developers and operators, however, NVIDIA’s most consequential OCP contributions may lie outside the computing rack. NVIDIA, AMD, Google and Meta have published an Open Data Center Specification, currently at version 0.7, intended to establish common design principles for AI factory facilities. The specification addresses power architecture, cooling infrastructure and physical layout, helping equipment suppliers and developers coordinate around shared infrastructure requirements. That shared facilities work unfolds alongside vendor-specific programs such as NVIDIA’s DSX Ready, which establishes qualification requirements for battery energy storage and liquid cooling equipment supporting its AI factory designs. NVIDIA also joined Google, Meta and Microsoft in publishing an OCP Grid Resilience Specification addressing the behavior of large AI installations during grid disturbances. The specification establishes expectations for facilities to remain connected, respond automatically to disturbances and recover toward normal operating

Read More »

NetBox Labs adds network design templates and AI agents to streamline infrastructure operations

“This is infrastructure, and so if an agent does the wrong thing, it breaks the company,” Beevers said. NetBox Designs turns repeatable infrastructure into templates AI data centers are full of racks that are almost all identical in design. Teams do not want to lay out each one by hand. The same applies to a retail chain with small, medium, and large store formats, where the IT footprint needs to line up. NetBox Designs, now in public preview, targets that repetition. Designs work like “templatized Lego bricks for infrastructure,” Beevers said. A team defines a site, rack or IP plan once and sets its parameters. NetBox then renders the plan as many times as needed, down to the low-level components and their configuration. That includes assigning IP addresses, prefixes, and virtual LANs across a fabric. The goal is to speed design down to the component level, reduce manual error and compress time to market.

Read More »

AMD unveils Helion as agentic AI fuels demand for data center CPUs

AMD has introduced Helion, an open blueprint for data center racks that aims to give CPUs a larger role in running AI agents while allowing customers to configure GPU resources around their inference requirements. Based on Open Compute Project (OCP) specifications, the architecture supports different combinations of computing hardware. AMD cited examples including CPU-only racks for hyperscalers, powered by sixth-generation EPYC processors with up to 32,768 cores, and all-in-one enterprise racks accommodating up to 16 Instinct MI350P GPUs. AMD has listed networking bandwidth of up to 102 Tbps for Helion, although the company has not specified how that figure is calculated. The specification represents a planned rack capability rather than demonstrated performance in customer environments.

Read More »

Land & Expand: North America’s Data Center Pipeline Expands Under Pressure

Land & Expand is Data Center Frontier’s periodic look at the latest data center development news, including new sites, land acquisitions and campus expansions across North America. This latest installment finds the development pipeline continuing to expand, even as the requirements for bringing large-scale projects online grow more complicated. Developers are securing land, planning new power infrastructure and advancing campuses measured in hundreds of megawatts or more. At the same time, local governments and residents are demanding greater clarity on electricity costs, water consumption, noise, tax incentives and the long-term effects of industrial-scale computing facilities. A succession of development disclosures and project milestones through September and early October 2026 illustrates both the geographical reach of North America’s expanding data center pipeline and the growing difficulty of measuring how much proposed capacity will ultimately be delivered. The projects range from preliminary discussions and newly secured development sites to campuses already under construction. Some are advancing through formal permitting and power studies; others remain contingent on customers, financing or local approvals. Together, they reveal an industry still expanding aggressively, but operating under increasingly complex development conditions. Fluidstack: Cameron County, Texas — Up to 1.5 GW One of the largest newly disclosed projects is Fluidstack’s AI data center development in Cameron County in the Rio Grande Valley. The project surfaced publicly September 10 when Cameron County announced that it had issued Fluidstack a worksite permit for property near Harlingen. The permit authorizes preliminary site work, including grading, utilities and related infrastructure, rather than construction of the data center buildings themselves. Fluidstack subsequently disclosed considerably more detail on September 21, saying construction had begun on a $4 billion first phase capable of supporting as much as 1.5 GW. Fluidstack expects the project to generate more than 2,500 construction jobs and several hundred permanent positions. 

Read More »

DCF Global: Five Markets Redrawing the AI Infrastructure Map

The Global Constraint Is Execution These five markets demonstrate that the worldwide AI infrastructure buildout is no longer organized around a single development model. Spain is using permitting reform to attract investment. China is concentrating construction around energy resources. India is translating enormous capital commitments into an expanding development pipeline. Latin America is combining hyperscale growth with national industrial objectives. And Southeast Asia is creating interconnected infrastructure markets whose boundaries increasingly extend beyond individual cities and countries. Not every market is competing for the same business. Sovereign cloud services, enterprise applications, AI training clusters, and large-scale inference platforms carry different requirements involving power, connectivity, latency, data residency, and operating economics. But the infrastructure questions remain remarkably consistent. Can a project obtain enough electricity? Can transmission and supporting networks be delivered on schedule? Will the supply chain provide the required equipment? Can the facility be constructed and commissioned efficiently? And will the development retain the regulatory certainty and community acceptance required to operate for decades? The gap between announced development and actual capacity is becoming a defining measurement of the industry. Cushman & Wakefield estimates that Asia-Pacific alone had approximately 26.5 GW of data center capacity in its development pipeline during H1 2026. Of that total, roughly 4.8 GW was under construction, with another 21.7 GW in planning. Those figures reveal both the extraordinary scale of the opportunity and the considerable infrastructure work still required to realize it. What the Global Buildout Means for North America For U.S. data center operators, developers, engineering firms, equipment suppliers, and investors, international expansion is not a separate story. It is increasingly part of the same global competition for capital, equipment, power infrastructure, and specialized expertise. The transformers, switchgear, generators, advanced cooling systems, fiber networks, and electrical distribution equipment required by a major AI campus

Read More »

Microsoft will invest $80B in AI data centers in fiscal 2025

And Microsoft isn’t the only one that is ramping up its investments into AI-enabled data centers. Rival cloud service providers are all investing in either upgrading or opening new data centers to capture a larger chunk of business from developers and users of large language models (LLMs).  In a report published in October 2024, Bloomberg Intelligence estimated that demand for generative AI would push Microsoft, AWS, Google, Oracle, Meta, and Apple would between them devote $200 billion to capex in 2025, up from $110 billion in 2023. Microsoft is one of the biggest spenders, followed closely by Google and AWS, Bloomberg Intelligence said. Its estimate of Microsoft’s capital spending on AI, at $62.4 billion for calendar 2025, is lower than Smith’s claim that the company will invest $80 billion in the fiscal year to June 30, 2025. Both figures, though, are way higher than Microsoft’s 2020 capital expenditure of “just” $17.6 billion. The majority of the increased spending is tied to cloud services and the expansion of AI infrastructure needed to provide compute capacity for OpenAI workloads. Separately, last October Amazon CEO Andy Jassy said his company planned total capex spend of $75 billion in 2024 and even more in 2025, with much of it going to AWS, its cloud computing division.

Read More »

John Deere unveils more autonomous farm machines to address skill labor shortage

Join our daily and weekly newsletters for the latest updates and exclusive content on industry-leading AI coverage. Learn More Self-driving tractors might be the path to self-driving cars. John Deere has revealed a new line of autonomous machines and tech across agriculture, construction and commercial landscaping. The Moline, Illinois-based John Deere has been in business for 187 years, yet it’s been a regular as a non-tech company showing off technology at the big tech trade show in Las Vegas and is back at CES 2025 with more autonomous tractors and other vehicles. This is not something we usually cover, but John Deere has a lot of data that is interesting in the big picture of tech. The message from the company is that there aren’t enough skilled farm laborers to do the work that its customers need. It’s been a challenge for most of the last two decades, said Jahmy Hindman, CTO at John Deere, in a briefing. Much of the tech will come this fall and after that. He noted that the average farmer in the U.S. is over 58 and works 12 to 18 hours a day to grow food for us. And he said the American Farm Bureau Federation estimates there are roughly 2.4 million farm jobs that need to be filled annually; and the agricultural work force continues to shrink. (This is my hint to the anti-immigration crowd). John Deere’s autonomous 9RX Tractor. Farmers can oversee it using an app. While each of these industries experiences their own set of challenges, a commonality across all is skilled labor availability. In construction, about 80% percent of contractors struggle to find skilled labor. And in commercial landscaping, 86% of landscaping business owners can’t find labor to fill open positions, he said. “They have to figure out how to do

Read More »

2025 playbook for enterprise AI success, from agents to evals

Join our daily and weekly newsletters for the latest updates and exclusive content on industry-leading AI coverage. Learn More 2025 is poised to be a pivotal year for enterprise AI. The past year has seen rapid innovation, and this year will see the same. This has made it more critical than ever to revisit your AI strategy to stay competitive and create value for your customers. From scaling AI agents to optimizing costs, here are the five critical areas enterprises should prioritize for their AI strategy this year. 1. Agents: the next generation of automation AI agents are no longer theoretical. In 2025, they’re indispensable tools for enterprises looking to streamline operations and enhance customer interactions. Unlike traditional software, agents powered by large language models (LLMs) can make nuanced decisions, navigate complex multi-step tasks, and integrate seamlessly with tools and APIs. At the start of 2024, agents were not ready for prime time, making frustrating mistakes like hallucinating URLs. They started getting better as frontier large language models themselves improved. “Let me put it this way,” said Sam Witteveen, cofounder of Red Dragon, a company that develops agents for companies, and that recently reviewed the 48 agents it built last year. “Interestingly, the ones that we built at the start of the year, a lot of those worked way better at the end of the year just because the models got better.” Witteveen shared this in the video podcast we filmed to discuss these five big trends in detail. Models are getting better and hallucinating less, and they’re also being trained to do agentic tasks. Another feature that the model providers are researching is a way to use the LLM as a judge, and as models get cheaper (something we’ll cover below), companies can use three or more models to

Read More »

OpenAI’s red teaming innovations define new essentials for security leaders in the AI era

Join our daily and weekly newsletters for the latest updates and exclusive content on industry-leading AI coverage. Learn More OpenAI has taken a more aggressive approach to red teaming than its AI competitors, demonstrating its security teams’ advanced capabilities in two areas: multi-step reinforcement and external red teaming. OpenAI recently released two papers that set a new competitive standard for improving the quality, reliability and safety of AI models in these two techniques and more. The first paper, “OpenAI’s Approach to External Red Teaming for AI Models and Systems,” reports that specialized teams outside the company have proven effective in uncovering vulnerabilities that might otherwise have made it into a released model because in-house testing techniques may have missed them. In the second paper, “Diverse and Effective Red Teaming with Auto-Generated Rewards and Multi-Step Reinforcement Learning,” OpenAI introduces an automated framework that relies on iterative reinforcement learning to generate a broad spectrum of novel, wide-ranging attacks. Going all-in on red teaming pays practical, competitive dividends It’s encouraging to see competitive intensity in red teaming growing among AI companies. When Anthropic released its AI red team guidelines in June of last year, it joined AI providers including Google, Microsoft, Nvidia, OpenAI, and even the U.S.’s National Institute of Standards and Technology (NIST), which all had released red teaming frameworks. Investing heavily in red teaming yields tangible benefits for security leaders in any organization. OpenAI’s paper on external red teaming provides a detailed analysis of how the company strives to create specialized external teams that include cybersecurity and subject matter experts. The goal is to see if knowledgeable external teams can defeat models’ security perimeters and find gaps in their security, biases and controls that prompt-based testing couldn’t find. What makes OpenAI’s recent papers noteworthy is how well they define using human-in-the-middle

Read More »