RAG Explained: Build a Retrieval-Augmented Generation App with Python
Learn how Retrieval-Augmented Generation (RAG) works, why it outperforms basic LLMs for custom data, and how to build a working RAG app in Python.
Math · ML · Data Science
Xray AI Lab publishes tutorials and notes on mathematics, Python, data science, machine learning and deep learning. Each article starts from the underlying math and ends with code you can run.
Jump in with the newest posts, a topic, or search.
Essential reads to start with.
Learn how Retrieval-Augmented Generation (RAG) works, why it outperforms basic LLMs for custom data, and how to build a working RAG app in Python.
Learn how AI agents work, explore real-world applications, compare top frameworks, and build a simple AI agent with Python.
A beginner-friendly roadmap to the mathematics behind machine learning: linear algebra, geometry, calculus, probability, and optimization, and how they connect.
Recently published notes on math, code and models.
AI agents explained: learn how LLM agents use tools, state, and a loop, then build a safe local agent in Python with Ollama, tests, and security guardrails.
Learn how to evaluate LLM responses with test sets, code-based graders, human review, and LLM-as-a-judge, plus a runnable Python harness and common pitfalls.
Learn how backpropagation works: the chain rule, a fully worked numeric example, a NumPy implementation with gradient checking, and common pitfalls.
Learn a repeatable pandas data cleaning workflow: audit, fix text and types, parse dates, handle invalid values, remove duplicates, flag outliers, and validate.
Learn to measure data quality across six dimensions, detect and fix bad data with pandas, enforce rules with pandera, and see how bad data hurts models.
Run a complete exploratory data analysis in Python with pandas and seaborn on the Palmer Penguins data, from data quality checks to a Simpson's paradox.
Learn the probability behind machine learning: Bayes' theorem, key distributions, MLE and MAP, with worked examples and Python code you can run and check.
Agentic AI explained through research: agent architectures, planning, tools, memory, what autonomous agents can really do in 2026, and where they still fail.
Learn derivatives visually, then see how partial derivatives and gradients drive neural-network training, with worked examples and verified Python code.
What is computer vision? Learn the core tasks, the key models from CNNs to Vision Transformers, real applications, and runnable Python examples.
Learn how gradient descent minimizes a loss function. Derive the gradients, code it in NumPy, and test learning rates with a plotted experiment.
Learn linear algebra for machine learning: vectors, dot products, matrix multiplication, and eigenvalues, with runnable NumPy examples and PCA.
Start from the subject you want to understand.

Linear algebra, calculus, probability and optimization: the foundations behind the models.

Writing clear, fast and correct Python for scientific work.

Data cleaning, statistics, experiment design and honest evaluation.

Classical learning algorithms, derived and implemented from scratch.

Neural networks, backpropagation and modern architectures.

Convolution, image models and visual recognition.

Language models, embeddings, transformers and generative methods.

Practical guides to the tools of the trade: Git, notebooks, environments.

Reading notes and summaries of papers, with sources.
Nbark Kazdabi | Xray 0xFF
Master’s Student in Artificial Intelligence and Data Science
I am a Master’s student in Artificial Intelligence and Data Science with a background in Mathematics and Computer Science. Through this blog, I share practical tutorials, technical explanations, and lessons from my learning journey.