IP Library Granted Patent US 12688376
Granted Patent B1
US 12688376 · App. 19/346,408 · Granted Jul 21, 2026

Processing complex data structures with language models

Inventor: John Samuel (Banglore, IN)
Assignee: Intuit Inc.
G06F40/40
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12688376
App. No.
19/346,408
Granted
Jul 21, 2026
Kind
B1
Abstract

A method including receiving a complex data structure including a combination of text and an arithmetic function. A normalized data structure is generated by normalizing the complex data structure against a static data structure schema. A numerical solver processes the arithmetic function to generate a function output. A prompt is generated by embedding the function output and the normalized data structure into a template prompt. The template prompt includes a first command to a language model to identify a contextual error in the normalized data structure. The template prompt also includes a context that defines a constraint applicable to the complex data structure. The template prompt also includes a second command to generate a model output formatted according to the static data structure schema. The model output includes the contextual error. The model output is generated by processing the prompt with the language model. The model output is returned.

Claims (108)

1 . A method for reducing hallucination in a language model processing a complex data structure, the method comprising:

receiving the complex data structure, wherein:

the complex data structure comprises a combination of text and an arithmetic function,

the arithmetic function comprises computer-executable code, and

the complex data structure is stored in a non-transitory computer readable storage medium;

generating a normalized data structure by normalizing the complex data structure against a static data structure schema by:

comparing the complex data structure to the static data structure schema to identify a difference in schemas therebetween, and

modifying the complex data structure to remove the difference so that the complex data structure conforms to the static data structure schema;

processing, with a numerical solver, the arithmetic function of the normalized data structure to generate a function output;

generating a prompt by embedding the function output and the normalized data structure into a template prompt, wherein the template prompt comprises:

a first command to the language model to identify a contextual error in the normalized data structure, and

a context that defines a constraint applicable to the complex data structure, and

a second command to generate a model output formatted according to the static data structure schema, wherein the model output includes the contextual error;

generating the model output by processing the prompt with the language model; and

returning the model output.

2 . The method of claim 1 , wherein receiving the complex data structure comprises the text being represented by a hash, wherein the static data structure schema comprises a structured language data structure, and wherein the method further comprises:

validating, prior to generating the normalized data structure, the structured language data structure against the static data structure schema; and

identifying, responsive to validating, that the complex data structure includes an error in at least one of the arithmetic function and a field in the complex data structure; and

wherein generating the normalized data structure further comprises:

correcting the error in the complex data structure; and

replacing the hash with the text.

3 . The method of claim 1 , further comprising:

transforming, prior to generating the normalized data structure, the complex data structure into a structured language data structure comprising the text and the arithmetic function.

4 . The method of claim 1 , wherein the prompt further comprises a third command to the language model to output only a compliance object.

5 . The method of claim 1 , wherein prompt further comprises a third command requiring the language model to follow exactly a predetermined grammar structure.

6 . The method of claim 1 , wherein the prompt further comprises a context defining a grammar required by both the normalized data structure and the model output.

7 . The method of claim 1 , further comprising:

training, prior to receiving the complex data structure, the language model on examples of the normalized data structure.

8 . The method of claim 1 , wherein returning comprises:

converting the model output to natural language text; and

returning the natural language text to a user device.

9 . The method of claim 8 , wherein returning further comprises:

identifying, in the context, a text rule violated by the contextual error; and

returning the text rule to the user device.

10 . The method of claim 1 , wherein returning further comprises:

identifying, with a deterministic algorithm and in the normalized data structure, a numerical error associated with the arithmetic function;

converting the model output to natural language text;

identifying, in the context, a text rule violated by the contextual error; and

returning, to a user device, a combination of the numerical error, the natural language text, and the text rule.

11 . A system for reducing hallucination in a language model processing a complex data structure, the system comprising:

a computer processor;

a data repository in communication with the computer processor and storing:

the complex data structure, wherein:

the complex data structure comprises a computer readable data structure having a combination of text and an arithmetic function, and

the arithmetic function comprises computer-executable code,

a normalized data structure,

a static data structure schema,

a function output,

a contextual error,

a context that defines a constraint applicable to the complex data structure,

a model output formatted according to the static data structure schema and including the contextual error,

a template prompt, and

a prompt comprising:

a first command to the language model to identify the contextual error in the normalized data structure, and

the context, and

a second command to generate the model output;

a language model executable by the computer processor to:

generate the model output by processing the prompt;

a deterministic algorithm executable by the computer processor to:

process the arithmetic function of the normalized data structure to generate the function output; and

a server controller executable by the computer processor to:

receive the complex data structure,

generate the normalized data structure by normalizing the complex data structure against the static data structure schema by:

comparing the complex data structure to the static data structure schema to identify a difference in schemas therebetween, and

modifying the complex data structure to remove the difference so that the complex data structure conforms to the static data structure schema,

generate the prompt by embedding the function output and the normalized data structure into the template prompt, and

return the model output.

12 . The system of claim 11 , wherein receiving the complex data structure comprises the text being represented by a hash, wherein the static data structure schema comprises a structured language data structure, and wherein the server controller is further executable by the computer processor to:

validate, prior to generating the normalized data structure, the structured language data structure against the static data structure schema; and

identify, responsive to validating, that the complex data structure includes an error in at least one of the arithmetic function and a field in the complex data structure; and

wherein generating the normalized data structure further comprises:

correcting the error in the complex data structure; and

replacing, prior to generating the normalized data structure, the hash with the text.

13 . The system of claim 11 , wherein the server controller is further executable by the computer processor to:

transform, prior to generating the normalized data structure, the complex data structure into a structured language data structure comprising the text and the arithmetic function.

14 . The system of claim 11 , wherein the prompt further comprises a third command to the language model to output only a compliance object.

15 . The system of claim 11 , wherein prompt further comprises a third command requiring the language model to follow exactly a predetermined grammar structure.

16 . The system of claim 11 , wherein the prompt further comprises a context defining a grammar required by both the normalized data structure and the model output.

17 . The system of claim 11 , further comprising:

a training controller executable by the computer processor to training, prior to receiving the complex data structure, the language model on examples of the normalized data structure.

18 . The system of claim 11 , wherein the server controller is further executable by the computer processor to further return the model output by:

converting the model output to natural language text; and

returning the natural language text to a user device.

19 . The system of claim 18 , wherein the server controller is further executable by the computer processor to further return the model output by:

identifying, in the context, a text rule violated by the contextual error; and

returning the text rule to the user device.

20 . A method for reducing hallucination in a language model processing a complex data structure, the method comprising:

receiving the complex data structure, wherein:

the complex data structure comprises a combination of text and an arithmetic function,

the arithmetic function comprises computer-executable code, and

the complex data structure is stored in a non-transitory computer readable storage medium;

generating a normalized data structure by normalizing the complex data structure against a static data structure schema by:

comparing the complex data structure to the static data structure schema to identify a difference in schemas therebetween, and

modifying the complex data structure to remove the difference so that the complex data structure conforms to the static data structure schema;

processing, with a deterministic algorithm, the arithmetic function of the normalized data structure to generate a function output;

identifying, with the deterministic algorithm and in the normalized data structure, a numerical error associated with the arithmetic function;

generating a prompt by embedding the function output and the normalized data structure into a template prompt, wherein the template prompt comprises:

a first command to the language model to identify a contextual error in the normalized data structure, and

a context that defines a constraint applicable to the complex data structure, and

a second command to generate a model output formatted according to the static data structure schema, wherein the model output includes the contextual error;

generating the model output by processing the prompt with the language model;

returning the model output;

converting model output to natural language text;

identifying, in the context, a text rule violated by the contextual error;

returning, to a user device, a combination of the numerical error, the natural language text, and the text rule;

receiving, responsive to returning, a correction to the complex data structure;

updating the complex data structure to an updated data structure; and

returning the updated data structure.