Documentation Index

Fetch the complete documentation index at: https://help.hyperscience.ai/llms.txt

Use this file to discover all available pages before exploring further.

Structured Document Classification

Prev Next

Classification models in Hyperscience

Classification models are a crucial part of document processing as they help the system determine which layout should be used to process each page you upload. In Hyperscience, we have two types of document classification:

  • Structured Document Classification - Automatically classifies documents that follow a consistent layout pattern (e.g., tax forms, standardized applications) by assigning them to the correct layout in Hyperscience. Once classified, the documents can proceed to the next step - Field Identification Task, Transcription Task, or Flexible Extraction, depending on your business logic.

  • Semi-structured Document Classification - Automatically classifies documents that don’t follow a consistent layout pattern (e.g., invoices, bank statements, etc.). To learn more, see Semi-structured Document Classification and TDM for Classification Models.

In this article, you’ll learn how to work with Structured Document Classification. Learn more about the Manual Classification  task in Document Classification Task.

Structured Document Classification

How it works

When a document is submitted to the system, it is first split into individual pages. Structured Document Classification then runs through the following steps:

  1. Visual Page Classifier (Visual Page Classifier (VPC)):

    • The system runs VPC, which returns layout page-level candidates for each submission page. At this stage, only candidates are proposed, not full documents.

      • For every page, the VPC produces a list of possible layout matches, ranked by confidence. To learn more about Structured layouts, see Creating Structured Layouts.

        • Example: Submission page 1 may match layout page 1 of Layout A; submission page 2 may match layout page 2 of Layout A, etc.

  2. Distribute to Forms:

    • Using the list of candidates generated from the VPC, the system attempts to group pages into complete documents.

    • The goal is to minimize the number of documents while maximizing confidence scores across all pages.

    • Pages that fail to align with any layout at this stage are passed to Semi-structured classification (Non-Structured Layout Classifier (NLC)). To learn more, see Semi-structured Document Classification.

  3. Registration:

    • For each proposed distribution, the system runs a Registration step to validate the page-to-layout matches.

      • If confidence for all candidates is above the acceptance threshold (e.g., >0.6), the document is accepted.

      • If one or more candidates are rejected, the system re-runs Distribute to Forms with alternative matches.

  4. Re-distribution & Finalization:

    • The Distribution - Registration cycle runs up to three times:

      • First attempt: Initial grouping of candidates.

      • Second attempt: Re-distribution if a candidate is rejected.

      • Third attempt: Final re-distribution.

    • If all candidates are successfully registered, the current distribution is finalized and used.

    • If some candidates are rejected, the system generates a new distribution and retries registration.

    • If none of the attempts result in a fully valid distribution, the system returns the best-scoring distribution from the three tries.

    • This process repeats up to 3 times.

  5. Manual Review:

    • Any pages that fail to classify after these steps are marked as No Layout Found and routed to Semi-structured Classification. Depending on your flows settings and your use case, these can be handled via Document Classification Supervision Task.To learn more, see Semi-structured Document Classification.

Blank Pages

If a page contains very little text, VPC may match it as blank and will not attempt to classify it to a layout.

Structured Layout Match Threshold

The Structured Layout Match Threshold defines the minimum confidence score required for a page to be automatically matched to a Structured layout.

  • The default threshold is 0.6, but it can be adjusted to fit your use case.

  • Lowering the threshold may increase the risk of incorrect matches.

Layout Matching Confidence

Confidence in layout matching directly affects the accuracy. The more confident the system is in its layout match, the more reliable the extracted data will be. To learn more, see our Accuracy article.

Contact your Hyperscience representative to determine the best threshold for your use case.

Expand the sections below to learn more about the Structured document classification settings and layout identifiers.

Structured Document Classification Settings

Before you start, configure Structured document classification behavior in your flow.

  • Enable Manual Classification Supervision to use the Document Classification task, as described in Document Processing Subflow Settings.

  • Structured Layout Match Threshold

    • This threshold controls whether a Structured page is matched to a layout.

      • Pages with confidence below the threshold are sent to Document Classification or marked as No Layout Variation Found.

      • Pages with a confidence score above the threshold are automatically assigned to a layout.

  • Validate Classification Using Layout ID - Enabling this setting allows Structured documents to be matched using a layout identifier. When this setting is enabled, the system checks for a matching layout identifier in the document.

  • Bypass Validation if Layout ID is Missing - This setting should be enabled when certain layouts do not contain a layout identifier.

Learn more about these settings in the Classification section of our Document Processing Subflow Settings article.

Layout Identifiers

Classifying Variations

Some layouts can look almost identical, with only minor visual differences. To avoid misclassification in these cases, you can create layout variations. Each variation represents a small difference in the layout’s pattern, while still belonging to the same overall layout group. Learn more in Adding a Variation to a Layout.

Layout Identifiers

Even with variations, the system may sometimes classify incorrectly. To improve accuracy, Hyperscience can use Layout identifiers to force the correct match.

  • If the identifier in the document matches the expected ID in a layout variation, the system will classify the document to that variation, regardless of the confidence score.

  • If the identifier does not match, the document is routed either to Document Classification Task or to Document Drift Management (Layout Triage), depending on your flow settings:

Using Layout Identifiers

  1. Go to Library > Layouts.

  2. Find the layout to which you want to add a layout ID, and click on its name.

  3. Find the variation to which you want to add a Layout ID, and click on its name.

  4. Click Fields in the toolbar, and then click Layout IDs.

  5. Click and drag to draw bounding boxes around each layout ID.

    • Once you draw a box, the machine will read and transcribe the value inside it.

      • Any incorrect transcriptions can be edited in the field list.

  6. When you’re finished making changes to the variation, do one of the following:

    • If you’re ready to apply your changes to the variation, click Commit Changes and save it as a new version. Learn more in Editing and Finalizing a Layout Version.

    • If you’re not ready to apply your changes, click the X button in the upper-right corner of the page.

Layout Identifiers Best Practices

The following best practices for using layout identifiers will ensure the highest levels of accuracy for the classification of Structured documents.

  • Use unique text at the top or the bottom of the page as a layout identifier.

    • The ideal layout identifier is a piece of unique text placed at the top or bottom of a page. Many documents include layout-specific versions, dates, or other identifiers in these areas. Using such identifiers helps reduce errors and improve the accuracy of matching pages to Structured layouts.

  • If no unique text appears at the top or bottom of the page, use another piece of variation-specific text elsewhere.

    • If no identifier is available at the top or bottom of the page, look for unique text within the document that appears only in a specific variation. For example, a clause included in just one variation can serve as a distinguishing factor. Using this text as a layout identifier helps the system correctly classify that variation.

  • Add only the layout identifiers required to tell similar layouts apart.

    • Each layout page should have only one identifier. In rare cases where multiple layouts share the same identifier, you can add a second one to distinguish between them. Avoid adding extra identifiers, as they reduce matching accuracy.

    • Structured layouts are limited to two identifiers. If you try to add more, the system displays a warning message.

  • Keep the number of layout identifiers consistent across all variations of the same layout.

    • If a layout has multiple variations, use the same number of identifiers across all of them. Otherwise, variations with more identifiers will receive a higher confidence boost, which may cause the wrong layout to be matched.