ABSTRACT
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.
Description
CROSS-REFERENCE TO RELATED APPLICATIONS
The present disclosure claims priority from U.S. provisional patent application No. 63/490,103, filed Mar. 14, 2023, entitled âMETHODS AND SYSTEMS FOR PROMPTING LARGE LANGUAGE MODEL TO GENERATE FORMATTED OUTPUTâ; and U.S. provisional patent application No. 63/501,841, filed May 12, 2023, entitled âMETHODS AND SYSTEMS FOR PROMPTING LARGE LANGUAGE MODEL TO GENERATE FORMATTED OUTPUTâ; the entireties of which are all hereby incorporated by reference.
FIELD
The present disclosure relates to machine learning, and, more particularly, to generation of prompts to large language models (LLMs), and, yet more particularly, to prompting an LLM to process a formatted input to generate a formatted output.
BACKGROUND
A large language model (LLM) is a type of machine learning (ML) model that is capable of generating text output, including natural language text output. A LLM may be provided with a prompt, which may be a natural language instruction that instructs the LLM to generate a desired output, including natural language text or other generative output.
SUMMARY
Online services for revising a block of text are provided. Some such services employ machine learning (ML). In some existing ML-based services for revising an inputted block of text, the user is typically limited to inputting text without any formatting (e.g., without formatting tags such as HTML tags, Markdown tags, etc.) and the revised text is similarly unformatted. However, in many situations the user might wish to revise a block of formatted text. Existing ML-based services that fail to recognize formatting in the text can result in inadvertently destroying the desired formatting when the revised text is generated.
For example, if the original text is formatted as a list, an existing ML-based service may erroneously consider the formatting tags for the list to be part of the text to be revised. As a result, the generated revised text may inadvertently rewrite the formatting tags for the list format and the revised text would no longer be formatted as a list. In another example, if the original text is formatted as a table having specific column labels, the existing ML-based service may inadvertently revise the column labels thus changing the meaning of the table in the revised text.
Workarounds, such as the user manually extracting only the unformatted portion of text to send to the ML-based service for revision can be tedious and/or may have worse performance due to loss of contextual information. Additionally, such workarounds may not be able to generate additional text that has similar formatting.
In various examples, the present disclosure describes a technical solution that enables a trained LLM to generate a revised text in a manner that enables the LLM to preserve formatting that was present in the original text. Examples of the present disclosure provide a technical solution for automatically identifying a formatting tag in the original text and to generate a prompt that includes a formatting-specific instruction related to the identified formatting tag. This provides a technical advantage by enabling the LLM to maintain the formatting of the original text.
Another technical advantage is that by enabling formatted text and/or formatting information to be included in the prompt, the overall performance of the LLM may be improved (e.g., the LLM may generate revised text that is more relevant and/or cohesive).
User interactions may also be improved because the user may not need to manually add or remove formatting tags in the original text or in the generated revised text. Additionally, the user may not even need to be aware of the formatting language (e.g., HTML, Markdown, LaTex, etc.) used in the original text, thus making the process of revising the text more intuitive and transparent to the user.
In some examples, the present disclosure provides a text-editing user interface (UI). The UI may enable the user to provide a text-editing instruction to generate a revised text from an inputted text passage having at least one formatting tag. The UI may also enable the revised text to be displayed with formatting.
In various examples, the present disclosure describes a technical solution that may be provided by an online platform (e.g., a Software as a Service (SaaS) platform). The platform may serve as an interface layer between a user device and the LLM, to improve accessibility to the LLM. In some examples, the platform may use an application programming interface (API) to access the LLM.
In an example aspect, the present disclosure describes a system including 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; generate a prompt to a large language model (LLM) to generate a revised text passage, the prompt including the text-editing instruction related to at least the portion of the text passage, the 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; receive the revised text passage generated based on the prompt; and cause the revised text passage to be displayed based on the formatting tag.
In an example of the example preceding system, the processing unit may be 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.
In an example of any of the example preceding systems, the processing unit may be 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 prompt responsive to the at least one formatting tag being identified by the parsing.
In an example of the example preceding system, the processing unit may be 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.
In an example of the example preceding system, the processing unit may be 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.
In an example of the example preceding system, the trained classifier may have 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.
In an example of any of the example preceding systems, the processing unit may be configured to execute computer-readable instructions to further cause the system to process the text passage by: generating a processing prompt to the LLM including the text passage, the 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.
In an example of any of the example preceding systems, the processing unit may be configured to execute computer-readable instructions to further cause the system to: process the text passage by parsing the text passage to identify a category of a text related to the at least one formatting tag; generate a formatting example to include in the prompt 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; wherein the formatting-specific instruction includes the formatting example.
In another example aspect, the present disclosure describes a method including: 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; generating a prompt to a large language model (LLM) to generate a revised text passage, the prompt including the text-editing instruction related to at least the portion of the text passage, the 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; receiving the revised text passage generated based on the prompt; and causing the revised text passage to be displayed based on the formatting tag.
In an example of the example preceding method, the method may further include: 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.
In an example of any of the example preceding methods, processing the text passage may include: parsing the text passage to identify the at least one formatting tag; wherein the formatting-specific instruction is included in the prompt responsive to the at least one formatting tag being identified by the parsing.
In an example of the example preceding method, processing the text passage may include: 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.
In an example of any of the example preceding methods, processing the text passage may include: 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.
In an example of the example preceding method, the trained classifier may have 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.
In an example of any of the example preceding methods, processing the text passage may include: generating a processing prompt to the LLM including the text passage, the 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.
In an example of any of the example preceding methods, the method may include: processing the text passage by parsing the text passage to identify a category of a text related to the at least one formatting tag; generating a formatting example to include in the prompt 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; wherein the formatting-specific instruction includes the formatting example.
In another example aspect, the present disclosure describes 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; generate a prompt to a large language model (LLM) to generate a revised text passage, the prompt including the text-editing instruction related to at least the portion of the text passage, the 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; receive the revised text passage generated based on the prompt; and cause the revised text passage to be displayed based on the formatting tag.
In an example of the example preceding non-transitory computer-readable medium, the instructions may be 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.
In an example of any of the example preceding non-transitory computer-readable media, the instructions may be 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 prompt responsive to the at least one formatting tag being identified by the parsing.
In an example of the example preceding non-transitory computer-readable medium, the instructions may be 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.
In an example of any of the example preceding non-transitory computer-readable media, the instructions may be 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.
In an example of the example preceding non-transitory computer-readable medium, the trained classifier may have 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.
In an example of any of the example preceding non-transitory computer-readable media, the instructions may be executable to further cause the system to process the text passage by: generating a processing prompt to the LLM including the text passage,
CROSS-REFERENCE TO RELATED APPLICATIONS
The present disclosure claims priority from U.S. provisional patent application No. 63/490,103, filed Mar. 14, 2023, entitled âMETHODS AND SYSTEMS FOR PROMPTING LARGE LANGUAGE MODEL TO GENERATE FORMATTED OUTPUTâ; and U.S. provisional patent application No. 63/501,841, filed May 12, 2023, entitled âMETHODS AND SYSTEMS FOR PROMPTING LARGE LANGUAGE MODEL TO GENERATE FORMATTED OUTPUTâ; the entireties of which are all hereby incorporated by reference.
FIELD
The present disclosure relates to machine learning, and, more particularly, to generation of prompts to large language models (LLMs), and, yet more particularly, to prompting an LLM to process a formatted input to generate a formatted output.
BACKGROUND
A large language model (LLM) is a type of machine learning (ML) model that is capable of generating text output, including natural language text output. A LLM may be provided with a prompt, which may be a natural language instruction that instructs the LLM to generate a desired output, including natural language text or other generative output.
SUMMARY
Online services for revising a block of text are provided. Some such services employ machine learning (ML). In some existing ML-based services for revising an inputted block of text, the user is typically limited to inputting text without any formatting (e.g., without formatting tags such as HTML tags, Markdown tags, etc.) and the revised text is similarly unformatted. However, in many situations the user might wish to revise a block of formatted text. Existing ML-based services that fail to recognize formatting in the text can result in inadvertently destroying the desired formatting when the revised text is generated.
For example, if the original text is formatted as a list, an existing ML-based service may erroneously consider the formatting tags for the list to be part of the text to be revised. As a result, the generated revised text may inadvertently rewrite the formatting tags for the list format and the revised text would no longer be formatted as a list. In another example, if the original text is formatted as a table having specific column labels, the existing ML-based service may inadvertently revise the column labels thus changing the meaning of the table in the revised text.
Workarounds, such as the user manually extracting only the unformatted portion of text to send to the ML-based service for revision can be tedious and/or may have worse performance due to loss of contextual information. Additionally, such workarounds may not be able to generate additional text that has similar formatting.
In various examples, the present disclosure describes a technical solution that enables a trained LLM to generate a revised text in a manner that enables the LLM to preserve formatting that was present in the original text. Examples of the present disclosure provide a technical solution for automatically identifying a formatting tag in the original text and to generate a prompt that includes a formatting-specific instruction related to the identified formatting tag. This provides a technical advantage by enabling the LLM to maintain the formatting of the original text.
Another technical advantage is that by enabling formatted text and/or formatting information to be included in the prompt, the overall performance of the LLM may be improved (e.g., the LLM may generate revised text that is more relevant and/or cohesive).
User interactions may also be improved because the user may not need to manually add or remove formatting tags in the original text or in the generated revised text. Additionally, the user may not even need to be aware of the formatting language (e.g., HTML, Markdown, LaTex, etc.) used in the original text, thus making the process of revising the text more intuitive and transparent to the user.
In some examples, the present disclosure provides a text-editing user interface (UI). The UI may enable the user to provide a text-editing instruction to generate a revised text from an inputted text passage having at least one formatting tag. The UI may also enable the revised text to be displayed with formatting.
In various examples, the present disclosure describes a technical solution that may be provided by an online platform (e.g., a Software as a Service (SaaS) platform). The platform may serve as an interface layer between a user device and the LLM, to improve accessibility to the LLM. In some examples, the platform may use an application programming interface (API) to access the LLM.
In an example aspect, the present disclosure describes a system including 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; generate a prompt to a large language model (LLM) to generate a revised text passage, the prompt including the text-editing instruction related to at least the portion of the text passage, the 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; receive the revised text passage generated based on the prompt; and cause the revised text passage to be displayed based on the formatting tag.
In an example of the example preceding system, the processing unit may be 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.
In an example of any of the example preceding systems, the processing unit may be 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 prompt responsive to the at least one formatting tag being identified by the parsing.
In an example of the example preceding system, the processing unit may be 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.
In an example of the example preceding system, the processing unit may be 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.
In an example of the example preceding system, the trained classifier may have 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.
In an example of any of the example preceding systems, the processing unit may be configured to execute computer-readable instructions to further cause the system to process the text passage by: generating a processing prompt to the LLM including the text passage, the 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.
In an example of any of the example preceding systems, the processing unit may be configured to execute computer-readable instructions to further cause the system to: process the text passage by parsing the text passage to identify a category of a text related to the at least one formatting tag; generate a formatting example to include in the prompt 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; wherein the formatting-specific instruction includes the formatting example.
In another example aspect, the present disclosure describes a method including: 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; generating a prompt to a large language model (LLM) to generate a revised text passage, the prompt including the text-editing instruction related to at least the portion of the text passage, the 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; receiving the revised text passage generated based on the prompt; and causing the revised text passage to be displayed based on the formatting tag.
In an example of the example preceding method, the method may further include: 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.
In an example of any of the example preceding methods, processing the text passage may include: parsing the text passage to identify the at least one formatting tag; wherein the formatting-specific instruction is included in the prompt responsive to the at least one formatting tag being identified by the parsing.
In an example of the example preceding method, processing the text passage may include: 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.
In an example of any of the example preceding methods, processing the text passage may include: 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.
In an example of the example preceding method, the trained classifier may have 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.
In an example of any of the example preceding methods, processing the text passage may include: generating a processing prompt to the LLM including the text passage, the 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.
In an example of any of the example preceding methods, the method may include: processing the text passage by parsing the text passage to identify a category of a text related to the at least one formatting tag; generating a formatting example to include in the prompt 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; wherein the formatting-specific instruction includes the formatting example.
In another example aspect, the present disclosure describes 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; generate a prompt to a large language model (LLM) to generate a revised text passage, the prompt including the text-editing instruction related to at least the portion of the text passage, the 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; receive the revised text passage generated based on the prompt; and cause the revised text passage to be displayed based on the formatting tag.
In an example of the example preceding non-transitory computer-readable medium, the instructions may be 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.
In an example of any of the example preceding non-transitory computer-readable media, the instructions may be 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 prompt responsive to the at least one formatting tag being identified by the parsing.
In an example of the example preceding non-transitory computer-readable medium, the instructions may be 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.
In an example of any of the example preceding non-transitory computer-readable media, the instructions may be 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.
In an example of the example preceding non-transitory computer-readable medium, the trained classifier may have 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.
In an example of any of the example preceding non-transitory computer-readable media, the instructions may be executable to further cause the system to process the text passage by: generating a processing prompt to the LLM including the text passage, the 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.
In an example of any of the example preceding non-transitory computer-readable media, the instructions may be executable to further cause the system to: process the text passage by parsing the text passage to identify a category of a text related to the at least one formatting tag; generate a formatting example to include in the prompt 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; wherein the formatting-specific instruction includes the formatting example.
BRIEF DESCRIPTION OF THE DRAWINGS
Reference will now be made, by way of example, to the accompanying drawings which show example embodiments of the present application, and in which:
FIG. 1 A is a block diagram of a simplified convolutional neural network, which may be used in examples of the present disclosure;
FIG. 1 B is a block diagram of a simplified transformer neural network, which may be used in examples of the present disclosure;
FIG. 2 is a block diagram of an example computing system, which may be used to implement examples of the present disclosure;
FIGS. 3 A and 3 B illustrate examples of a text-editing UI that may be provided in accordance with examples of the present disclosure;
FIG. 4 is a flowchart illustrating an example method for prompting a LLM, in accordance with examples of the present disclosure;
FIG. 5 is a block diagram of an example e-commerce platform, which may be an example implementation of the examples disclosed herein; and
FIG. 6 is an example homepage of an administrator, which may be accessed via the e-commerce platform of FIG. 5 .
Similar reference numerals may have been used in different figures to denote similar components.
DETAILED DESCRIPTION
To assist in understanding the present disclosure, some concepts relevant to neural networks and machine learning (ML) are first discussed.
Generally, a neural network comprises a number of computation units (sometimes referred to as âneuronsâ). Each neuron receives an input value and applies a function to the input to generate an output value. The function typically includes a parameter (also referred to as a âweightâ) whose value is learned through the process of training. A plurality of neurons may be organized into a neural network layer (or simply âlayerâ) and there may be multiple such layers in a neural network. The output of one layer may be provided as input to a subsequent layer. Thus, input to a neural network may be processed through a succession of layers until an output of the neural network is generated by a final layer. This is a simplistic discussion of neural networks and there may be more complex neural network designs that include feedback connections, skip connections, and/or other such possible connections between neurons and/or layers, which need not be discussed in detail here.
A deep neural network (DNN) is a type of neural network having multiple layers and/or a large number of neurons. The term DNN may encompass any neural network having multiple layers, including convolutional neural networks (CNNs), recurrent neural networks (RNNs), and multilayer perceptrons (MLPs), among others.
DNNs are often used as ML-based models for modeling complex behaviors (e.g., human language, image recognition, object classification, etc.) in order to improve accuracy of outputs (e.g., more accurate predictions) such as, for example, as compared with models with fewer layers. In the present disclosure, the term âML-based modelâ or more simply âML modelâ may be understood to refer to a DNN. Training a ML model refers to a process of learning the values of the parameters (or weights) of the neurons in the layers such that the ML model is able to model the target behavior to a desired degree of accuracy. Training typically requires the use of a training dataset, which is a set of data that is relevant to the target behavior of the ML model. For example, to train a ML model that is intended to model human language (also referred to as a language model), the training dataset may be a collection of text documents, referred to as a text corpus (or simply referred to as a corpus). The corpus may represent a language domain (e.g., a single language), a subject domain (e.g., scientific papers), and/or may encompass another domain or domains, be they larger or smaller than a single language or subject domain. For example, a relatively large, multilingual and non-subject-specific corpus may be created by extracting text from online webpages and/or publicly available social media posts. In another example, to train a ML model that is intended to classify images, the training dataset may be a collection of images. Training data may be annotated with ground truth labels (e.g. each data entry in the training dataset may be paired with a label), or may be unlabeled.
Training a ML model generally involves inputting into an ML model (e.g. an untrained ML model) training data to be processed by the ML model, processing the training data using the ML model, collecting the output generated by the ML model (e.g. based on the inputted training data), and comparing the output to a desired set of target values. If the training data is labeled, the desired target values may be, e.g., the ground truth labels of the training data. If the training data is unlabeled, the desired target value may be a reconstructed (or otherwise processed) version of the corresponding ML model input (e.g., in the case of an autoencoder), or may be a measure of some target observable effect on the environment (e.g., in the case of a reinforcement learning agent). The parameters of the ML model are updated based on a difference between the generated output value and the desired target value. For example, if the value outputted by the ML model is excessively high, the parameters may be adjusted so as to lower the output value in future training iterations. An objective function is a way to quantitatively represent how close the output value is to the target value. An objective function represents a quantity (or one or more quantities) to be optimized (e.g., minimize a loss or maximize a reward) in order to bring the output value as close to the target value as possible. The goal of training the ML model typically is to minimize a loss function or maximize a reward function.
The training data may be a subset of a larger data set. For example, a data set may be split into three mutually exclusive subsets: a training set, a validation (or cross-validation) set, and a testing set. The three subsets of data may be used sequentially during ML model training. For example, the training set may be first used to train one or more ML models, each ML model, e.g., having a particular architecture, having a particular training procedure, being describable by a set of model hyperparameters, and/or otherwise being varied from the other of the one or more ML models. The validation (or cross-validation) set may then be used as input data into the trained ML models to, e.g., measure the performance of the trained ML models and/or compare performance between them. Where hyperparameters are used, a new set of hyperparameters may be determined based on the measured performance of one or more of the trained ML models, and the first step of training (i.e., with the training set) may begin again on a different ML model described by the new set of determined hyperparameters. In this way, these steps may be repeated to produce a more performant trained ML model. Once such a trained ML model is obtained (e.g., after the hyperparameters have been adjusted to achieve a desired level of performance), a third step of collecting the output generated by the trained ML model applied to the third subset (the testing set) may begin. The output generated from the testing set may be compared with the corresponding desired target values to give a final assessment of the trained ML model's accuracy. Other segmentations of the larger data set and/or schemes for using the segments for training one or more ML models are possible.
Backpropagation is an algorithm for training a ML model. Backpropagation is used to adjust (also referred to as update) the value of the parameters in the ML model, with the goal of optimizing the objective function. For example, a defined loss function is calculated by forward propagation of an input to obtain an output of the ML model and comparison of the output value with the target value. Backpropagation calculates a gradient of the loss function with respect to the parameters of the ML model, and a gradient algorithm (e.g., gradient descent) is used to update (i.e., âlearnâ) the parameters to reduce the loss function. Backpropagation is performed iteratively, so that the loss function is converged or minimized. Other techniques for learning the parameters of the ML model may be used. The process of updating (or learning) the parameters over many iterations is referred to as training. Training may be carried out iteratively until a convergence condition is met (e.g., a predefined maximum number of iterations has been performed, or the value outputted by the ML model is sufficiently converged with the desired target value), after which the ML model is considered to be sufficiently trained. The values of the learned parameters may then be fixed and the ML model may be deployed to generate output in real-world applications (also referred to as âinferenceâ).
In some examples, a trained ML model may be fine-tuned, meaning that the values of the learned parameters may be adjusted slightly in order for the ML model to better model a specific task. Fine-tuning of a ML model typically involves further training the ML model on a number of data samples (which may be smaller in number/cardinality than those used to train the model initially) that closely target the specific task. For example, a ML model for generating natural language that has been trained generically on publically-available text corpuses may be, e.g., fine-tuned by further training using the complete works of Shakespeare as training data samples (e.g., where the intended use of the ML model is generating a scene of a play or other textual content in the style of Shakespeare).
FIG. 1 A is a simplified diagram of an example CNN 10 , which is an example of a DNN that is commonly used for image processing tasks such as image classification, image analysis, object segmentation, etc. An input to the CNN 10 may be a 2D RGB image 12 .
The CNN 10 includes a plurality of layers that process the image 12 in order to generate an output, such as a predicted classification or predicted label for the image 12 . For simplicity, only a few layers of the CNN 10 are illustrated including at least one convolutional layer 14 . The convolutional layer 14 performs convolution processing, which may involve computing a dot product between the input to the convolutional layer 14 and a convolution kernel. A convolutional kernel is typically a 2D matrix of learned parameters that is applied to the input in order to extract image features. Different convolutional kernels may be applied to extract different image information, such as shape information, color information, etc.
The output of the convolution layer 14 is a set of feature maps 16 (sometimes referred to as activation maps). Each feature map 16 generally has smaller width and height than the image 12 . The set of feature maps 16 encode image features that may be processed by subsequent layers of the CNN 10 , depending on the design and intended task for the CNN 10 . In this example, a fully connected layer 18 processes the set of feature maps 16 in order to perform a classification of the image, based on the features encoded in the set of feature maps 16 . The fully connected layer 18 contains learned parameters that, when applied to the set of feature maps 16 , outputs a set of probabilities representing the likelihood that the image 12 belongs to each of a defined set of possible classes. The class having the highest probability may then be outputted as the predicted classification for the image 12 .
In general, a CNN may have different numbers and different types of layers, such as multiple convolution layers, max-pooling layers and/or a fully connected layer, among others. The parameters of the CNN may be learned through training, using data having ground truth labels specific to the desired task (e.g., class labels if the CNN is being trained for a classification task, pixel masks if the CNN is being trained for a segmentation task, text annotations if the CNN is being trained for a captioning task, etc.), as discussed above.
Some concepts in ML-based language models are now discussed. It may be noted that, while the term âlanguage modelâ has been commonly used to refer to a ML-based language model, there could exist non-ML language models. In the present disclosure, the term âlanguage modelâ may be used as shorthand for ML-based language model (i.e., a language model that is implemented using a neural network or other ML architecture), unless stated otherwise. For example, unless stated otherwise, âlanguage modelâ encompasses LLMs.
A language model may use a neural network (typically a DNN) to perform natural language processing (NLP) tasks such as language translation, image captioning, grammatical error correction, and language generation, among others. A language model may be trained to model how words relate to each other in a textual sequence, based on probabilities. A language model may contain hundreds of thousands of learned parameters or in the case of a large language model (LLM) may contain millions or billions of learned parameters or more.
In recent years, there has been interest in a type of neural network architecture, referred to as a transformer, for use as language models. For example, the Bidirectional Encoder Representations from Transformers (BERT) model, the Transformer-XL model and the Generative Pre-trained Transformer (GPT) models are types of transformers. A transformer is a type of neural network architecture that uses self-attention mechanisms in order to generate predicted output based on input data that has some sequential meaning (i.e., the order of the input data is meaningful, which is the case for most text input). Although transformer-based language models are described herein, it should be understood that the present disclosure may be applicable to any ML-based language model, including language models based on other neural network architectures such as recurrent neural network (RNN)-based language models.
FIG. 1 B is a simplified diagram of an example transformer 50 , and a simplified discussion of its operation is now provided. The transformer 50 includes an encoder 52 (which may comprise one or more encoder layers/blocks connected in series) and a decoder 54 (which may comprise one or more decoder layers/blocks connected in series). Generally, the encoder 52 and the decoder 54 each include a plurality of neural network layers, at least one of which may be a self-attention layer. The parameters of the neural network layers may be referred to as the parameters of the language model.
The transformer 50 may be trained on a text corpus that is labelled (e.g., annotated to indicate verbs, nouns, etc.) or unlabeled. LLMs may be trained on a large unlabeled corpus. Some LLMs may be trained on a large multi-language, multi-domain corpus, to enable the model to be versatile at a variety of language-based tasks such as generative tasks (e.g., generating human-like natural language responses to natural language input).
An example of how the transformer 50 may process textual input data is now described. Input to a language model (whether transformer-based or otherwise) typically is in the form of natural language as may be parsed into tokens. It should be appreciated that the term âtokenâ in the context of language models and NLP has a different meaning from the use of the same term in other contexts such as data security. Tokenization, in the context of language models and NLP, refers to the process of parsing textual input (e.g., a character, a word, a phrase, a sentence, a paragraph, etc.) into a sequence of shorter segments that are converted to numerical representations referred to as tokens (or âcompute tokensâ). Typically, a token may be an integer that corresponds to the index of a text segment (e.g., a word) in a vocabulary dataset. Often, the vocabulary dataset is arranged by frequency of use. Commonly occurring text, such as punctuation, may have a lower vocabulary index in the dataset and thus be represented by a token having a smaller integer value than less commonly occurring text. Tokens frequently correspond to words, with or without whitespace appended. In some examples, a token may correspond to a portion of a word. For example, the word âlowerâ may be represented by a token for [low] and a second token for [er]. In another example, the text sequence âCome here, look!â may be parsed into the segments [Come], [here], [,], [look] and [!], each of which may be represented by a respective numerical token. In addition to tokens that are parsed from the textual sequence (e.g., tokens that correspond to words and punctuation), there may also be special tokens to encode non-textual information. For example, a [CLASS] token may be a special token that corresponds to a classification of the textual sequence (e.g., may classify the textual sequence as a poem, a list, a paragraph, etc.), a [EOT] token may be another special token that indicates the end of the textual sequence, other tokens may provide formatting information, etc.
In FIG. 1 B , a short sequence of tokens 56 corresponding to the text sequence âCome here, look!â is illustrated as input to the transformer 50 . Tokenization of the text sequence into the tokens 56 may be performed by some pre-processing tokenization module such as, for example, a byte pair encoding tokenizer (the âpreâ referring to the tokenization occurring prior to the processing of the tokenized input by the LLM), which is not shown in FIG. 1 B for simplicity. In general, the token sequence that is inputted to the transformer 50 may be of any length up to a maximum length defined based on the dimensions of the transformer 50 (e.g., such a limit may be 2048 tokens in some LLMs). Each token 56 in the token sequence is converted into an embedding vector 60 (also referred to simply as an embedding). An embedding 60 is a learned numerical representation (such as, for example, a vector) of a token that captures some semantic meaning of the text segment represented by the token 56 . The embedding 60 represents the text segment corresponding to the token 56 in a way such that embeddings corresponding to semantically related text are closer to each other in a vector space than embeddings corresponding to semantically-unrelated text. For example, assuming that the words âlookâ, âseeâ, and âcakeâ each correspond to, respectively, a âlookâ token, a âseeâ token, and a âcakeâ token when tokenized, the embedding 60 corresponding to the âlookâ token will be closer to another embedding corresponding to the âseeâ token in the vector space, as compared to the distance between the embedding 60 corresponding to the âlookâ token and another embedding corresponding to the âcakeâ token. The vector space may be defined by the dimensions and values of the embedding vectors. Various techniques may be used to convert a token 56 to an embedding 60 . For example, another trained ML model may be used to convert the token 56 into an embedding 60 . In particular, another trained ML model may be used to convert the token 56 into an embedding 60 in a way that encodes additional information into the embedding 60 (e.g., a trained ML model may encode positional information about the position of the token 56 in the text sequence into the embedding 60 ). In some examples, the numerical value of the token 56 may be used to look up the corresponding embedding in an embedding matrix 58 (which may be learned during training of the transformer 50 ).
The generated embeddings 60 are input into the encoder 52 . The encoder 52 serves to encode the embeddings 60 into feature vectors 62 that represent the latent features of the embeddings 60 . The encoder 52 may encode positional information (i.e., information about the sequence of the input) in the feature vectors 62 . The feature vectors 62 may have very high dimensionality (e.g., on the order of thousands or tens of thousands), with each element in a feature vector 62 corresponding to a respective feature. The numerical weight of each element in a feature vector 62 represents the importance of the corresponding feature. The space of all possible feature vectors 62 that can be generated by the encoder 52 may be referred to as the latent space or feature space.
Conceptually, the decoder 54 is designed to map the features represented by the feature vectors 62 into meaningful output, which may depend on the task that was assigned to the transformer 50 . For example, if the transformer 50 is used for a translation task, the decoder 54 may map the feature vectors 62 into text output in a target language different from the language of the original tokens 56 . Generally, in a generative language model, the decoder 54 serves to decode the feature vectors 62 into a sequence of tokens. The decoder 54 may generate output tokens 64 one by one. Each output token 64 may be fed back as input to the decoder 54 in order to generate the next output token 64 . By feeding back the generated output and applying self-attention, the decoder 54 is able to generate a sequence of output tokens 64 that has sequential meaning (e.g., the resulting output text sequence is understandable as a sentence and obeys grammatical rules). The decoder 54 may generate output tokens 64 until a special [EOT] token (indicating the end of the text) is generated. The resulting sequence of output tokens 64 may then be converted to a text sequence in post-processing. For example, each output token 64 may be an integer number that corresponds to a vocabulary index. By looking up the text segment using the vocabulary index, the text segment corresponding to each output token 64 can be retrieved, the text segments can be concatenated together and the final output text sequence (in this example, âViens ici, regarde!â) can be obtained.
Although a general transformer architecture for a language model and its theory of operation have been described above, this is not intended to be limiting. Existing language models include language models that are based only on the encoder of the transformer or only on the decoder of the transformer. An encoder-only language model encodes the input text sequence into feature vectors that can then be further processed by a task-specific layer (e.g., a classification layer). BERT is an example of a language model that may be considered to be an encoder-only language model. A decoder-only language model accepts embeddings as input and may use auto-regression to generate an output text sequence. Transformer-XL and GPT-type models may be language models that are considered to be decoder-only language models.
Because GPT-type language models tend to have a large number of parameters, these language models may be considered LLMs. An example GPT-type LLM is GPT-3. GPT-3 is a type of GPT language model that has been trained (in an unsupervised manner) on a large corpus derived from documents available to the public online. GPT-3 has a very large number of learned parameters (on the order of hundreds of billions), is able to accept a large number of tokens as input (e.g., up to 2048 input tokens), and is able to generate a large number of tokens as output (e.g., up to 2048 tokens). GPT-3 has been trained as a generative model, meaning that it can process input text sequences to predictively generate a meaningful output text sequence. ChatGPT is built on top of a GPT-type LLM, and has been fine-tuned with training datasets based on text-based chats (e.g., chatbot conversations). ChatGPT is designed for processing natural language, receiving chat-like inputs and generating chat-like outputs.
A computing system may access a remote language model (e.g., a cloud-based language model), such as ChatGPT or GPT-3, via a software interface (e.g., an application programming interface (API)). Additionally or alternatively, such a remote language model may be accessed via a network such as, for example, the Internet. In some implementations such as, for example, potentially in the case of a cloud-based language model, a remote language model may be hosted by a computer system as may include a plurality of cooperating (e.g., cooperating via a network) computer systems such as may be in, for example, a distributed arrangement. Notably, a remote language model may employ a plurality of processors (e.g., hardware processors such as, for example, processors of cooperating computer systems). Indeed, processing of inputs by an LLM may be computationally expensive/may involve a large number of operations (e.g., many instructions may be executed/large data structures may be accessed from memory) and providing output in a required timeframe (e.g., real-time or near real-time) may require the use of a plurality of processors/cooperating computing devices as discussed above.
Inputs to an LLM may be referred to as a prompt, which is a natural language input that includes instructions to the LLM to generate a desired output. A computing system may generate a prompt that is provided as input to the LLM via its API. As described above, the prompt may optionally be processed or pre-processed into a token sequence prior to being provided as input to the LLM via its API. A prompt can include one or more examples of the desired output, which provides the LLM with additional information to enable the LLM to better generate output according to the desired output. Additionally or alternatively, the examples included in a prompt may provide inputs (e.g., example inputs) corresponding to/as may be expected to result in the desired outputs provided. A one-shot prompt refers to a prompt that includes one example, and a few-shot prompt refers to a prompt that includes multiple examples. A prompt that includes no examples may be referred to as a zero-shot prompt.
FIG. 2 illustrates an example computing system 400 , which may be used to implement examples of the present disclosure, such as a prompt generation engine to generate prompts to be provided as input to a language model such as a LLM. Additionally or alternatively, one or more instances of the example computing system 400 may be employed to execute the LLM. For example, a plurality of instances of the example computing system 400 may cooperate to provide output using an LLM in manners as discussed above.
The example computing system 400 includes at least one processing unit, such as a processor 402 , and at least one physical memory 404 . The processor 402 may be, for example, a central processing unit, a microprocessor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a dedicated logic circuitry, a dedicated artificial intelligence processor unit, a graphics processing unit (GPU), a tensor processing unit (TPU), a neural processing unit (NPU), a hardware accelerator, or combinations thereof. The memory 404 may include a volatile or non-volatile memory (e.g., a flash memory, a random access memory (RAM), and/or a read-only memory (ROM)). The memory 404 may store instructions for execution by the processor 402 , to the computing system 400 to carry out examples of the methods, functionalities, systems and modules disclosed herein.
The computing system 400 may also include at least one network interface 406 for wired and/or wireless communications with an external system and/or network (e.g., an intranet, the Internet, a P2P network, a WAN and/or a LAN). A network interface may enable the computing system 400 to carry out communications (e.g., wireless communications) with systems external to the computing system 400 , such as a language model residing on a remote system.
The computing system 400 may optionally include at least one input/output (I/O) interface 408 , which may interface with optional input device(s) 410 and/or optional output device(s) 412 . Input device(s) 410 may include, for example, buttons, a microphone, a touchscreen, a keyboard, etc. Output device(s) 412 may include, for example, a display, a speaker, etc. In this example, optional input device(s) 410 and optional output device(s) 412 are shown external to the computing system 400 . In other examples, one or more of the input device(s) 410 and/or output device(s) 412 may be an internal component of the computing system 400 .
A computing system, such as the computing system 400 of FIG. 2 , may access a remote system (e.g., a cloud-based system) to communicate with a remote language model or LLM hosted on the remote system such as, for example, using an application programming interface (API) call. The API call may include an API key to enable the computing system to be identified by the remote system. The API call may also include an identification of the language model or LLM to be accessed and/or parameters for adjusting outputs generated by the language model or LLM, such as, for example, one or more of a temperature parameter (which may control the amount of randomness or âcreativityâ of the generated output) (and/or, more generally some form of random seed as serves to introduce variability or variety into the output of the LLM), a minimum length of the output (e.g., a minimum of 10 tokens) and/or a maximum length of the output (e.g., a maximum of 1000 tokens), a frequency penalty parameter (e.g., a parameter which may lower the likelihood of subsequently outputting a word based on the number of times that word has already been output), a âbest ofâ parameter (e.g., a parameter to control the number of times the model will use to generate output after being instructed to, e.g., produce several outputs based on slightly varied inputs). The prompt generated by the computing system is provided to the language model or LLM and the output (e.g., token sequence) generated by the language model or LLM is communicated back to the computing system. In other examples, the prompt may be provided directly to the language model or LLM without requiring an API call. For example, the prompt could be sent to a remote LLM via a network such as, for example, as or in message (e.g., in a payload of a message).
In the example of FIG. 2 , the computing system 400 may store in the memory 404 computer-executable instructions, which may be executed by a processing unit such as the processor 402 , to implement one or more embodiments disclosed herein. For example, the memory 404 may store instructions for implementing prompt generator 500 and/or text-editor 550 applications. In some examples, the computing system 400 may be a server of an online platform that provides the prompt generator 500 and text-editor 550 as web-based or cloud-based services that may be accessible by a user device (e.g., via communications over a wireless network). In some examples, the computing system 400 may be a user device that provides the text-editor 550 as a software application while another embodiment of the computing system 400 may be a server of the online platform that provides the prompt generator 500 . Other such variations may be possible without departing from the subject matter of the present disclosure.
In various examples, the present disclosure provides methods and systems for generating a revised text using a trained LLM, in a manner that enables the LLM to process a text passage that includes formatting (e.g., includes at least one formatting tag) to generate a revised text passage that is also formatted (e.g., including the same or different formatting tag). In some examples, the formatting tag in the inputted text passage may be identified by a rules-based parser. In some examples, the formatting tag in the inputted text passage may be identified using a trained classifier. In some examples, the formatting tag in the inputted text passage may be identified using the LLM.
The prompt generator 500 , for example, may receive a text passage to be revised (e.g., communicated from a user device over a wireless network). The prompt generator 500 may also receive a text-editing instruction, which may be from a user device (e.g., a user may input a natural language text-editing instruction such as âmake this more professionalâ, or a user may select from among predefined text-editing instructions such as selecting one of three defined styles) or may be a default text-editing instruction (e.g., defined by the platform hosting the prompt generator 500 ). Notably, the text passage includes at least one formatting tag, which may be in any suitable formatting language such as HTML, Markdown, LaTex, etc. The text-editing instruction may be related to a portion of the text passage (e.g., a user-selected portion of text), which may or may not include the at least one formatting tag, or may be related to the entire text passage.
As will be discussed further below, the prompt generator 500 processes the text passage to identify the at least one formatting tag. Optionally, the prompt generator 500 may also identify the formatting language (or formatting type) and/or formatting syntax. In some examples, depending on the formatting language, an identified formatting tag may be a particular character or combination of characters (e.g., characters such as **, [|], >, line break, etc. may be recognized formatting tags in Markdown). It should be understood that the use of the term âformatting tagâ in the present disclosure is intended to encompass any character or combination of characters, which may include alphanumeric characters, characters expressed in Unicode, non-alphanumeric characters (e.g., Greek characters) as well as emoji characters, that can be recognized as applying a formatting. After identifying the formatting tag, the prompt generator 500 automatically inserts instructions into a generated prompt to cause the LLM to preserve the formatting. In some examples, the prompt generator 500 may include one or more examples in the prompt to enable the LLM to understand the formatting style to be preserved. Additional details will be discussed further below.
The text-editor 550 may provide a UI that enables a user to compose and/or edit a block of text (e.g., a text document). The text-editor 550 may be locally accessible on a user device of the user (e.g., may be an application on a user device such as a desktop computer, smartphone, tablet, laptop, etc.) or may be an online service, provided by an online platform, that is accessible to the user device via a communication link (e.g., over a wireless network) with the platform.
The text-editor 550 may enable a user to select a portion of text (e.g., single word, phrase, sentence, paragraph) to be revised within a larger text passage. Alternatively or additionally, if no portion of text is selected then the entire text passage may be subject to revision. For example, the text-editor 550 may provide a UI that enables a user to select a portion of text (e.g., using a mouse, keyboard, touchscreen, etc.), and to input (e.g., via keyboard, microphone, etc.) text-editing instructions related to the selected portion of text. The user-selected portion of text may or may not include formatting tag
CLAIMS
Claims ( 21 )
The invention claimed is:
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.
US18/491,370
2023-03-14
2023-10-20
Methods and systems for prompting large language model to generate formatted output
Active
2044-04-04
US12561512B2
( en )
Priority Applications (2)
Application Number
Priority Date
Filing Date
Title
US18/491,370
US12561512B2
( en )
2023-03-14
2023-10-20
Methods and systems for prompting large language model to generate formatted output
US19/320,239
US20260004047A1
( en )
2023-03-14
2025-09-05
Methods and systems for prompting large language model to generate formatted output
Applications Claiming Priority (3)
Application Number
Priority Date
Filing Date
Title
US202363490103P
2023-03-14
2023-03-14
US202363501841P
2023-05-12
2023-05-12
US18/491,370
US12561512B2
( en )
2023-03-14
2023-10-20
Methods and systems for prompting large language model to generate formatted output
Related Child Applications (1)
Application Number
Title
Priority Date
Filing Date
US19/320,239
Continuation
US20260004047A1
( en )
2023-03-14
2025-09-05
Methods and systems for prompting large language model to generate formatted output
Publications (2)
Publication Number
Publication Date
US20240311546A1
US20240311546A1 ( en )
2024-09-19
US12561512B2
true
US12561512B2 ( en )
2026-02-24
Family
ID=92714296
Family Applications (2)
Application Number
Title
Priority Date
Filing Date
US18/491,370
Active
2044-04-04
US12561512B2
( en )
2023-03-14
2023-10-20
Methods and systems for prompting large language model to generate formatted output
US19/320,239
Pending
US20260004047A1
( en )
2023-03-14
2025-09-05
Methods and systems for prompting large language model to generate formatted output
Family Applications After (1)
Application Number
Title
Priority Date
Filing Date
US19/320,239
Pending
US20260004047A1
( en )
2023-03-14
2025-09-05
Methods and systems for prompting large language model to generate formatted output
Country Status (1)
Country
Link
US
( 2 )
US12561512B2
( en )
Families Citing this family (14)
* Cited by examiner, â Cited by third party
Publication number
Priority date
Publication date
Assignee
Title
US12608548B2
( en )
*
2023-02-03
2026-04-21
Shopify Inc.
Methods and systems for parsing a mix of features and instructions into a prompt
US12346649B1
( en )
*
2023-05-12
2025-07-01
Instabase, Inc.
Systems and methods for using a text-based document format to provide context for a large language model
US20240386216A1
( en )
*
2023-05-17
2024-11-21
Asapp, Inc.
Automation of tasks using language model prompts
US20240386185A1
( en )
*
2023-05-19
2024-11-21
Microsoft Technology Licensing, Llc
Enhanced generation of formatted and organized guides from unstructured spoken narrative using large language models
US12585641B2
( en )
*
2023-09-29
2026-03-24
Intuit Inc.
Generative artificial intelligence based conversion of natural language requests to data warehouse query instruction sets
US20250307217A1
( en )
*
2024-03-27
2025-10-02
Chien Yaw Wong
Computer-implemented methods and computing systems for enriching and structuring data associated with an item
US20260030567A1
( en )
*
2024-07-23
2026-01-29
Mango Technologies, Inc. DBA ClickUp
Generating candidate subtasks for a task created by a user through a generative model and supplemental tasks previously created by the user
US20260080080A1
( en )
*
2024-09-16
2026-03-19
International Business Machines Corporation
Selectively masking virtual assets in virtual environments
CN119623516B
( en )
*
2024-10-29
2025-08-19
æ·±å³å å§æºè½æéå ¬å¸
Task response method and device based on large language model, electronic equipment and medium
US12481652B1
( en )
*
2024-10-30
2025-11-25
Palo Alto Networks, Inc.
Contextual identifier-attribute mappings for large language models
CN119474540B
( en )
*
2024-11-06
2026-04-28
åå°æ»¨å·¥ä¸å¤§å¦
A knowledge-guided, large language model-based trusted API recommendation method
CN119576856B
( en )
*
2024-11-14
2025-09-16
浪潮äºä¿¡æ¯ææ¯è¡ä»½å ¬å¸
Policy document revision method, device, medium, and equipment based on graph data
CN120632112B
( en )
*
2025-05-28
2026-04-10
å京泰çç§ææéå ¬å¸
A method and system for digitizing contingency plans based on large model technology
CN121118882B
( en )
*
2025-09-09
2026-02-27
ä¸å½å»å¦ç§å¦é¢å»å¦ä¿¡æ¯ç ç©¶æ
Method and system for generating literature reviews and electronic equipment
Citations (9)
* Cited by examiner, â Cited by third party
Publication number
Priority date
Publication date
Assignee
Title
US20090265612A1
( en )
*
2008-04-17
2009-10-22
Travelocity.Com Lp
Methods, apparatuses, and computer program products for specifying content of electronic mail messages using a mail markup language
US20220036153A1
( en )
*
2020-07-29
2022-02-03
Thayermahan, Inc.
Ultra large language models as ai agent controllers for improved ai agent performance in an environment
US20220108079A1
( en )
*
2020-10-06
2022-04-07
Sap Se
Application-Specific Generated Chatbot
US11481545B1
( en )
*
2021-06-28
2022-10-25
Orbis Technologies, Inc.
Conditional processing of annotated documents for automated document generation
US20220374608A1
( en )
2021-05-21
2022-11-24
Google Llc
Machine-Learned Language Models which Generate Intermediate Textual Analysis in Service of Contextual Text Generation
US20230289515A1
( en )
*
2022-03-08
2023-09-14
Xerox Corporation
Methods and systems for adding annotations from a printed version of a document to a digital version of the document
US20240086051A1
( en )
*
2022-09-10
2024-03-14
Nikolas Louis Ciminelli
Editing User Interfaces using Free Text
US20240127617A1
( en )
2022-10-06
2024-04-18
UBIAI, Inc.
Systems and methods for automated text labeling
US20240143698A1
( en )
*
2022-10-28
2024-05-02
Yahoo Assets Llc
Electronic information extraction using a machine-learned model architecture method and apparatus
2023
2023-10-20
US
US18/491,370
patent/US12561512B2/en
active
Active
2025
2025-09-05
US
US19/320,239
patent/US20260004047A1/en
active
Pending
Patent Citations (9)
* Cited by examiner, â Cited by third party
Publication number
Priority date
Publication date
Assignee
Title
US20090265612A1
( en )
*
2008-04-17
2009-10-22
Travelocity.Com Lp
Methods, apparatuses, and computer program products for specifying content of electronic mail messages using a mail markup language
US20220036153A1
( en )
*
2020-07-29
2022-02-03
Thayermahan, Inc.
Ultra large language models as ai agent controllers for improved ai agent performance in an environment
US20220108079A1
( en )
*
2020-10-06
2022-04-07
Sap Se
Application-Specific Generated Chatbot
US20220374608A1
( en )
2021-05-21
2022-11-24
Google Llc
Machine-Learned Language Models which Generate Intermediate Textual Analysis in Service of Contextual Text Generation
US11481545B1
( en )
*
2021-06-28
2022-10-25
Orbis Technologies, Inc.
Conditional processing of annotated documents for automated document generation
US20230289515A1
( en )
*
2022-03-08
2023-09-14
Xerox Corporation
Methods and systems for adding annotations from a printed version of a document to a digital version of the document
US20240086051A1
( en )
*
2022-09-10
2024-03-14
Nikolas Louis Ciminelli
Editing User Interfaces using Free Text
US20240127617A1
( en )
2022-10-06
2024-04-18
UBIAI, Inc.
Systems and methods for automated text labeling
US20240143698A1
( en )
*
2022-10-28
2024-05-02
Yahoo Assets Llc
Electronic information extraction using a machine-learned model architecture method and apparatus
Non-Patent Citations (8)
* Cited by examiner, â Cited by third party
Title
Canadian Intellectual Property Office, " International Search Report and Written Opinion " for International Application No. PCT/CA2023/051099 dated Nov. 20, 2023, 9 pages.
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/.
*
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.
Yuan, Ann, et al., " Wordcraft: story writing with large language models ", Proceedings of the 27th International Conference on Intelligent User Interfaces. 2022, 12 pages.
Canadian Intellectual Property Office, " International Search Report and Written Opinion " for International Application No. PCT/CA2023/051099 dated Nov. 20, 2023, 9 pages.
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/.
*
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.
Yuan, Ann, et al., " Wordcraft: story writing with large language models ", Proceedings of the 27th International Conference on Intelligent User Interfaces. 2022, 12 pages.
Also Published As
Publication number
Publication date
US20260004047A1
( en )
2026-01-01
US20240311546A1
( en )
2024-09-19
Similar Documents
Publication
Publication Date
Title
US20260004047A1
( en )
2026-01-01
Methods and systems for prompting large language model to generate formatted output
US12182506B2
( en )
2024-12-31
Systems and methods for dynamic large language model prompt generation
US12468878B2
( en )
2025-11-11
Methods and systems for generation of text using large language model with indications of unsubstantiated information
US20240256792A1
( en )
2024-08-01
Methods and systems for dynamic generation of personalized text using large language model
US20250356111A1
( en )
2025-11-20
Methods and systems for prompting large language model to process inputs from multiple user elements
US12608548B2
( en )
2026-04-21
Methods and systems for parsing a mix of features and instructions into a prompt
US12411699B2
( en )
2025-09-09
Dynamic generation of user interface controls
US12579377B2
( en )
2026-03-17
Summary of reviews generated by a generative language model
US20240311192A1
( en )
2024-09-19
Methods and systems for indicating resource usage parameter for prompting a large language model (llm)
US20240256793A1
( en )
2024-08-01
Methods and systems for generating text with tone or diction corresponding to stylistic attributes of images
US12596876B2
( en )
2026-04-07
Systems and methods for improving textual descriptions using large language models
US20240354710A1
( en )
2024-10-24
Methods and systems for the creation of parsers using large language models
US20250165228A1
( en )
2025-05-22
Generation of grammar-compliant programming language code using machine learning
US12430661B2
( en )
2025-09-30
Systems and methods for processing product information using a machine-learning model
US20240386477A1
( en )
2024-11-21
Methods and systems for providing context for generating an online store
US20240354176A1
( en )
2024-10-24
Notification messages generated by a generative language model
US11308542B2
( en )
2022-04-19
Systems and methods for using keywords extracted from reviews
US20250166037A1
( en )
2025-05-22
Embedding-based search of an item store
US20250165125A1
( en )
2025-05-22
Methods and devices for exploring an n-dimensional embedding space using a navigation-based recommender
US20240354830A1
( en )
2024-10-24
System and Method for Identifying Complementary Objects from Images
WO2025123115A1
( en )
2025-06-19
Methods and systems for resolving and providing context for client-permissioned content
US20250148191A1
( en )
2025-05-08
Keyword extraction to generate subject lines
US20250148003A1
( en )
2025-05-08
System and Method for Modifying Search Metrics Based on Features of Interest Determined from Interactions with Images
WO2025102145A1
( en )
2025-05-22
Methods and systems for contextual chatbot operation
US20250252388A1
( en )
2025-08-07
Methods and systems for checkout interface with low latency display of delivery date
Legal Events
Date
Code
Title
Description
2023-10-20
FEPP
Fee payment procedure
Free format text : ENTITY STATUS SET TO UNDISCOUNTED (ORIGINAL EVENT CODE: BIG.); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY
2023-11-22
STPP
Information on status: patent application and granting procedure in general
Free format text : DOCKETED NEW CASE - READY FOR EXAMINATION
2023-12-06
AS
Assignment
Owner name : SHOPIFY UK LIMITED, UNITED KINGDOM
Free format text : ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:MICHEL, BENJAMIN;REEL/FRAME:065776/0567
Effective date : 20231117
Owner name : SHOPIFY INC., CANADA
Free format text : ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:BEAUCHAMP, DANIEL;REEL/FRAME:065776/0497
Effective date : 20231127
Owner name : SHOPIFY (USA) INC., NEW YORK
Free format text : ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:MASCHMEYER, RUSS;REEL/FRAME:065776/0494
Effective date : 20231201
Owner name : SHOPIFY SWEDEN AB, SWEDEN
Free format text : ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:GOLIGORSKY, DAVID;REEL/FRAME:065776/0531
Effective date : 20231117
2024-01-18
AS
Assignment
Owner name : SHOPIFY INTERNATIONAL LIMITED, CANADA
Free format text : ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:SHOPIFY UK LIMITED;REEL/FRAME:066171/0409
Effective date : 20240117
Owner name : SHOPIFY INTERNATIONAL LIMITED, IRELAND
Free format text : ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:SHOPIFY SWEDEN AB;REEL/FRAME:066171/0349
Effective date : 20240117
2024-01-19
AS
Assignment
Owner name : SHOPIFY INTERNATIONAL LIMITED, IRELAND
Free format text : ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:SHOPIFY SWEDEN AB;REEL/FRAME:066185/0086
Effective date : 20240117
Owner name : SHOPIFY INTERNATIONAL LIMITED, IRELAND
Free format text : ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:SHOPIFY UK LIMITED;REEL/FRAME:066185/0007
Effective date : 20240117
Owner name : SHOPIFY INC., CANADA
Free format text : ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:SHOPIFY (USA) INC.;REEL/FRAME:066185/0212
Effective date : 20240117
Owner name : SHOPIFY INC., CANADA
Free format text : ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:SHOPIFY INTERNATIONAL LIMITED;REEL/FRAME:066185/0165
Effective date : 20240117
2025-06-04
STPP
Information on status: patent application and granting procedure in general
Free format text : NON FINAL ACTION MAILED
2025-09-12
STPP
Information on status: patent application and granting procedure in general
Free format text : RESPONSE TO NON-FINAL OFFICE ACTION ENTERED AND FORWARDED TO EXAMINER
2026-01-02
STPP
Information on status: patent application and granting procedure in general
Free format text : ALLOWED -- NOTICE OF ALLOWANCE NOT YET MAILED
Free format text : NOTICE OF ALLOWANCE MAILED -- APPLICATION RECEIVED IN OFFICE OF PUBLICATIONS
2026-01-21
STPP
Information on status: patent application and granting procedure in general
Free format text : PUBLICATIONS -- ISSUE FEE PAYMENT RECEIVED
Free format text : PUBLICATIONS -- ISSUE FEE PAYMENT VERIFIED
2026-02-11
STCF
Information on status: patent grant
Free format text : PATENTED CASE