Noodling About - Experiments, Writing & More

Experimenting with GenAI, LLMs & RAG - Part 1: Building a RAG Application

Summary of annual report

Introduction

After experimenting with Google GenAI/Vertex and having a frustrating experience, I wanted to try to tackle something more simple and hopefully something useful & practical. My previous employer, Ocado Group, is publicly seeking to reach a "cashflow positive" situation and this made me curious:

Leaving the obvious scope creep behind and returning to the idea of something simple - 😸 - first set of questions - could one get an LLM to give an accurate analysis of a company account, and explain why it gave that analysis?

Working With and Around LLMs and their Limitations:

So LLM's have three significant issues:

Is it possible to work around these limitations? If it is, is the effort required worth it - i.e. do you have to expend such effort (and money) to constrain and focus LLMs that for whatever reason - e.g. financial or risk - that it's not worth it?

Which Takes Us to "Retrieval-Augmented Generation (RAG)":

RAG, in essence is:

Thus, hopefully:

If you'd like a more detailed explanation of "Retrieval-Augmented Generation (RAG)", checkout this from Pinecone (a provider of an online vector database): Pinecone blog explaining RAG in detail

Small Tangent: What is a Vector Database?

Unlike normal databases that compare bits of text e.g. "is there a student name that begins with Chris"?, a vector database looks at the semantic meaning E.g. find me all chunks of content that are meaningfully related to Ocado's level of debt. It does this by:

Risks Associated with RAG:

So What Have I Built?

A small application that takes an organisations annual report (e.g. company account) and generates a short summary - see below:

Summary of annual report

And:

Q&A based on company accounts

Currently it contains:

Feel free to try it and ask questions! - see https://dnalorroland.pythonanywhere.com/ns/ftse?tab=qa

Tech / Nerdy Stuff

Built using:

So Does RAG Help When Working with LLMs?

That, and further discussion of LLMs, and more is all in Part Two: Experimenting with GenAI, LLMs & RAG - Part 2: When Are LLMs Useful?

Previous Post | Next Post