What kinds of metadata can be extracted?
Two kinds, and they need different tools. Embedded metadata is already in the file and only has to be read; derived metadata has to be inferred from the content.
| Kind | Where it comes from | Examples | Typical tool |
|---|---|---|---|
| Embedded, technical | The file container and headers | Dimensions, duration, codec, camera model, GPS, creation time | A parser such as ExifTool |
| Embedded, descriptive | Fields the author or software wrote | Title, author, keywords, copyright | A parser such as Apache Tika |
| Derived, from content | The text or pixels themselves | Contract party, invoice number, topic, language, sentiment | OCR, a classifier or an LLM |
ExifTool describes itself as a library and command-line application for reading, writing and editing meta information in a wide variety of files, covering formats such as EXIF, GPS, IPTC and XMP (ExifTool, read 26 November 2026). Apache Tika “detects and extracts metadata and text from over a thousand different file types” (Apache Tika, read 26 November 2026).
How do LLMs change metadata extraction?
They handle the derived kind, which rules and regular expressions handle badly. A model reads a contract, a support ticket or a scanned form, which is unstructured data, and fills a fixed schema: parties, effective date, renewal terms, product line. Constraining the reply with structured output makes the result parseable, and document AI pipelines add layout and OCR first for scans.
Parse what is embedded, infer only what is not. A date in a PDF’s header is read exactly by a parser; asking a model for it adds cost and an error rate. Use the model for fields that exist only in the prose.
How do you check extracted metadata?
Treat every derived field as a prediction. Validate each field against its type and allowed values before it reaches a search index or a database. A short worked example: a model returns effective_date: "03/04/2026". The schema should demand ISO format, so the pipeline rejects the ambiguous string and re-asks, rather than guessing whether March or April is meant.
Add a confidence or source span (the quoted text the value came from) so a reviewer can verify it fast, and sample a few percent of outputs against a hand-labeled set to track accuracy over time. Route low-confidence or schema-failing records to a person, the same pattern as human in the loop.
Why does metadata extraction matter for retrieval?
Retrieval needs metadata because filters need fields. A RAG system that can restrict a search to “contracts from 2025 for this customer” retrieves better than one comparing every chunk by similarity alone, and that restriction is metadata filtering. The quality of retrieval is capped by the quality of the metadata attached at ingestion. Extract during ingestion, store the fields next to each chunk, and re-run extraction when the schema changes. For a model that describes images in prose first, see image captioning.