Each day, our client experiences revenue losses due to under-billing for the services it provides.
With each new contract signing, renewal, or amendment, the pricing details for each service offered, along with contract conditions, stipulations, and clauses, are manually entered into a billing system presenting a challenge to accuracy.
As services are executed in real-time, this billing system utilises the entered information to generate invoices. Being a substantial corporation serving numerous customers, any inadvertent human errors in this process pose a significant risk of revenue loss. Historically, identifying potential under-billing has relied on manual, labour-intensive methods, with inconsistent performance and limited scalability due to contractual complexities.
QuantSpark worked alongside the client to conduct a 6-week feasibility study to investigate whether a Generative AI powered solution could support the reconciliation of invoiced revenue to expected revenue. Our proof-of-concept solution is divided into three parts:
Transcription of contracts.
Extraction of relevant contract data and application to historical service data.
Comparing QuantSpark-generated invoices to our client’s historically issued invoices.
Full process diagram with all three parts of the solution
Our client supplied us with a subset of scanned contracts, each differing in quality, to extract billing information. While some scans were in pristine condition, others displayed blurry or misaligned elements. Moreover, aspects such as structure, colour scheme, font style, and size varied considerably, posing a challenge in formulating a uniform approach capable of accommodating these differences.
Our solution focused on two primary patterns in which information was presented in the contracts: tables and paragraph text. We fine-tuned an OCR model to segment the contracts into these two categories. Subsequently, we further refined a set of OCR models to transcribe the paragraph text and reconstruct the tables into a structured format suitable for database ingestion.
Finally, we assembled the transcribed document in its original sequence to yield a fully transcribed result. While our proof of concept predates multi-modal LLMs like GPT4 vision, our transition now to a minimum viable product will provide us with the opportunity to leverage cutting-edge technology, thereby optimising transcription quality.
With our transcribed documents in hand, we turned to LLMs to extract pertinent information from the contracts. The logic embedded in these contracts falls into two categories:
Prices for services, such as cleaning or refuelling services. These often reside within the tables of contracts, whose structures can differ greatly even within the same contract.
Contract stipulations, which encompass conditions and clauses detailing alterations to service prices in scenarios like cancellations or delays in service execution.
Deriving prices and rates for services from tables boils down to the art of ‘prompt engineering’. This process entails designing and refining input prompts to elicit desired responses from LLMs, thereby maximising the model's performance and relevance in generating text-based outputs.
Our approach involves providing the model with the contract's validity date, a summarised overview regarding the contents of a given table, the table itself, and a user query, such as “What is the rate for cleaning services?”.
This provides the LLM with enough context to accurately deliver its interpretation of the best and most up-to-date pricing for the desired service. To enhance its capability in handling common sense and complex reasoning tasks, we employed Chain of Thought Reasoning. This involves guiding the LLM to produce logically connected sequences of arguments within its response, ensuring consistency, relevance, and logical flow akin to human thinking patterns.
Having obtained the most up-to-date pricing for a given service, we semantically scanned the transcribed document for contract stipulations, including any conditions or clauses potentially impacting pricing. This process selects statements from the contracts most semantically akin to a set of examples provided to our scanner. Leveraging LLMs once again, we assess the relevance of these statements to the service in question and adjust the price accordingly.
Consider this example.
If there is a cancellation for cleaning services, the scanner would search for the most semantically similar statement in the contract to examples of cancellation clauses provided. Suppose it finds the following statement:
"Should the cleaning service be cancelled within 24 hours of the scheduled appointment time, the fee for the service shall be subject to doubling."
The LLM would then apply this statement to the most recent rate for cleaning services. For instance, if the regular rate for cleaning services were $60, the rate would be updated to $120.
Comparing QuantSpark’s generated invoices to those issued historically revealed and flagged discrepancies. These were then categorised by potential drivers for our client to review, including operational considerations such as missing contractual documents justifying price increases seen in some historically issued invoices.
Streamlined Process: Our solution streamlined the invoicing process by automating the labour-intensive task of manually inputting contract billing logic into our client’s billing system. By utilising OCR tools to transcribe scanned documents, we minimised manual effort and reduced time-consuming tasks. This enhancement significantly boosted operational efficiency and reduced the risk of human errors associated with manual data entry.
Improved Accuracy and Billing Efficiency: Our utilisation of Large Language Models (LLMs) to read and understand niche contract details for invoice generation contributed to improving billing accuracy. By extracting relevant contract data and applying it to historic service data, our proof of concept solution is poised to actively contribute to enhancing billing accuracy prior to invoices being sent out. This mitigates the risk of millions of dollars in revenue loss due to under-billing and therefore reinforces our client's financial stability by ensuring consistent and accurate invoicing practices.
Increased Scalability and Resilience: The implementation of our solution not only addressed existing data quality challenges but also positioned our client for greater scalability and resilience in managing contractual complexities. By automating processes traditionally reliant on manual intervention, we can facilitate quicker decision-making, ultimately contributing to improved business agility and competitiveness.