All jobs / AI engineer / Document AI
AI engineer interview question · 1–3 years
How do you chunk a long contract or manual that has headings, numbered clauses, tables and figures?
The strongest answer
Along the document’s own structure: sections and clauses as units, each carrying its heading path and page numbers as metadata, tables and lists never cut mid-way, and size-based splitting only inside sections that are too long
Why it works
Exactly — the author already divided the document for you. The heading path gives a chunk its context, and page numbers make citation possible later.
What a good answer covers
- Chunk along the document’s structure.
- Attach heading path and page numbers.
- Never cut a table or list mid-way.
- Split by size only inside long sections.
Answers that fall short
- Close, but not the strongest: Fixed-size chunks with a generous overlap, so that a clause cut in half still appears whole in a neighbouring chunk
Overlap softens the damage but still produces chunks that start mid-clause with no idea which section they belong to. - Weak: One chunk per page, because pages are the natural unit of a PDF and they make citations easy
Page breaks are a printing accident: clauses and tables run across them. Keep the page as metadata, not as the boundary. - Red flag: Whatever the framework’s default splitter does; chunking is a detail and I would not spend time checking it
Defaults are written for plain text. Not opening your own chunks to read them is what an interviewer notices.
Who gets asked this
More Document AI questions
- A legal team will only use your contract assistant if every answer points to a real page and clause. How do…
- In your equipment manuals the wiring diagrams and annotated screenshots carry the key information. The…
- A customer’s legal team asked your contract assistant whether a 300-page agreement had an auto-renewal…
- Your service extracts supplier, totals and bank details from invoices in hundreds of layouts. Finance wants…
- Two PDFs look identical on screen, but your parser gets clean text from one and nothing from the other. Why…
- Why is “just extract the text from the PDF” harder than it sounds?
- Your document Q&A is good on prose but wrong on figures that come from tables. In the extracted text, a table…