# databricks-industry-solutions/hls-llm-doc-qa architecture

> Architecture diagram of the GitHub repository databricks-industry-solutions/hls-llm-doc-qa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/databricks-industry-solutions/hls-llm-doc-qa
- Repository: https://github.com/databricks-industry-solutions/hls-llm-doc-qa

## Overview

This repository is a Databricks solution accelerator for biomedical question answering over custom document collections. Its main workflow prepares PDFs as chunked, embedded content in Vector Search, then retrieves relevant chunks to ground a LangChain answer from a served LLM. A separate work-in-progress notebook demonstrates registering and serving a custom Llama model. The sampled notebooks show the preparation and QA stages; the README describes the overall use case. Some preparation details and the WIP deployment flow are only partially excerpted, so uncertain connections are omitted.

Main entry points: [`03-LLM-Chain-with-FMAPI.py`](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/03-LLM-Chain-with-FMAPI.py) (Retrieval QA chain), [`02-Data-prep-with-LangChain.py`](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/02-Data-prep-with-LangChain.py) (PDF ingestion), [`[WIP] 04-Deploy-Llama-3-to-GPU-Serving.py`](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/%5BWIP%5D%2004-Deploy-Llama-3-to-GPU-Serving.py) (Model registry), [`util/create-update-serving-endpoint.py`](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/util/create-update-serving-endpoint.py) (Endpoint management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Document preparation"]
  node_ingestion["PDF ingestion"]
  node_chunking["Text chunking"]
  node_embedding["Text embeddings"]
end

subgraph group_qa["Question answering"]
  node_retriever["Vector retriever"]
  node_qa_chain["Retrieval QA chain"]
  node_prompt["Grounding prompt"]
end

subgraph group_model["Model deployment"]
  node_modeling["Llama model wrapper"]
  node_endpoint_setup["Endpoint management"]
end

subgraph group_platform["Databricks data and serving"]
  node_document_table[("Document table")]
  node_vector_index[("Vector index")]
  node_foundation_model["Foundation model"]
  node_registry[("Model registry")]
  node_serving_endpoint["Model serving endpoint"]
end

node_researcher(("Questioner"))
node_pdfs["PDF corpus"]

node_pdfs -->|"loads from"| node_ingestion
node_ingestion -->|"splits into"| node_chunking
node_chunking -->|"embeds chunks"| node_embedding
node_embedding -->|"writes documents"| node_document_table
node_document_table -->|"syncs index"| node_vector_index
node_researcher -->|"asks question"| node_qa_chain
node_qa_chain -->|"retrieves chunks"| node_retriever
node_retriever -->|"searches index"| node_vector_index
node_qa_chain -->|"formats context"| node_prompt
node_qa_chain -->|"invokes model"| node_foundation_model
node_modeling -->|"logs model"| node_registry
node_endpoint_setup -->|"creates or updates"| node_serving_endpoint
node_registry -.->|"deploys model"| node_serving_endpoint

click node_ingestion "https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/02-Data-prep-with-LangChain.py"
click node_chunking "https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/02-Data-prep-with-LangChain.py"
click node_embedding "https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/02-Data-prep-with-LangChain.py"
click node_document_table "https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/02-Data-prep-with-LangChain.py"
click node_vector_index "https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/02-Data-prep-with-LangChain.py"
click node_retriever "https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/03-LLM-Chain-with-FMAPI.py"
click node_qa_chain "https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/03-LLM-Chain-with-FMAPI.py"
click node_prompt "https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/03-LLM-Chain-with-FMAPI.py"
click node_foundation_model "https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/03-LLM-Chain-with-FMAPI.py"
click node_modeling "https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/%5BWIP%5D%2004-Deploy-Llama-3-to-GPU-Serving.py"
click node_registry "https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/%5BWIP%5D%2004-Deploy-Llama-3-to-GPU-Serving.py"
click node_endpoint_setup "https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/util/create-update-serving-endpoint.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ingestion,node_chunking,node_embedding toneBlue
class node_retriever,node_qa_chain,node_prompt toneAmber
class node_modeling,node_endpoint_setup toneMint
class node_document_table,node_vector_index,node_foundation_model,node_registry,node_serving_endpoint toneRose
class node_researcher,node_pdfs toneIndigo
```

## Components

### Document preparation

- [PDF ingestion](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/02-Data-prep-with-LangChain.py): `02-Data-prep-with-LangChain.py`
- [Text chunking](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/02-Data-prep-with-LangChain.py): `02-Data-prep-with-LangChain.py`
- [Text embeddings](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/02-Data-prep-with-LangChain.py): `02-Data-prep-with-LangChain.py`

### Question answering

- [Vector retriever](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/03-LLM-Chain-with-FMAPI.py): `03-LLM-Chain-with-FMAPI.py`
- [Retrieval QA chain](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/03-LLM-Chain-with-FMAPI.py): `03-LLM-Chain-with-FMAPI.py`
- [Grounding prompt](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/03-LLM-Chain-with-FMAPI.py): `03-LLM-Chain-with-FMAPI.py`

### Model deployment

- [Llama model wrapper](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/%5BWIP%5D%2004-Deploy-Llama-3-to-GPU-Serving.py): `[WIP] 04-Deploy-Llama-3-to-GPU-Serving.py`
- [Endpoint management](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/util/create-update-serving-endpoint.py): `util/create-update-serving-endpoint.py`

### Databricks data and serving

- [Document table](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/02-Data-prep-with-LangChain.py): `02-Data-prep-with-LangChain.py`
- [Vector index](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/02-Data-prep-with-LangChain.py): `02-Data-prep-with-LangChain.py`
- [Foundation model](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/03-LLM-Chain-with-FMAPI.py): `03-LLM-Chain-with-FMAPI.py`
- [Model registry](https://github.com/databricks-industry-solutions/hls-llm-doc-qa/blob/main/%5BWIP%5D%2004-Deploy-Llama-3-to-GPU-Serving.py): `[WIP] 04-Deploy-Llama-3-to-GPU-Serving.py`
- **Model serving endpoint**

### Other components

- **Questioner**
- **PDF corpus**

## Connections

- PDF corpus → PDF ingestion: loads from (evidence: `02-Data-prep-with-LangChain.py`)
- PDF ingestion → Text chunking: splits into (evidence: `02-Data-prep-with-LangChain.py`)
- Text chunking → Text embeddings: embeds chunks (evidence: `02-Data-prep-with-LangChain.py`)
- Text embeddings → Document table: writes documents (evidence: `02-Data-prep-with-LangChain.py`)
- Document table → Vector index: syncs index (evidence: `02-Data-prep-with-LangChain.py`)
- Questioner → Retrieval QA chain: asks question (evidence: `03-LLM-Chain-with-FMAPI.py`)
- Retrieval QA chain → Vector retriever: retrieves chunks (evidence: `03-LLM-Chain-with-FMAPI.py`)
- Vector retriever → Vector index: searches index (evidence: `03-LLM-Chain-with-FMAPI.py`)
- Retrieval QA chain → Grounding prompt: formats context (evidence: `03-LLM-Chain-with-FMAPI.py`)
- Retrieval QA chain → Foundation model: invokes model (evidence: `03-LLM-Chain-with-FMAPI.py`)
- Llama model wrapper → Model registry: logs model (evidence: `[WIP] 04-Deploy-Llama-3-to-GPU-Serving.py`)
- Endpoint management → Model serving endpoint: creates or updates (evidence: `util/create-update-serving-endpoint.py`)
- Model registry → Model serving endpoint: deploys model (evidence: `[WIP] 04-Deploy-Llama-3-to-GPU-Serving.py`)
