Skip to content
mentoor

Topic 3 of 5 · 4 min read

Asking questions about documents offline

Goal: Ask a local model about a document and check each answer against a quoted passage.

You can attach a file to a local chat and ask about it. A small model does not read the whole file equally well, so ask for the exact quote behind every answer and check it.

Check yourself · 1 of 3

Why might a local model answer a question about page 80 of a long attached file wrongly?

Choose one answer

Why it matters

Documents are the main reason people go local: contracts, reports, case notes. Apps such as LM Studio and GPT4All let you attach files. But attached does not mean read with perfect memory. A small model has a limited context window, the amount of text it can hold in view at once. If your file is longer, the app often searches it and hands the model only a few matching pieces. The model answers from those pieces and may never have seen the rest.

Research on long inputs also found that models use the start and end of a long text better than the middle (see the Lost in the Middle paper in the references). Small models are more prone to this.

How to do it

  1. Attach one document at a time. Mixed files make it harder to tell where an answer came from.
  2. Ask a narrow question. "What is the notice period in section 9?" works better than "Summarise everything important."
  3. Ask for a quote. Add: "Quote the exact sentence you used, with its section number. If it is not in the document, say so."
  4. Search for the quote. Open the file and search for those words. If the quote is not there, the answer is not trustworthy.
  5. Split long files. Ask about one chapter or section at a time instead of one question across a whole book.
  6. Say what to do when unsure. Tell the model to answer "not found" instead of guessing.

Before and after

Before: "Here is the contract. Are there any risks?"

The model gives a general list of contract risks, much of it from training, not from your file.

After: "Using only the attached contract, what does it say about ending the agreement early? Quote the sentence and give the clause number. If the contract says nothing, reply: not found."

What goes wrong

  • Invented quotes. Small models sometimes write a sentence that sounds like it belongs in the contract. Searching the real file catches this.
  • Missed passages. The app searched, found the wrong pieces, and the model answered from them. The fix is a narrower question or the right section pasted in directly.
  • Answers from memory. The model blends what it knows about similar contracts with what your file says. "Using only the attached document" reduces this but does not remove it.
  • Scanned PDFs. A scan is a picture, not text, and many apps cannot read it without text recognition.

Examples

A quote check that catches an error

You: Using only the attached lease, how much is the deposit? Quote the sentence.

Model: The deposit is two months of rent. "The Tenant shall pay a deposit equal to two months' rent."

You search the lease for "two months". It is not there; section 4 says "one month". The quote was invented, so the answer is wrong. Without the quote request you might have accepted it.

Splitting a long report

A 120-page report will not fit in a small model's view. Open the contents, ask about one chapter at a time, and keep each answer with its quote. Then compare the chapter answers yourself instead of asking the model to merge them from memory.

Key points

  • An attached file is often searched, not read in full, so the model may answer from a few pieces.
  • Models tend to use the start and end of a long text better than the middle.
  • Narrow questions about one section work better than broad requests across the whole file.
  • Ask for the exact quote and section number, then search for that quote in the original.
  • Tell the model to say not found when the document does not answer the question.

Common mistakes

  • Believing the model read all of a long file because it accepted the attachment.
  • Accepting an answer without searching for its quote in the original.
  • Asking an open question such as "any risks?" and treating the reply as a review of the file.
  • Attaching a scanned PDF that has no selectable text and trusting an answer built from nothing.

Check yourself · 2 of 3

Which request makes an answer easiest to verify?

Choose one answer

Check yourself · 3 of 3

The model quotes a sentence, but a search of your document finds no match. What should you do?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic