IP Library Granted Patent US 12,561,512
Granted Patent B2
US 12,561,512 · App. 18/491,370 · Granted Feb 24, 2026

Methods and systems for prompting large language model to generate formatted output

Inventors: Russ Maschmeyer (Berkeley, CA); David Goligorsky (Stockholm, SE); Daniel Beauchamp (Toronto, CA); Benjamin Michel (London, GB)
Assignee: SHOPIFY INC.
G06F40/106G06F40/169G06F40/205
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 12,561,512
App. No.
18/491,370
Granted
Feb 24, 2026
Kind
B2
Abstract

The present disclosure describes a technical solution that enables a trained large language model (LLM) to generate a revised text in a manner that enables the LLM to preserve formatting that was present in the original text. When a text-editing instruction is received for a text passage having a formatting tag, the text passage is processed to identify the formatting tag in the text passage. The LLM is prompted to generate a revised text passage, using a prompt that includes the text-editing instruction and that also includes a formatting-specific instruction to format the revised text passage using the formatting tag in the revised text passage. The revised text passage is received and caused to be displayed based on the formatting tag, such that the formatting of the original text is maintained.

Claims (85)

1 . A system comprising:

a processing unit configured to execute computer-readable instructions to cause the system to:

receive at least one text-editing instruction related to at least a portion of a text passage having at least one formatting tag;

process the text passage to identify the at least one formatting tag in the text passage, and to identify a category of a text related to the at least one formatting tag;

generate a formatting example by:

retrieving, from a text database, an example text belonging to the identified category; and

applying the at least one formatting tag to the example text;

generate a first prompt to a large language model (LLM) to generate a revised text passage, the first prompt including the text-editing instruction related to at least the portion of the text passage, the first prompt further including a formatting-specific instruction to format the revised text passage using the at least one formatting tag in the revised text passage, the formatting-specific instruction including the formatting example;

cause the LLM to generate the revised text passage, using the first prompt as input to the LLM;

receive the revised text passage generated based on the first prompt; and

cause the revised text passage to be displayed by causing rendering of the at least one formatting tag to the revised text passage.

2 . The system of claim 1 , wherein the processing unit is configured to execute instructions to further cause the system to:

provide, to a user device, a user interface (UI) for inputting the at least one text-editing instruction and the text passage having the at least one formatting tag;

wherein the at least one text-editing instruction and the text passage are received from the user device; and

wherein the revised text passage is outputted to the user device and the user device is caused to display the revised text passage via the UI.

3 . The system of claim 1 , wherein the processing unit is configured to execute computer-readable instructions to further cause the system to process the text passage by:

parsing the text passage to identify the at least one formatting tag;

wherein the formatting-specific instruction is included in the first prompt responsive to the at least one formatting tag being identified by the parsing.

4 . The system of claim 3 , wherein the processing unit is configured to execute computer-readable instructions to further cause the system to process the text passage by:

parsing the text passage to identify a formatting language of the at least one formatting tag;

wherein the formatting-specific instruction includes the identified formatting language.

5 . The system of claim 1 , wherein the processing unit is configured to execute computer-readable instructions to further cause the system to process the text passage by:

processing the text passage using trained classifier that has been trained to classify text formatting, the trained classifier outputting a class label identifying a formatting language of the at least one formatting tag;

wherein the formatting-specific instruction includes the identified formatting language.

6 . The system of claim 5 , wherein the trained classifier has been further trained to annotate formatting tags belonging to the identified formatting language, wherein the trained classifier further outputs an annotated text passage annotating the at least one formatting tag;

wherein the formatting-specific instruction further includes an instruction to format the revised text passage using the annotated at least one formatting tag in the revised text passage.

7 . The system of claim 1 , wherein the processing unit is configured to execute computer-readable instructions to further cause the system to process the text passage by:

generating a second prompt to the LLM including the text passage, the second prompt also including an instruction to cause the LLM to annotate the text passage to identify the at least one formatting tag;

wherein the formatting-specific instruction includes the annotated text passage and an instruction to format the revised text passage using the annotated at least one formatting tag in the revised text passage.

8 . A method comprising:

receiving at least one text-editing instruction related to at least a portion of a text passage having at least one formatting tag;

processing the text passage to identify the at least one formatting tag in the text passage, and to identify a category of a text related to the at least one formatting tag;

generating a formatting example by:

retrieving, from a text database, an example text belonging to the identified category; and

applying the at least one formatting tag to the example text;

generating a first prompt to a large language model (LLM) to generate a revised text passage, the first prompt including the text-editing instruction related to at least the portion of the text passage, the first prompt further including a formatting-specific instruction to format the revised text passage using the at least one formatting tag in the revised text passage, the formatting-specific instruction including the formatting example;

causing the LLM to generate the revised text passage, using the first prompt as input to the LLM;

receiving the revised text passage generated based on the first prompt; and

causing the revised text passage to be displayed by causing rendering of the at least one formatting tag to the revised text passage.

9 . The method of claim 8 , further comprising:

providing, to a user device, a user interface (UI) for inputting the at least one text-editing instruction and the text passage having the at least one formatting tag;

wherein the at least one text-editing instruction and the text passage are received from the user device; and

wherein the revised text passage is outputted to the user device and the user device is caused to display the revised text passage via the UI.

10 . The method of claim 8 , wherein processing the text passage comprises:

parsing the text passage to identify the at least one formatting tag;

wherein the formatting-specific instruction is included in the first prompt responsive to the at least one formatting tag being identified by the parsing.

11 . The method of claim 10 , wherein processing the text passage comprises:

parsing the text passage to identify a formatting language of the at least one formatting tag;

wherein the formatting-specific instruction includes the identified formatting language.

12 . The method of claim 8 , wherein processing the text passage comprises:

processing the text passage using trained classifier that has been trained to classify text formatting, the trained classifier outputting a class label identifying a formatting language of the at least one formatting tag;

wherein the formatting-specific instruction includes the identified formatting language.

13 . The method of claim 12 , wherein the trained classifier has been further trained to annotate formatting tags belonging to the identified formatting language, wherein the trained classifier further outputs an annotated text passage annotating the at least one formatting tag;

wherein the formatting-specific instruction further includes an instruction to format the revised text passage using the annotated at least one formatting tag in the revised text passage.

14 . The method of claim 8 , wherein processing the text passage comprises:

generating a second prompt to the LLM including the text passage, the second prompt also including an instruction to cause the LLM to annotate the text passage to identify the at least one formatting tag;

wherein the formatting-specific instruction includes the annotated text passage and an instruction to format the revised text passage using the annotated at least one formatting tag in the revised text passage.

15 . A non-transitory computer-readable medium storing instructions executable by a processing unit of a computing system to cause the system to:

receive at least one text-editing instruction related to at least a portion of a text passage having at least one formatting tag;

process the text passage to identify the at least one formatting tag in the text passage, and to identify a category of a text related to the at least one formatting tag;

generate a formatting example by:

retrieving, from a text database, an example text belonging to the identified category; and

applying the at least one formatting tag to the example text;

generate a first prompt to a large language model (LLM) to generate a revised text passage, the first prompt including the text-editing instruction related to at least the portion of the text passage, the first prompt further including a formatting-specific instruction to format the revised text passage using the at least one formatting tag in the revised text passage, the formatting-specific instruction including the formatting example;

cause the LLM to generate the revised text passage, using the first prompt as input to the LLM;

receive the revised text passage generated based on the first prompt; and

cause the revised text passage to be displayed by causing rendering of the at least one formatting tag to the revised text passage.

16 . The non-transitory computer-readable medium of claim 15 , wherein the instructions are executable to further cause the system to:

provide, to a user device, a user interface (UI) for inputting the at least one text-editing instruction and the text passage having the at least one formatting tag;

wherein the at least one text-editing instruction and the text passage are received from the user device; and

wherein the revised text passage is outputted to the user device and the user device is caused to display the revised text passage via the UI.

17 . The non-transitory computer-readable medium of claim 15 , wherein the instructions are executable to further cause the system to process the text passage by:

parsing the text passage to identify the at least one formatting tag;

wherein the formatting-specific instruction is included in the first prompt responsive to the at least one formatting tag being identified by the parsing.

18 . The non-transitory computer-readable medium of claim 17 , wherein the instructions are executable to further cause the system to process the text passage by:

parsing the text passage to identify a formatting language of the at least one formatting tag;

wherein the formatting-specific instruction includes the identified formatting language.

19 . The non-transitory computer-readable medium of claim 15 , wherein the instructions are executable to further cause the system to process the text passage by:

processing the text passage using trained classifier that has been trained to classify text formatting, the trained classifier outputting a class label identifying a formatting language of the at least one formatting tag;

wherein the formatting-specific instruction includes the identified formatting language.

20 . The non-transitory computer-readable medium of claim 19 , wherein the trained classifier has been further trained to annotate formatting tags belonging to the identified formatting language, wherein the trained classifier further outputs an annotated text passage annotating the at least one formatting tag;

wherein the formatting-specific instruction further includes an instruction to format the revised text passage using the annotated at least one formatting tag in the revised text passage.

21 . The non-transitory computer-readable medium of claim 15 , wherein the instructions are executable to further cause the system to process the text passage by:

generating a second prompt to the LLM including the text passage, the second prompt also including an instruction to cause the LLM to annotate the text passage to identify the at least one formatting tag;

wherein the formatting-specific instruction includes the annotated text passage and an instruction to format the revised text passage using the annotated at least one formatting tag in the revised text passage.

Assignments (10)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 19, 2024
From: SHOPIFY INTERNATIONAL LIMITED
To: SHOPIFY INC.
Reel/Frame 066185/0165 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 19, 2024
From: SHOPIFY (USA) INC.
To: SHOPIFY INC.
Reel/Frame 066185/0212 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 19, 2024
From: SHOPIFY UK LIMITED
To: SHOPIFY INTERNATIONAL LIMITED
Reel/Frame 066185/0007 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 19, 2024
From: SHOPIFY SWEDEN AB
To: SHOPIFY INTERNATIONAL LIMITED
Reel/Frame 066185/0086 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 18, 2024
From: SHOPIFY SWEDEN AB
To: SHOPIFY INTERNATIONAL LIMITED
Reel/Frame 066171/0349 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 18, 2024
From: SHOPIFY UK LIMITED
To: SHOPIFY INTERNATIONAL LIMITED
Reel/Frame 066171/0409 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 6, 2023
From: MASCHMEYER, RUSS
To: SHOPIFY (USA) INC.
Reel/Frame 065776/0494 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 6, 2023
From: BEAUCHAMP, DANIEL
To: SHOPIFY INC.
Reel/Frame 065776/0497 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 6, 2023
From: GOLIGORSKY, DAVID
To: SHOPIFY SWEDEN AB
Reel/Frame 065776/0531 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 6, 2023
From: MICHEL, BENJAMIN
To: SHOPIFY UK LIMITED
Reel/Frame 065776/0567 →
Continuity (3)
Provisional Application 63501841 · May 12, 2023
Provisional Application 63490103 · Mar 14, 2023
Related Publication 20240311546A1 · Sep 19, 2024
References Cited (13)
US 11481545B1 · Aviles · 2022 [cited by examiner]
US 20090265612A1 · Cheney · 2009 [cited by examiner]
US 20220036153A1 · O'Malia · 2022 [cited by examiner]
US 20220108079A1 · Roisman · 2022 [cited by examiner]
US 20220374608A1 · Shazeer · 2022 [cited by applicant]
US 20230289515A1 · Jayaraj Devadoss · 2023 [cited by examiner]
US 20240086051A1 · Ciminelli · 2024 [cited by examiner]
US 20240127617A1 · Amamou · 2024 [cited by applicant]
US 20240143698A1 · Shirwadkar · 2024 [cited by examiner]
Tomasz Mrozewski, “Adding title and heading tags to a Word document”, Sep. 24, 2021, OJS for YDJ , 3 pages https://pressbooks.library.yorku.ca/ojsforydj/chapter/adding-title-and-heading-tags-to-a-word-document/. [cited by examiner]
Wu, Tongshuang, et al., “Promptchainer: Chaining large language model prompts through visual programming.” CHI Conference on Human Factors in Computing Extended Abstracts. 2022, 10 pages. [cited by applicant]
Yuan, Ann, et al., “Wordcraft: story writing with large language models”, Proceedings of the 27th International Conference on Intelligent User Interfaces. 2022, 12 pages. [cited by applicant]
Canadian Intellectual Property Office, “International Search Report and Written Opinion” for International Application No. PCT/CA2023/051099 dated Nov. 20, 2023, 9 pages. [cited by applicant]