The Anatomy of a GenAI System - Part 4
Eric Famanas
~7 min read

A Recap From Part 3
The User Story
To avoid any potential NDA breaches of contract or discussing anything that may be potentially sensitive IP, I am going to describe a use case that may or may not have been inspired by my experiences:
As a User, I would like to summarise the end user legal agreement (EULA) of an online music streaming service that I use so that I may understand the scope and limitations of the vendor's defined responses with respect to my activities on their platform.
There is a lot to unpack from this user story, and it's actually something that we encounter on a regular basis; there are very few of us that take the time to read the EULA of these services, and even fewer that understand, in plain speech, what kind of legal reach the document they have. As part of this user story, we can focus on one use case:
The user would like an interface to ask a question around their activity on the music streaming service and receive a response on which clauses in the EULA may have that information
This use case is actually something that Tim Pullan had spoken about during one of his talks I attended. However, it's a bit more simplified in that the system is asked to parse the user's question and only return the relevant clauses in the EULA. Tim's work goes further still into providing a plain-speech interpretation of what those clauses are.
A good technical product manager will be able to use these examples of a user story and a use case to design a high-level solution diagram from which the company's software architects, outstanding people like Hemal Varambhia and Shrenik Patel, will be able to work from. The below is an example of such a use case diagram:

An example use case diagram for a user using an AI chat bot
I hope the diagram seems straightforward, and there are some named services within the system that stand out, particularly around the analysis engine and the usage of LLM's. It's also illustrated that the system is also interacting with an external "AI system"; this would be something similar to ChatGPT, Llamas, DeepSeek, etc. To some, this may come as a surprise, especially given an advisory in an earlier post regarding "thin LLM clients".
Given the technological complexity, there should not be an expectation of creating a GenAI system that uses LLM's entirely from scratch; it took OpenAI years to get ChatGPT to where it is today. Instead, vendors and project managers should look to these services as foundational, and fine tuning against the LLM or using more refined Generative Pre-trained Transformers (GPT) is preferred. There is a lot of this kind of fine tuning and customer work available on Hugging Face. A future mini-series I have planned will also go into detail on how to compose a fine-tuned GPT founded on ChatGPT as well, so there is a wealth of resources available on how to approach this challenge.
Going back to the proposed solution, as a "thin client", I would regard this application to be acceptable, since it will have its own ETL and refinement process independent of a specific GenAI system, as we will soon see.
The ETL Pipeline with Storage
When we look at complex systems architecture, as Conrad Braam reminded me when I was just an intern at Citrix, the overall design, whether its just a small program or something large like XenServer, should be composable and testable, meaning we should be able to take any component of the system and be able to test it by itself, or swap out parts with mock services and it will still function the same way.
To enable the fine-tuning of the external AI model that we plan to use to support our use case, an ETL pipeline still needs to exist for us to ingest and reference data used in enabling this effort. Spoiler alert: another diagram incoming ^_^.

High-level extraction and transformation steps of a GenAI ETL pipeline
I created this diagram based on the many, many user story mapping sessions I attended with Kannan Ganesan, Andy Rogers and Maleen Nishigaki. Their expertise in industry has taught me a lot during the time we worked together. But I digress... let's first slow down for a bit and pick apart this diagram for maximum knowledge absorption.
The Extraction Step
At the very start of the data extraction phase, there are two data sources specified: user feedback training data (surveys, free form text, interviews) and digital legal documents that are accessible from public domain. I emphasise this point as a future proofing exercise to help keep the software aligned with current and upcoming legislation around data such as those being put in place by the EU and UK. These two separate sources are handled through individual extraction points.
There is a point where we will have data that is numerical, like a survey, and free form text (everything else). Numerical, or already-quantised data, does not need to go through data cleaning for malicious code, so we can skip this step. However, all data gets referenced using a method similar to that mentioned in Part 2.
Lastly, everything gets lumped into the unstructured data store; as noted before, this can be any kind of database technology that fits within the company's budget and system's architecture, so long as your own software engineers, test engineers and DevSecOps group are capable of managing it.
Of note, on the far right there is a global application logger that sits on top of everything with its own, SQL database put off to the side. This implementation helps to ensure compliance with ISO-9001, ISO-27001 and ISO-42001 by having data traceability for auditing.
The Transformation Step
As expected, this step is a bit more complicated given that it will be specific to the industry or domain the application is set in as well as the business logic of both the organisation and system. However, by using techniques described in How to Measure Anything, we can generalise these concepts into high-level components. Some forewarning: as we mentioned in the previous article, there will be some custom GPT and ML work that will need to be done to properly group and structure the data we are receiving from the different sources.
The very first stop in our data tour is the "fine-tuned GPT"; this is an LLM process that can uses any available GPT (it doesn't have to be specific to ChatGPT for example, the LLM interface can be wrapped and generalised using an Adapter pattern). The tuning of the GPT is done using a grammatical language ruleset and domain-specific input provided by the Product Manager and discovered through a Domain Driven Design process. The purpose of this step is to group data into categories or classifications to allow for batch processing; these groups should be defined on how the product manager envisions the downstream output should be.
In the next step, the data is formatted and normalised using the contractural database schema as decided by the system architects; it is important this contract remains stable and changed as little as possible, as it forms the foundation blueprint of our "software house" discussed previously in Part 2.

So close ChatGPT! I will be sure to share my "Database Diagma" with the world
Lastly, there is an internally-developed machine learning process which is used to create relationship scores between the data groups or categories discussed. This enables the entire LLM that will be used to more precisely traverse the data given a user prompt. The idea of keeping the relationship to a simple numerical value like a relationship score also enables the use of either a Vector or Graph structure, or even both, just as we discussed in the previous article. The most important part is the score value generation between the categories and individual data elements.
This process cannot be static as the program needs to adjust to changes in data like new user inputs or new laws around EULA coming into effect. But it also doesn't have to be heavily complex like using a GNN with thousands of layers within its neural network. Since we are producing a numerical score, a "simple" linear regression approach can be used. By keeping it simple, it also means its transparent (another AI legislation proposal) and testable.
After all the data is formatted and normalised, and appropriate contextual metadata is applied, we are now ready to throw everything into our stage 2 data storage solution of choice.... or should we?
Coming up next
This is where things start to get really fun with the last step in our data ingestion pipeline: the Load aspect. Timely enough, and as mentioned before, the load aspect of an ETL with a system, inclusive of a GenAI system, is specific to the challenges of the user story or the business logic it is trying to address. Like any step within the ETL pipeline, it is impossible to create a solution that will be able to address all scenarios. Instead, in the next article, we will discuss different data loading solutions by comparing monolithic and micro-service architectures that may be used within the application. I hope to see you then!