Skip to main content
Large language models (LLMs) can struggle with tasks that look simple, like counting how many times a word appears in a document, or answering a precise question about a CSV file. This page explains why, and how to get exact answers from structured data in Dust.

How LLMs work

An LLM predicts the most likely next word in a text, based on the patterns it learned during training. This makes it very good at writing and understanding language, but it doesn’t calculate or keep an exact count. Some researchers call LLMs “stochastic parrots”: they produce convincing language without understanding it the way people do.

Why LLMs struggle with counting

When you ask an LLM to count the words in a document, it doesn’t count. It reads the text as a sequence of tokens and writes a likely answer. The model also has a limited context window: for a long document, it may not see all of the text at once. See Understanding LLMs Context Windows.

Why LLMs struggle with CSV files

  • Sequential reading: an LLM reads data token by token, as a line of text. Rows and columns don’t fit this way of reading.
  • No sense of structure: a table links each value to a row and a column. An LLM trained mainly on text doesn’t track these links reliably.
  • Training data: LLMs learn mostly from unstructured text. They can talk about data, but they don’t calculate on it.

Get exact answers from structured data

To answer questions about tables, give your agent the Analytics (tables, spreadsheets…) knowledge lookup method. When you add knowledge to an agent in the Agent Builder, select this method in Configure knowledge. With this method, the agent writes and runs SQL queries on your tables before it answers. It works with CSV files, Google Sheets, Notion databases, and other tables in your data sources. Because it uses SQL, the agent can calculate, count, and group data across the whole table, instead of reading a few relevant chunks. If an agent has the Computer, it can also run code on a CSV or spreadsheet file that you attach to your message, to count and calculate exactly. Use Content search for questions about the meaning of your documents, and Analytics for questions that need numbers. See Table queries. If your table queries don’t work, see I try to create an agent using the Table Query tool, but it doesn’t work.

Table queries

Query tables and spreadsheets with SQL.

Understanding Retrieval Augmented Generation (RAG) and the search method in Dust

Learn how agents search your documents.