Version-Based Filling

Upload previously filled documents — the AI extracts every field value, stores it per-field, and uses it to fill new versions automatically

Overview

The most common form-filling scenario in regulated industries is not filling a form for the first time — it is filling it again. Annual license renewals, updated CMS or USCIS form versions, amended contracts, recurring grant applications, and returning patient intake packets all share the same pattern: a prior completed document exists, a new version needs to be filled, and someone must manually compare the two and retype what hasn't changed.

Instafill.ai eliminates that step. Upload one or more previously completed documents — last year's filled application, an executed contract, a prior credentialing packet — and the system uses vision AI to identify exactly which value was entered into each field. Those values are stored per-field directly on the form template. When you run autofill on a new session for that form, fields with stored historical data switch automatically to example-based filling: the AI receives the stored values as few-shot examples and uses them — alongside any updated source documents — to populate the new version.

When a form template is replaced with a structurally identical new version (same fields, same layout, updated year or revision mark), stored examples transfer automatically. You don't re-upload your historical documents — the system recognizes the form as a version of the previous one by content hash and migrates all learned field data forward.

Key Capabilities

  • Vision-based field extraction from completed documents: The AI doesn't just read text from uploaded examples — it uses form page screenshots and page mapping to identify which specific value was entered into which specific field, distinguishing between a "policy number" field and a "group number" field that might contain similar-looking values on the same page
  • Per-field example storage with full metadata: Each extracted value is stored as a field example with the uploader, timestamp, and source document reference — a complete audit trail of where every carried-forward value came from
  • Automatic version inheritance: Forms with the same structural content hash inherit all stored examples when a new version is uploaded — zero manual migration work between form versions
  • Multiple examples per field: Upload several prior filled documents and each contributes examples — the AI averages expected value length and reasoning across all examples, producing more consistent output than a single reference
  • Automatic mode switching: During autofill, fields with stored examples automatically switch to an example-guided AI prompt path built for style and value replication
  • Asynchronous processing: Example document processing (POST /api/forms/{form_id}/add-examples) runs in the background — upload multiple historical PDFs and continue working while the AI extracts and indexes field values
  • Layered with live sources: Example-based filling complements, not replaces, real-time source documents — the AI uses historical values as the baseline and updates fields where the current source provides newer information

How Version-Based Filling Works

Step 1 — Upload Previously Filled Documents

Navigate to the form template in your Instafill.ai library and upload one or more completed versions of that form. These can be:

  • Last year's filled version of the same form
  • Multiple completed instances of the same form (different clients, different periods)
  • A completed version of a similar but structurally equivalent form

The form status moves to "In Progress" while the system processes the uploaded examples asynchronously. You can continue working in other sessions during this time.

Step 2 — AI Extracts Field Values Using Vision

For each uploaded document, the system processes the PDF:

  1. Page mapping: The system determines which pages in the uploaded example correspond to which pages in the current form template, even if the two documents are not identical page-for-page.
  2. Screenshot generation: Each form page is rendered as a screenshot with text fields visually highlighted.
  3. Vision AI extraction: The filled form's text content alongside the form page screenshot is sent to the AI, which identifies which value appears in which specific field — distinguishing visually between fields that contain similar data types (dates, names, ID numbers) based on field label, position, and context.
  4. Per-field storage: The extracted value is stored as a field example with the uploader email, timestamp, and source document reference. Multiple uploaded documents each contribute their own example entry per field, building a multi-example library for each field.

Step 3 — New Form Versions Inherit Stored Data Automatically

When a form template is replaced or re-uploaded with a new version, the system computes the content hash of the new form. If the hash matches an existing form (or is structurally close enough to trigger version recognition), all stored field examples are automatically copied from the previous version to the new one.

This means: upload the 2026 version of a USCIS form that previously had 2025 examples stored — the examples transfer automatically. No re-processing, no re-uploading historical documents.

Step 4 — Autofill Uses Historical Examples as Few-Shot References

When you start a new autofill session on a form with stored examples, the filling pipeline checks each field for the presence of field.examples. For fields where examples exist:

  • Example-guided filling activates instead of standard source-based autofill
  • A few-shot AI prompt is built that includes the stored example values
  • The system calculates the average word count across all examples for that field — guiding the AI on expected response length and density
  • Example values are appended to the prompt in sequence for the AI to reference
  • A specialized model configuration handles example-based fields — the style and format are established by the examples, so less inference is needed, and responses are faster

If you also attach current source documents to the session (a new insurance card, updated contact details, a revised scope of work), the AI uses the stored examples as the baseline and the live source data for fields where new information is available. The two mechanisms complement each other: history provides the stable context, current sources provide the updates.

Use Cases

Annual regulatory renewals: Professional license renewals, OSHA certification updates, DEA registrations, and state medical board renewals are filed on the same form each year — or on a new version of that form issued annually. Upload last year's completed renewal. The AI extracts every field value: license number, practice address, specialty codes, supervised hours, continuing education credits. Next year's renewal fills from those stored values, updated only for fields where the new source documents (new CE certificates, updated address) provide changed information.

USCIS and CMS form version updates: Federal agencies release updated form versions regularly — I-485, I-130, CMS-855, HCFA-1500 are revised periodically. Organizations that use these forms routinely accumulate completed prior-version PDFs. Upload the completed 2024 version; when the 2025 version is added to the form library, examples transfer automatically. The first session on the new version prefills from history — practitioners review and approve rather than restart from scratch.

Contract amendments and re-executions: When an executed contract needs amendment or re-execution with updated terms, the prior signed version is the primary reference. Uploading the executed original as an example means the new version — with updated effective dates, revised pricing, or amended scope — prefills party names, addresses, entity types, governing law, and boilerplate from the original. Only the changed terms need to be sourced from the amendment instruction document.

Recurring grant and proposal applications: Nonprofits and research institutions file similar grant applications each cycle. Organizational details, mission statements, program descriptions, and budget narratives are largely stable year-over-year. Uploading prior funded applications as examples means the AI replicates the phrasing and structure of prior successful narrative answers as a starting point — writers refine from a populated draft rather than a blank form.

Patient intake updates in healthcare: Medical practices refresh their intake forms periodically — adding new regulatory questions, updating consent language, renaming fields. Returning patients' prior intake forms contain their demographics, insurance, emergency contacts, and medical history. Uploading completed prior-version intakes as examples means the updated form version prefills returning patient data automatically. The patient reviews and updates only what has changed.

Insurance policy renewals: Policy renewal forms for commercial insurance, professional liability, and workers' compensation are largely identical year to year. Uploading the prior year's completed application means the renewal prefills from history: named insured, business description, coverage limits, location schedules, claim history narrative. Brokers review for accuracy and update only the current-year figures.

Real-World Examples: Law firms that file the same court forms for recurring client matters upload prior filings as examples — party names, case numbers, jurisdictions, and procedural posture fill automatically on new filings. Healthcare back-offices processing annual credentialing reappointments upload prior packets — license numbers, board certification dates, malpractice coverage limits, and DEA numbers carry forward without manual re-entry.

Benefits

  • Eliminate the "same form, next year" retyping cycle: Fields that haven't changed since last time don't need to be sourced, extracted, or typed — they prefill from history and the user confirms.
  • Zero migration work when form versions update: When a government agency or accreditation body releases a new form version, uploading it to Instafill.ai automatically inherits all stored examples from the prior version. No re-processing, no re-uploading historical documents.
  • Multiple historical references improve consistency: Storing examples from five prior completed forms gives the AI a broader basis for expected values than a single reference — the output reflects what your organization consistently fills, not just what one document happened to contain.
  • Audit trail for every carried-forward value: Each example records the source document, who uploaded it, and when — so if a field value is questioned, you can trace it back to the specific prior document it came from.
  • Faster sessions on recurring forms: Sessions on forms with stored examples complete faster because FILL_WITH_EXAMPLES mode requires lower reasoning effort — the style and format are established, the AI confirms and adapts rather than inferring from scratch.
  • Works alongside current sources: Stored historical data and current source documents work together. History fills what hasn't changed; current sources update what has. You don't choose between them.

Security & Privacy

Historical examples are stored and protected under the same security framework as all form and session data:

  • Workspace-scoped access: Stored field examples are accessible only within the workspace that uploaded the reference documents. JWT middleware enforces this at both the .NET and Python service layers — example data from one organization's forms cannot be accessed by another workspace.
  • Source document storage: Uploaded example PDFs are stored in Azure Blob Storage at a workspace-scoped path. The example_file field in each example record links to the stored source document URL, maintaining provenance without duplicating content.
  • Encryption: Example document content and extracted field values are encrypted with workspace-scoped keys managed in Azure Key Vault.
  • Access control on example uploads: Uploading example documents requires form-level edit permissions. Users without edit access to a form template cannot add or modify stored examples.
  • No cross-organization learning: Stored examples are never used to train models or inform filling in any other workspace. They are private to the form and workspace where they were added.
  • Retention policy applies: Example documents follow the workspace file retention policy. Organizations with strict data minimization requirements can configure automatic deletion of source example PDFs after processing, retaining only the extracted field values.

Common Questions

How does the AI know which field in the old document maps to which field in the new version?

The system uses vision AI to identify field-value relationships, not just text matching. For each page of the uploaded example document, the system sends:

  • The full text extracted from the filled page (what was entered)
  • A screenshot of the current form template page with field positions highlighted

The AI correlates the extracted text with the visual field layout of the current form template — identifying that "John Torres" in the example belongs to the "Applicant Full Name" field, not the "Employer Name" or "Emergency Contact" field on the same page. This visual-plus-semantic approach handles cases where field order changed between versions or where multiple fields on a page contain similar data types.

For documents with significant layout changes between versions, some fields may not map correctly. Review the prefilled results in the visual editor after the first session and correct any mismatches — corrections are saved as updated examples for subsequent sessions.

What happens when I upload a new version of a form that already has examples stored?

When you add a new version of a form template to your library, the system computes its structural hash. If the hash matches the previous version (same fields, same layout — even with minor cosmetic changes like updated year, revised header text, or regulatory revision dates), all stored field examples are automatically copied from the prior version to the new template.

If the new version has substantively different fields — added sections, removed fields, restructured layout — the hash won't match and examples don't transfer automatically. In this case, upload completed examples of the new version to rebuild the example library for the changed form structure. Fields that are structurally identical to the prior version can be manually mapped if needed.

Can I upload multiple prior completed documents as examples?

Yes — and doing so improves the quality of prefilled output. The system stores a separate example entry per field for each uploaded document. When autofilling, the AI receives all stored examples for a field and uses the full set to determine the most appropriate value.

The system calculates the average word count across all examples for each field — this guides expected response length. A field that contained "4 years" in one example and "three to four years" in another produces an AI output that respects the typical length and style of your historical responses.

Upload example documents one at a time or in a batch via the API. Processing is asynchronous — all uploads can be in-flight simultaneously.

Does example-based filling work differently from standard autofill?

Yes — fields with stored examples use a different AI mode than fields without. Standard autofill provides source document text and field context to the AI, which infers the appropriate value. Example-based filling provides the same source context plus the historical values as few-shot examples, asking the AI to match the established pattern.

The practical difference: for fields where the value is stable (license numbers, entity names, organization addresses, standard narrative language), example-based filling produces the stored value with high consistency. For fields where the value must update (effective dates, coverage amounts, current-year figures), the AI uses the live source document to override the historical example. The mode switch happens automatically per field based on the presence of stored examples.

Can I delete or update stored examples?

Yes — stored field examples can be managed through the form settings. Individual examples can be removed per field (for example, if an outdated value from a prior document is causing incorrect prefill) and new examples can be added at any time by uploading additional reference documents.

When you correct a field value in the visual editor during a session, that correction is also saved as an example, progressively improving prefill quality for that field across future sessions.

What if I only want some fields to prefill from history, not all?

The system operates at field granularity — only fields with stored examples use example-based filling. Fields without stored examples go through standard autofill from your current session's source documents. You do not need to configure this manually: if an example was extracted for a field, it is used; if not, the field fills from sources as usual.

If you want to prevent a specific field from using its stored historical value — for example, a date field that must reflect the current year rather than the prior year — delete the stored examples for that field. The next session will extract the date from the current source document instead.

Related Features

Ready to get started?

Start automating your form filling process today with Instafill.ai

Try Instafill.ai View Pricing