What is document classification?
Document classification is the task of automatically assigning a document to one or more predefined categories, such as invoice, contract, petition, complaint or confidentiality level, based on its content, structure or metadata.
Text classification labels any text, including sentences and short texts; document classification does this for whole documents, often multi-page files with layout. Information extraction pulls fields from inside a document rather than its type; the two often run in sequence.
- Topic
- Embeddings, document processing and RAG
- Also known as
- Document categorisation
How document classification works
- Categories and sample documents for each are defined.
- Documents are parsed; text, layout and metadata become inputs.
- Fine-tuned language models, large language models guided by a few examples or classic classifiers on representations such as TF-IDF predict the category.
- Predictions come with confidence scores; low-confidence documents go to human review and results are measured regularly.
In more detail
Multi-class, multi-label and hierarchical classification
Enterprise pipelines distinguish between single-label multi-class classification (assigning exactly one document type), multi-label classification (tagging a document with multiple attributes such as 'Contract', 'HR' and 'Confidential') and hierarchical classification across nested departmental taxonomies. Multi-label tasks replace softmax with independent sigmoid thresholds per class so overlapping labels do not suppress each other.
Multimodal and layout-aware document classification
Plain text alone often fails to separate visually similar forms, such as a purchase order, delivery note and invoice or documents degraded by OCR noise. Multimodal document classifiers (such as LayoutLMv3 or vision-language models) combine text tokens, 2D bounding-box coordinates and page-image patches, classifying documents directly from layout and visual cues such as stamps, tables and letterheads.
Class imbalance metrics (macro F1) and confidence calibration
Corporate document streams are typically heavily imbalanced, making raw accuracy misleading; practitioners therefore evaluate models with Macro-F1, per-class Precision-Recall AUC and confusion matrices. Furthermore, because raw neural network softmax scores and LLM self-reported confidences are often overconfident, temperature scaling or conformal prediction should be applied to calibrate the confidence thresholds that route borderline documents to human review.
Commonly confused terms
| Term | How it differs |
|---|---|
| Information extraction | Document classification assigns one or more predefined labels to an entire document, whereas information extraction locates and extracts structured fields (dates, invoice totals, entity names) from within the document. |
| Document clustering | Document clustering is an unsupervised task that groups documents by similarity without predefined labels, whereas document classification is supervised (or zero/few-shot) against a fixed taxonomy. |
| Document routing | Document routing/triage is the downstream workflow action that dispatches a file to a department or queue; document classification is the upstream ML/NLP prediction that supplies the category and confidence score driving that routing decision. |
Why document classification matters for on-premises AI
Organisations receive many documents daily, each needing to reach the right department, workflow and retention rule. Document classification speeds this routing, helps apply access rules by confidentiality level and lets the next extraction step pick the right schema. Misclassification can send a document to the wrong people, so critical categories need oversight. Running in-house keeps documents inside.
A municipality uses an in-house classifier to sort applications arriving by email and paper into categories such as zoning, permits, complaints and information requests; low-confidence ones go to an officer while the rest land directly in the relevant department's queue.
Common questions
How does document classification differ from information extraction?
Document classification decides what type a document is. Information extraction pulls fields such as dates, amounts and parties from inside it.
Does document classification need many labelled examples?
Classic methods and fine-tuning do. Large language models can start with a few examples, but accuracy should still be measured on your own documents.
Related terms
- Text classification
- Document parsing
- Information extraction
- Classification
- Term Frequency-Inverse Document Frequency
- Few-shot learning
Sources
- Sebastiani, Machine learning in automated text categorization, ACM Computing Surveys, 2002
- Manning, Raghavan and Schütze, Introduction to Information Retrieval, Cambridge University Press, 2008
In the glossary: Glossary, A to D