AI & XML / Comparative study of PDF-to-AI converters / Prompts for AI-assisted tools 6 Prompts for AI-assisted tools

A detailed prompt, almost identical in content, was written for the two large multimodal language models ChatGPT and Gemini. It defines conversion requirements and the structural features and content to preserve. The supplied prompts differ only between the PDF-to-Markdown and PDF-to-XML conversion paths: the XML variant includes richer semantic elements and additional linking requirements for bibliographies and in-text references.

The prompts first specified complete conversion to Markdown or DocBook 5 XML, then defined treatment of headings, page breaks, multicolumn layouts, running text, images, tables, footnotes, special characters, formulas, lists and multilingual content.

Detailed prompts were necessary to make conversion as uniform as possible for both models and define comparable tasks. Large language models generate output from supplied instructions, so even small differences in task descriptions can change results.

The prompts deliberately covered complex PDF conversion requirements in detail. They began by requiring complete conversion and defined quality goals including "maximum structural fidelity to the original document", "complete and exact transfer of every single character" and "highest correctness of text, structure and content". Models were thus instructed to reconstruct the entire document faithfully, not just extract text.

A major part concerns reconstructing document structure. Heading hierarchies, for example, had to follow content structure rather than numbering alone. Markdown used levels marked with "#", "##" and "###", while XML required suitable DocBook elements such as "chapter", "section" and "para". This was intended to prevent models merely copying visible formatting without considering semantic structure.

Page breaks are another example. Both prompts required explicit markers: "<!-- PAGE BREAK: Seite X -->" in Markdown and the processing instruction "<?pagebreak Seite="X"?>" in XML. Page numbers also had to be removed from running text to prevent layout artifacts interfering with later processing.

Complex layouts received special attention. Many scholarly PDFs contain multiple columns, where simple extraction often produces incorrect reading order. Both prompts therefore required merging columns in the correct order, removing hard line breaks within paragraphs and restoring complete sentences. Hyphenation caused by line breaks also had to be removed to reconstruct words correctly.

Nontext content was also specified in detail. Markdown required images in the form "![beschreibung](images/pageXX_imgY.png)" with a contextual description. XML instead specified DocBook elements such as "mediaobject", "imageobject" and "imagedata". Graphic positions had to be retained and links to extracted image files created.

Both prompts required complete reconstruction of tables, including correctly merging tables continued across pages. Markdown used Markdown tables, whereas XML required DocBook "table", "tgroup", "thead", "tbody", "row" and "entry" elements, preserving semantic table structure as fully as possible.

Footnotes and scholarly references were another important component. Models had to recognize and correctly associate markers such as “¹”, “²”, “i” or “ii”. Markdown used footnotes in the form "[^1]", while XML used "footnote" elements. XML also contained further bibliography requirements: structure as "bibliography" or "bibliolist", with individual "biblioentry" records linked where appropriate to in-text references through "xref" or "biblioref".

Both prompts also addressed formulas and special characters. Markdown represented formulas as LaTeX or inline code; XML used "inlineequation", "informalequation", MathML or embedded LaTeX. All special characters had to be preserved unchanged to avoid information loss.

Finally, both prompts addressed artifact cleanup: removing OCR errors, duplicate text and encoding errors. They explicitly specified that uncertain content should be reconstructed "with meaningful structure rather than literal errors", allowing some interpretation to correct typical automated PDF extraction mistakes.

Overall, Markdown and XML prompts differ only in target syntax and required structural elements. Their fundamental requirements for completeness, structural fidelity and semantic reconstruction are nearly identical, reducing the influence of different task wording.

back to top