Blog · Data Preparation

How to Prepare PDFs and Spreadsheets for AI Training

2026-10-14·4 min read·MD ABU SAYEED
In short: Extract documents into clean, consistent, well-labelled examples first — a model trained on raw PDFs and spreadsheets inherits every flaw in them.
Modern robotic arm processing documents in an automated workspace
Modern robotic arm processing documents in an automated workspace

Most companies do not keep their knowledge in neat, ready-made datasets. It lives in contracts, invoices, product specifications, quarterly reports, and in that one spreadsheet the finance team has maintained for six years. When you decide to fine-tune a model on your own data, the pile of PDFs and spreadsheets is usually where you start — and it is also where most projects quietly go wrong. The model is rarely the problem. The preparation is.

Why raw files are not training data

A PDF is a layout format, not a data format. It stores instructions for drawing a page, and only incidentally the text itself. Copy text out of a two-column PDF and you will often get lines from both columns interleaved; extract a table and you may get every cell glued into one unbroken character soup. Spreadsheets look structured, but they hide their own traps: merged cells, formulas that no longer match the displayed values, mixed date formats, and workbooks where the same column means something different on tab one and tab four. Train directly on this material and your model inherits every one of those defects — then reproduces them confidently.

Extract first, clean second

Get everything into plain, structured intermediate files before you touch quality at all. The right extraction route depends entirely on the source:

The cleaning checklist

Cleaning is where most of the real hours go, and it is repetitive by nature. Work through this list for every batch:

From documents to training examples

A fine-tuning run never sees your documents — it sees examples. For instruction tuning, that usually means converting each passage into a prompt–response pair: a question a real user would ask, and an answer grounded strictly in that passage. Long documents should be split into chunks that each stand on their own without needing the surrounding pages. For spreadsheets, define the prediction target before formatting anything: are you classifying rows, generating summaries, or answering questions against the table? The answer changes the shape of every example you build.

Write a short labelling guideline before the first example, not after the hundredth. It does not need to be long — a single page defining the format, the tone, and how to handle uncertainty will keep example four hundred consistent with example four.

Quality control before you press train

Before committing weeks of compute, spend one day auditing. Sample twenty examples at random and read them against the source documents; you are checking extraction fidelity and label quality at the same time. Hold out a small validation set drawn from documents or rows the model will never see during training, and resist the temptation to peek. Confirm that the same kind of question always produces the same kind of answer, whoever labelled it. If the sample reveals systematic problems, fix the pipeline rather than the individual examples — patches at the source propagate everywhere.

None of this is glamorous, but preparation is the highest-leverage phase of a custom-model project. A modest model trained on five hundred clean, consistent examples will outperform a much larger one trained on fifty thousand rows of raw, inconsistent exports. The file formats were never the point. The point is giving the model something true, consistent, and well-shaped to learn from.

Frequently asked questions

Can I fine-tune a model directly on PDF files?
No. A PDF is a page-layout format, so it must first be extracted into plain text or structured records. Fine-tuning pipelines consume clean text or tabular examples, not raw documents.
How do I handle scanned PDFs that have no text layer?
Run OCR to convert the page images into text, then review low-confidence pages by hand. Every recognition mistake left in the output becomes a mistake the model can learn.
What format should prepared training data be stored in?
JSONL with one self-contained example per line is the common standard for instruction data; CSV or Parquet works well for tabular tasks. The key is one complete record per line or row.
How much prepared data do I actually need?
Less than most people expect, if it is clean. Narrow tasks often work from a few hundred consistent examples, while broad general behaviour needs far more. Quality and consistency beat raw volume.

Want a model trained on your own data?

Tell us what you want to build and we will send a scoped plan within 1–2 business days.

Request a fit assessment

More from the blog

Building an Internal Knowledge Assistant People Actually Trust

Building an Internal Knowledge Assistant People Actually Trust

An internal knowledge assistant succeeds only when people trust it. Ground every answer in your documents, cite sources, admit limits, and close the loop.
2026-10-13
How to Plan a First AI Project With a Small Team

How to Plan a First AI Project With a Small Team

A practical plan for your first AI project: pick one narrow workflow, scope a six-week proof of concept, check your data early, and define success before code.
2026-10-13
Guardrails and Safety for a Customer-Facing AI Assistant

Guardrails and Safety for a Customer-Facing AI Assistant

Learn how to build guardrails for a customer-facing AI assistant: scoping, input and output filters, grounded answers, human escalation, and ongoing testing.
2026-10-11