Did the Meaning Survive?

Illustration for the video Did the Meaning Survive?

“Convert your documents to Markdown before feeding them to AI. It saves tokens.” I hear that claim all the time. So I measured it.

The idea

Most AI conversations focus on the model, but the bigger challenge is increasingly the information we give it. That’s context engineering. To test the Markdown claim, I built a benchmark with seven real business PDFs, ran them through multiple document processing tools, and had several leading AI models independently score the results on two things: token usage and document fidelity, meaning whether the meaning and structure of the original survived.

Markdown didn’t automatically save tokens. Sometimes it used significantly more. And while the words usually survived conversion, the structure often didn’t. Tables broke apart, headings lost their hierarchy, and multi-column layouts got scrambled.

Why it matters

  • The tool can make or break it. The same document scored 1 out of 5 on structure with one tool and 5 out of 5 with another.
  • No tool wins everywhere. On a PDF with embedded spreadsheets, every tool struggled.
  • Context quality rivals model quality. With a leading frontier model, how your information is prepared and structured may matter even more than the model.

Test your assumptions on your data

Context engineering goes beyond asking a better question. It means giving AI better data, in a better structure. Test different formats for your documents and validate that both meaning and structure survive.

I pulled my benchmark findings and framework into an AI context engineering playbook you can download.

Join the conversation: see the comments on LinkedIn.

Read the full transcript

Hey, I’m Matt. Most people start thinking about using AI by focusing on the AI model. But increasingly, the bigger challenge is related to the information we give that model. This holistic idea of everything that we give to the models is referred to as context engineering. And I found a great example of the importance of context in a claim I hear all the time. The claim is convert your document to markdown format before feeding it to AI. If you’re not familiar with Markdown, it’s a text file format. And the specific benefit I hear is that you’ll use fewer tokens using Markdown format, say, versus using PDF format.

And that will lower your costs and there will be more room in this finite temporary memory that we call the context window. To be fair, in some situations that may be true. But after years of building AI solutions for clients, I’ve learned that most widely accepted ideas are often worth measuring. Now, some of you may remember that earlier this year, I tested 13 different PDF extraction tools because PDF extraction is such a common part of the business AI use cases. This time around, I wanted to answer a different but related question. What actually makes a PDF document work better for AI? And specifically, can I confirm that for my business PDFs?

So I wrote a bunch of code and ultimately built a benchmark to do some of the testing and measuring. I loaded it with seven real business PDF documents. Then I ran them through multiple document processing tools, including markdown conversion. And instead of relying on my opinion around quality of the output from different tools, I wrote code to have multiple leading AI models independently score the results. I measured two things. First, token usage, and then second, document fidelity.

If you’re not familiar with document fidelity in data science, it just means how well does the meaning and the structure of the original document survive the conversion. So for example, did the headings stay headings and did the tables stay tables? And my results told a pretty different story from all the claims I’ve been hearing related to the upside of using Markdown format. For example, Markdown did not automatically save token usage.

In some cases, it used more tokens, sometimes significantly more. But the most interesting finding was that the words of the source document usually survived the conversion, but the structure often didn’t survive. What does that mean? Well, tables broke apart and headings lost their hierarchy.

And worse yet, multi-column layouts sometimes became scrambled. Here’s the part that really got my attention. On one document, the exact same file scored a one out of five on preserving the document structure and tables using one tool and a five out of five on the other tool. But as is typically the case, there is no one magic tool or approach. For example, on one PDF with embedded spreadsheets, both tools struggled.

The point is that no one tool is best and that you really need to test your assumptions on your data. This focus is not just on what data we give AI, but how we give it to AI. And it’s helping drive the industry from a simple prompt engineering perspective to something more complex that we call context engineering. If you’re not familiar with context engineering, think of it like going beyond prompt engineering to ask AI a better question while also providing it with better data. This requires thinking about both the content that you’re giving it, but its structure as well. And all of this brings us to the reality that in many real world situations, the quality of the context matters as much as the quality of the model.

Of course, the model that you use matters. But if you’re using a leading frontier model, the information you feed it and the way that information is prepared and structured may matter even more. So remember to test different formats for your data and make sure you validate that both the meaning and the structure survive the conversion. I pulled together my benchmark findings, my lessons learned, and the framework I used as an AI context engineering playbook. And you can download it from the comments. And as always, thanks for watching.

Leave a Reply