ProCourses All Courses Security Pro Data Pro DevOps Pro AI Pro CertPrep+ All Certs
CompTIA A+ Core 1 A+ Core 2 Network+ Security+ CySA+ About CompTIA
ISC2 CISSP About ISC2
Microsoft AZ-900 Azure Fundamentals AZ-104 Azure Administrator AI-901 Azure AI Fundamentals About Microsoft
AWS Cloud Practitioner Solutions Architect Associate AI Practitioner About AWS
Games Read Latest News Guides About Pricing Contact Enroll
Guides / AI / Introduction to AI Concepts and Challenges:…
AI · Explainer

Introduction to AI Concepts and Challenges: RAG, Agents and More

AI concepts explained in plain words: LLMs, tokens, RAG, agents and MCP, plus where each one breaks, from hallucinations to prompt injection.

opnF.shNov 2, 20269 min readai conceptsragllm
On this page 10 sections ▾

TL;DR

  • Most AI products are one model plus plumbing: retrieval to feed it facts, and tools to let it act on what it reads.
  • Every layer you add brings its own failure mode, because the model guesses, retrieved text can be poisoned, and agents can act on bad instructions.
  • Prompt injection is the biggest unsolved security problem in AI apps, and adding RAG or fine-tuning does not fix it.
New to this?Ping explains the 2 hardest parts in plain words.

The core AI concepts are simpler than the jargon suggests: a large language model (LLM) predicts text one piece at a time, and nearly everything else you hear about, like RAG, agents and MCP, is a way of feeding that model better information or letting it take actions.

Quick facts

RAG is older than ChatGPT. The term comes from a 2020 research paper by Facebook AI Research, University College London and NYU, and the original version looked up answers in Wikipedia.

Models read long inputs a bit like people skim: they do best with facts at the very start or end, and miss more of what's buried in the middle.

In an October 2026 test, Anthropic says its Claude model went from a Linux kernel bug to root access in 53 minutes, and the buggy code had been sitting in the kernel since version 4.4.

#What a large language model actually does

An LLM learns by reading huge amounts of text and practicing one task over and over: predicting the next word. That stage is called pretraining, and none of the text comes labeled true or false, so the model learns what sounds fluent rather than what is correct. Later stages of training tune it to follow instructions and be helpful, and using the finished model to answer you is called inference.

i
For your information

Keep the "predicts the next word" idea in mind for the rest of this guide. Many of the challenges below, from made-up facts to prompt injection, trace back to a model that treats all text as something to continue rather than something to check.

#Tokens and the context window

Models don't read words, they read tokens, which are chunks of text that can be a single letter, part of a word or a whole word. For English, OpenAI's rule of thumb is that a token is about 4 characters or three quarters of a word, so 100 tokens comes out to roughly 75 words. Tokens matter because they are how API use gets billed and how a model's memory gets measured.

The context window is the maximum number of tokens a model can take in one go, counting your messages, any documents you paste and its own reply. This is why very long chats seem to "forget" what you said at the start: once the window fills up, earlier text has to be trimmed or summarized.

~
Where it breaks

A bigger window is not the same as better reading. Stanford-led research found that models answer best when the key fact sits at the beginning or end of the input, get noticeably worse when it's in the middle, and slip further as the input gets longer, even in models built for long contexts.

#Hallucinations: why AI gives confident wrong answers

A hallucination is a fluent, believable answer that is simply false. OpenAI's 2025 research argues the main cause is that training and testing reward guessing: if a model is asked for someone's birthday and doesn't know it, a guess has a 1 in 365 chance of scoring, while "I don't know" always scores zero. Over thousands of test questions, the guesser looks better on the leaderboard.

  • OpenAI's older o4-mini answered almost everything on one fact quiz and was wrong 75% of the time.
  • The newer gpt-5-thinking-mini declined to answer about half the questions, which cut its wrong answers to 26%, while its share of right answers barely moved.
  • Facts that follow a pattern (spelling, grammar) get learned reliably, while one-off facts like a specific person's birthday can't be predicted from patterns, which is where hallucinations cluster.

#Prompts and system prompts

A prompt is whatever you send the model. Apps also add a system prompt you usually never see, which sets the rules: the assistant's role, its tone and what it shouldn't do. Giving the model a few worked examples inside the prompt, called few-shot prompting, is often the fastest way to get output in the exact format you want without any extra training.

~
Where it breaks

A system prompt is instructions, not a vault. OWASP added System Prompt Leakage to its 2025 list of top risks for LLM apps, because cleverly worded questions can get a model to reveal its hidden instructions. Never put passwords, API keys or secrets in one.

#What is RAG? Letting the model look things up

Retrieval-augmented generation (RAG) means searching a set of documents for passages related to the question, pasting the best matches into the prompt and asking the model to answer from them. It's how a support bot can answer from your company's own help articles without being retrained, and the original paper pointed out a bonus: you can update what the model knows just by swapping the documents.

Question
→
Turn into embedding
→
Search vector database
→
Add top passages to prompt
→
Model answers
A typical RAG flow: the question is used to find relevant passages, which go into the prompt before the model writes its answer.
ELI5: explain it simply
Ping explainsNo experience needed.
THE WORDS
Embedding
A list of numbers that captures what a piece of text means.
Vector database
A database that finds text with similar meaning, not just matching words.
Chunking
Cutting long documents into short passages so search returns just the useful part.
THE IDEA

It's an open-book exam. Instead of answering from memory, the model first flips to the pages most likely to help, then writes its answer with those pages open in front of it.

~
Where it breaks

RAG makes answers more grounded, but the model trusts whatever gets retrieved. Outdated pages produce outdated answers, and a document with hidden instructions planted in it can steer the model. OWASP added Vector and Embedding Weaknesses to its 2025 list for exactly this reason.

#RAG vs fine-tuning

Fine-tuning means continuing to train a model on your own examples so its behavior changes: a house writing style, a specific output format, or a narrow task it does over and over. RAG changes what the model *knows* at answer time, while fine-tuning changes how it *behaves*. A common rule of thumb is to reach for RAG when facts change often and you want answers you can trace to a source, and fine-tuning when the facts are fine but the style or format isn't.

#Tools, agents and MCP

Tool use (also called function calling) lets a model ask the app to run something for it, like a web search, a calculator or a database query, and then read the result. An agent is a model running in a loop with tools: it plans a step, uses a tool, checks the result and keeps going until the task is done, which is how AI can now book a meeting or fix a bug across several files.

The Model Context Protocol (MCP) is an open standard Anthropic released on November 25, 2024 for plugging AI apps into data and tools. It uses a client-server design: an MCP server exposes something like a file share, a ticketing system or a database, and any AI app that speaks MCP can connect to it, so each integration gets built once instead of separately for every app.

ELI5: explain it simply
Ping explainsNo experience needed.
THE WORDS
Protocol
A shared set of rules two programs follow so they can talk to each other.
Client-server
One program (the server) offers something, and others (the clients) connect to use it.
THE IDEA

MCP is like USB for AI. Before USB, every device needed its own special plug. With one standard port, any device works with any computer, and with MCP any compatible tool works with any compatible AI app.

~
Where it breaks

An agent can only do as much damage as its permissions allow, and OWASP lists Excessive Agency as a top-10 risk because so many agents are handed far more access than the job needs. Give an agent read-only access wherever you can, and require a human to approve anything that deletes, sends or spends.

#Prompt injection: the problem nobody has solved

Prompt injection happens when text the model reads changes what it does in ways the app never intended. OWASP ranks it as the number one risk for LLM applications in its 2025 list, and splits it into two kinds:

  • Direct injectionThe user types instructions meant to override the rules. When it's used to get around safety limits, it's usually called a jailbreak.
  • Indirect injectionHidden instructions sit inside content the model reads for you: a web page it summarizes, an email it triages or a document RAG pulls in. The person using the app may never see the attack text at all.

The root cause goes back to how LLMs work: instructions and data arrive as the same stream of tokens, so the model has no built-in way to tell "text to follow" from "text to read." That's why OWASP notes that neither RAG nor fine-tuning fully prevents it. The practical defense is containment: limit what the model can reach, keep untrusted content separate from instructions, and assume that eventually something will get through.

#AI is finding old bugs faster than they get patched

The flip side of AI that writes code is AI that breaks it. CVE-2026-98432, a Linux kernel flaw scored 9.8 out of 10, was found by Anthropic using an unreleased Claude research model, in code dating back to Linux 4.4. Anthropic says the model went from the bug to running commands as root in about 53 minutes.

The lesson for anyone in IT is less about one bug and more about the gap it exposed: the time it takes to go from a flaw to a working attack is shrinking, while patching still moves at human speed. Fixed kernels were already out across eight kernel branches, but as of October 30 Ubuntu and Red Hat had yet to ship patched kernels to their users.

#Other AI challenges worth knowing

  • Data leakageWhatever you paste into an AI tool may be stored, logged or used under that tool's terms, and Sensitive Information Disclosure sits at number 2 on OWASP's 2025 list. Check your company's policy before pasting customer data or code.
  • BiasA model reflects the text it learned from, including that text's blind spots, so outputs used for decisions about people deserve a human review.
  • CostEvery token costs compute, and OWASP's Unbounded Consumption entry covers apps that let one user or one runaway agent rack up huge bills or knock a service over.
  • Over-relianceFluent answers feel trustworthy. Treat AI output like a first draft from a fast, confident new hire, and check anything that matters.

If you'd like to turn these concepts into a credential, CertPrep+ includes practice for Microsoft's AI-901 and the AWS Certified AI Practitioner (AIF-C01), so you can prep for either one right here.

What is RAG in AI?
RAG (retrieval-augmented generation) is a technique where an AI app first searches a set of documents for passages related to your question, then gives those passages to the model so it answers from them instead of from memory alone. It's a common way for companies to point a chatbot at their own help articles, policies or tickets.
What is the difference between RAG and fine-tuning?
RAG gives the model new information at the moment it answers, while fine-tuning retrains the model to behave differently. Many production systems use both: a fine-tuned model for tone and format, with RAG supplying the current facts.
Why does AI make things up?
Models are trained to produce likely-sounding text, and most tests reward a lucky guess over admitting uncertainty, so guessing becomes the habit. Asking the model to cite its sources, and giving it documents to answer from, makes made-up answers easier to catch.
What is MCP in AI?
MCP (Model Context Protocol) is an open standard for connecting AI apps to outside data and tools. A system gets wrapped once as an MCP server, and any AI app that supports MCP can then use it.
Is prompt injection the same as jailbreaking?
Jailbreaking is one kind of prompt injection, where the user directly tries to talk the model out of its rules. Indirect prompt injection is harder to spot, because the malicious instructions hide in content the model reads on someone's behalf, like a web page or email.
opnF.sh
Hands-on guides from the team that builds the labs you practice in.