How AI Chatbots Use Your Files and the Web to Answer
Why a chatbot can answer questions about a document you upload, what 'retrieval' means, and why even answers with sources still need checking.
You upload a PDF and ask a question about page 40. The chatbot answers, sometimes even pointing to the right passage. How? It didn’t memorize your file in advance. Where did the answer come from?
The short version: an AI chatbot has two sources of information. One is what it absorbed during training. The other is whatever is put in front of it during your conversation. Features that let a chatbot read your files or look things up on the web are mostly about the second source.
The open-book exam
Think of a student taking an exam.
In a closed-book exam, the student answers from memory. They may remember a lot, but memory is imperfect. Sometimes they will confidently write something that sounds right and isn’t.
In an open-book exam, the student can look things up. They flip to the right chapter, read the relevant passage, and write the answer using it. They still need to understand what they read, and they can still misread it. But they are less likely to make up a fact out of thin air.
A chatbot answering from training alone is taking the closed-book exam. A chatbot that reads your document or searches the web is taking the open-book exam.
What happens when you upload a document
The exact design differs between products, and companies change them often, so treat this as a general picture rather than a description of any one tool.
Short documents can often be placed straight into the conversation. The chatbot then “reads” the whole thing as part of your message, the same way it reads your question. This works because a chatbot has a limit on how much text it can handle at once, sometimes called its context window. If you want more on that, see our explainer on tokens and context windows.
Longer documents are trickier. If a file is too big to fit, a common approach is to:
- Split the document into pieces, such as paragraphs or pages.
- Search those pieces for the ones most related to your question.
- Hand only those pieces to the chatbot, along with your question.
- Let the chatbot write an answer based on what it was given.
This general approach is often called retrieval-augmented generation, or RAG. “Retrieval” is the look-up step. “Generation” is the chatbot writing the answer. The look-up step is often done by a search method that matches meaning rather than exact words, so a question about “cancelling” can find a passage that says “terminating.”
What happens when a chatbot uses the web
Chatbots that can browse follow a similar pattern. A search happens, the results (or pieces of them) are placed in front of the model, and the model writes an answer using that material. Often it will also list links to the pages it used.
The chatbot is not “knowing” the web. It’s reading a handful of search results in the moment, the same way you might skim the first few links.
Why this helps
- Fresher information. Training happens at one point in time, so a chatbot’s built-in knowledge has a cutoff. Looking something up can bring in newer material.
- Your own material. A model can’t have learned your lease, your company handbook or your child’s school newsletter. Reading them in the conversation lets it work with them.
- Easier checking. If an answer points to a passage or a link, you can go and read the original.
Where it still goes wrong
Open-book doesn’t mean error-free. These are well-known weak spots:
- The wrong passage gets found. If the look-up step misses the relevant section, the chatbot answers from what it did get, or from its training, and may not tell you.
- Misreading. The model can summarize a passage inaccurately or leave out an important exception.
- Citations that don’t support the claim. A source can be real and still not say what the answer claims it says. Sometimes a reference is wrong or doesn’t exist at all.
- Bad sources. On the web, the pages found may be out of date, biased or simply wrong. The chatbot doesn’t automatically know which to trust.
- Mixing in memory. The answer may blend what the document says with what the model “remembers,” and it can be hard to tell which is which.
- Parts of the file may be skipped. Scanned pages, tables, images and unusual layouts may not be read well.
How to use this in practice
- Ask for quotes. “Quote the exact sentence that supports each point” makes it easy to compare the answer against the file.
- Tell it to stick to the document. “Answer only from the text I uploaded. If the answer isn’t there, say so.”
- Click the source. A link or page reference is a starting point for checking, not proof.
- Be careful with high-stakes content. For health, legal, money or safety questions, use the AI to help you understand and prepare questions, then confirm with a qualified professional.
- Think before you upload. Anything you upload goes to the company running the service. Remove personal details first when you can, and follow your employer’s rules for work documents.
What’s well established, and what’s not
It’s well established that giving a model relevant text in the conversation makes it far better at answering questions about that text than relying on memory, and that this technique has real failure modes such as the ones above. The details vary widely: how products split files, how they search them, and how they decide when to browse are design choices that differ and change over time. And no method has made chatbots fully reliable. That’s why the habit that serves you best is simple: treat the answer as a well-read assistant’s first draft, and check the parts that matter against the source.
Related
EmbeddingGemma 2: semantic search on a laptop in 20 lines
Google's new 740M multimodal embedding model runs on a CPU. Here's how to build a working semantic search over your own documents, and the prefixes that make it accurate.
google/embeddinggemma-2
Why AI Replies Appear Word by Word: Streaming Explained
Why chatbots type out answers piece by piece, what is happening behind the scenes, and why longer answers take longer. A plain-English explainer.
Why AI Refuses Some Requests: Guardrails Explained
Why chatbots sometimes say no, how safety training and filters work in general terms, and why refusals can be wrong in both directions.