Skip to main content

Quick Overview

This video is the second episode in the Just a moment series produced by Google Cloud Tech, presented by Developer Advocate Laurent Picard. It demonstrates how to apply Google's Gemini multimodal models to identify changes between different formats of the same document.

Key Points

  • 1.Google's Gemini 3.8-flash can execute character-by-character comparisons between different formats of large documents.
  • 2.The demonstration compared a 96-page digital PDF against a 97-page scanned PDF version of an agreement.
  • 3.The multi-modal model successfully identified typo corrections, protocol number updates, monetary modifications, interest rate reductions, and signatory changes.
  • 4.The entire comparison consumed 102,867 input tokens and zero thinking tokens, averaging approximately 532 tokens per PDF page.
  • 5.The live processing completed the full comparative response in under 16 seconds.

Summary

The video demonstrates how to compare two disparate versions of a lengthy document using Google Cloud AI. Laurent Picard presents two versions of an agreement. Document v41 is a 96-page digital text PDF totaling 2 MB of text, while document v42 is a 97-page scanned PDF containing 48 MB of images. Across the two documents, amounting to almost 200 pages, the pagination and layout differ, making standard automated or manual comparison difficult.

To solve this, Picard sets up a notebook in Google Colab calling the generate_content API with Gemini 3.8-flash. The prompt specifies Document A and Document B, both retrieved from cloud storage bucket file URIs with the PDF mime type. The prompt directs the model to perform an exhaustive, character-by-character comparison from start to finish across every numbered paragraph, capturing single-character changes, punctuation, minor spelling corrections, and substantive text revisions, while outputting exact paragraph locations and bolded quotes for evidence.

Upon execution, tokenization finishes and the model begins streaming the response at 11 seconds, completing the analysis at 15.8 seconds. Gemini 3.8-flash successfully identifies specific discrepancies between the documents. It flags a corrected spelling of the word receivable, corrects another typographical error in the word pharmaceutical, and notes an updated protocol number from AB-CL-004 to AB-CL-005.

Substantive changes are also highlighted in the output. Gemini detects an increase in total funding figures from 60 million to 160 million dollars, an adjusted table cumulative total changing from 600 million to 700 million dollars, an interest rate decrease from twenty-five percent to twenty percent, and a signatory change on the signature block from Bob Brown to Alice Anderson.

The demonstration concludes with performance telemetry. The task consumed 102,867 input tokens, averaging roughly 532 tokens per PDF page across the 193 combined pages, with zero thinking tokens used. Picard highlights native multimodality as an effective way to inspect and compare mixed digital and scanned files live in seconds.

The Document Comparison Challenge

Laurent Picard introduces the difficulty of comparing two versions of a lengthy agreement: version 41, consisting of 96 pages of digital text PDF (2 MB), and version 42, which consists of 97 scanned image pages (48 MB). Because the pagination, layout, and document formats differ significantly, manual comparison across nearly 200 total pages presents a substantial challenge.

Executing Character-by-Character Analysis in Colab

Using Google Colab, a prompt is sent to Gemini 3.8-flash referencing both documents stored in a Google Cloud Storage bucket. The prompt instructs the model to carry out an exhaustive character-by-character comparison across every numbered paragraph, detecting single-character modifications, minor typos, spelling fixes, and substantive changes such as figures and names.

Analysis Results and Performance Metrics

The model streams back structured differences in under 16 seconds, noting typos, protocol updates, a 100 million dollar contract value increase, an interest rate adjustment, and an altered signatory. The entire operation processed 102,867 input tokens without requiring thinking tokens, demonstrating native multimodal capability on scanned and text documents.

The Bottom Line

The video establishes that Gemini 3.8-flash can natively compare large scanned image documents against clean digital PDFs to pinpoint minor typographic edits and substantive legal terms. It demonstrates prompt formatting and returns structured diff results in under 16 seconds using just over 100,000 input tokens. The presentation leaves unaddressed how this prompt behaves on lower-quality scans or complex multi-column layouts.

FAQ

What specific file formats and sizes were evaluated in the document comparison demo?

The demo compared version 41, which was a 96-page digital PDF containing 2 MB of text, against version 42, which was a 97-page scanned PDF containing 48 MB of images.

How long did Gemini 3.8-flash take to process and complete the document comparison?

The model started streaming the response at 11.0 seconds after the request was sent and fully completed the comparative analysis at 15.8 seconds.

How many total input tokens were required to compare both documents in Google Colab?

The process consumed 102,867 input tokens, averaging approximately 532 tokens per PDF page across the 193 total pages.

What types of discrepancies between the agreements did Gemini 3.8-flash detect during the test?

The model detected typo fixes, updated clinical protocol identifiers, a 100 million dollar financial increase, an interest rate change from 25 percent to 20 percent, and a replacement of the signatory name.

Worth watching for

Developers and data engineers looking to use Google's multimodal Gemini models to compare or diff large digital and scanned documents automatically.

  • gemini
  • google-cloud
  • document-comparison
  • multimodal-ai
  • pdf