# Generative AI and LLMs

How large language models work and the retrieval, evaluation, safety and serving stack around them, in one map.

## Overview

Generative AI refers to models that create new content: text, code, images, audio and more. Large language models (LLMs) are the best-known kind. Trained to predict the next token on enormous amounts of text, they learn to write, summarise, translate, reason and use tools.

An LLM on its own is like a well-read expert with no access to your files and no notebook. Useful products surround it with retrieval to bring in the right documents, evaluation to check quality, observability to see what happened, safety layers to block harm, and serving infrastructure to make it fast and affordable. This page maps that whole stack.

## How LLMs work

- [GPT architecture](/tools/gpt-architecture): decoder-only transformers trained to predict the next token.
- [BERT](/tools/bert): encoder models for understanding tasks and embeddings.
- [Reasoning models](/tools/reasoning-models): spending more computation at answer time on hard problems.
- [KV cache](/tools/kv-cache) and [Speculative decoding](/tools/speculative-decoding): what makes generation fast.
- [Small language models](/tools/small-language-models) and [Multimodal models](/tools/multimodal-models): the trade-off between size, cost and capability, and models that see and hear.
- [Transformers](/tools/transformers) and [FlashAttention](/tools/flashattention): the underlying architecture and its efficient attention kernels.

## Giving models the right information

Most business value comes from connecting models to your own data. [Embeddings](/tools/embeddings) turn text into vectors; vector databases search them; [Context engineering](/tools/context-engineering) and [Prompt engineering](/tools/prompt-engineering) decide what the model sees and how it is instructed. Retrieval patterns range from [Naive RAG](/tools/naive-rag) to [Agentic RAG](/tools/agentic-rag), and [Text-to-SQL](/tools/text-to-sql) brings structured data into the conversation.

## Adapting models: fine-tuning

When prompting and retrieval are not enough, models are adapted with [fine-tuning](/tools/fine-tuning): [full fine-tuning](/tools/full-fine-tuning), parameter-efficient methods such as [LoRA](/tools/lora), [QLoRA](/tools/qlora) and [PEFT](/tools/peft), instruction tuning with [SFT](/tools/sft), and preference tuning with [RLHF](/tools/rlhf) and [DPO](/tools/dpo).

## Measuring and protecting quality

Language model outputs vary, so every serious system needs evaluation, tracing and safety controls: observability platforms record each step, evaluation tools score outputs, and safety tools detect personal data, block jailbreaks and test defences through red-teaming. See also [LLM-as-judge](/tools/llm-as-judge), [Guardrails](/tools/guardrails) and [Prompt-injection defense](/tools/prompt-injection-defense).

## The full map

### LLM concepts

- [Reasoning models](https://www.ozercemkelahmet.com/tools/reasoning-models.md)
- [Context engineering](https://www.ozercemkelahmet.com/tools/context-engineering.md)
- [Prompt engineering](https://www.ozercemkelahmet.com/tools/prompt-engineering.md)
- [Embeddings](https://www.ozercemkelahmet.com/tools/embeddings.md)
- [KV cache](https://www.ozercemkelahmet.com/tools/kv-cache.md)
- [Speculative decoding](https://www.ozercemkelahmet.com/tools/speculative-decoding.md)
- [Small language models](https://www.ozercemkelahmet.com/tools/small-language-models.md)
- [Multimodal models](https://www.ozercemkelahmet.com/tools/multimodal-models.md)
- [Text-to-SQL](https://www.ozercemkelahmet.com/tools/text-to-sql.md)
- [BERT](https://www.ozercemkelahmet.com/tools/bert.md)
- [GPT architecture](https://www.ozercemkelahmet.com/tools/gpt-architecture.md)

### Fine-tuning

- [Fine-tuning](https://www.ozercemkelahmet.com/tools/fine-tuning.md)
- Full fine-tuning
- SFT
- LoRA
- QLoRA
- PEFT
- DPO
- RLHF

### Frontier topics

- [Test-time compute](https://www.ozercemkelahmet.com/tools/test-time-compute.md)
- [Diffusion language models](https://www.ozercemkelahmet.com/tools/diffusion-language-models.md)
- [Prompt caching](https://www.ozercemkelahmet.com/tools/prompt-caching.md)
- [LLM routing](https://www.ozercemkelahmet.com/tools/llm-routing.md)
- [Model merging](https://www.ozercemkelahmet.com/tools/model-merging.md)
- [AI watermarking and provenance](https://www.ozercemkelahmet.com/tools/ai-watermarking-and-provenance.md)

### Vector databases

- [Weaviate](https://www.ozercemkelahmet.com/tools/weaviate.md)
- [ChromaDB](https://www.ozercemkelahmet.com/tools/chromadb.md)
- [Milvus](https://www.ozercemkelahmet.com/tools/milvus.md)
- [Qdrant](https://www.ozercemkelahmet.com/tools/qdrant.md)
- [Vespa](https://www.ozercemkelahmet.com/tools/vespa.md)
- [FAISS](https://www.ozercemkelahmet.com/tools/faiss.md)
- [pgvector](https://www.ozercemkelahmet.com/tools/pgvector.md)

### Vector indexes

- [IVF-PQ](https://www.ozercemkelahmet.com/tools/ivf-pq.md)
- [ScaNN](https://www.ozercemkelahmet.com/tools/scann.md)
- [DiskANN](https://www.ozercemkelahmet.com/tools/diskann.md)

### LLM observability and evaluation

- [LangSmith](https://www.ozercemkelahmet.com/tools/langsmith.md)
- [Langfuse](https://www.ozercemkelahmet.com/tools/langfuse.md)
- [Phoenix](https://www.ozercemkelahmet.com/tools/phoenix.md)
- [Braintrust](https://www.ozercemkelahmet.com/tools/braintrust.md)
- [PromptFoo](https://www.ozercemkelahmet.com/tools/promptfoo.md)
- [lm-evaluation-harness](https://www.ozercemkelahmet.com/tools/lm-evaluation-harness.md)

### LLM safety

- [Guardrails AI](https://www.ozercemkelahmet.com/tools/guardrails-ai.md)
- [NeMo Guardrails](https://www.ozercemkelahmet.com/tools/nemo-guardrails.md)
- [Presidio](https://www.ozercemkelahmet.com/tools/presidio.md)
- [Red-teaming](https://www.ozercemkelahmet.com/tools/red-teaming.md)

## Related topics

- [Agentic AI](/topics/agentic-ai): models that plan and use tools.
- [Deep learning](/topics/deep-learning): the neural network foundations.
- [MLOps and AI infrastructure](/topics/mlops-ai-infrastructure): serving, hardware and operations.

## Frequently asked questions

### What is the difference between generative AI and LLMs?

Generative AI is the broad category of models that create content. LLMs are generative models specialised in text and code, and increasingly in other modalities.

### Do I need a vector database to use LLMs?

Only if you retrieve from your own documents at scale. Small projects can use simpler stores or PostgreSQL with pgvector.

### How do I know if an LLM application is good enough?

Build an evaluation set from real tasks, score outputs with reliable graders, trace production traffic, and red-team for safety before release.

## Summary

LLMs are powerful text predictors that become useful products when surrounded by retrieval, context design, evaluation, observability, safety and efficient serving. Use the map above to explore each layer.
