Information output method, device, medium, and program product

By converting the original code format to the target code format to reduce the number of lexical units, the problem of the lexical window limitation of large language models is solved, output accuracy is improved and costs are saved, and code correction is achieved.

WO2026065434A1PCT designated stage Publication Date: 2026-04-02BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2026-04-02

AI Technical Summary

Technical Problem

Large language models are prone to exceeding the lexical window limit when processing a large number of lexical units, resulting in decreased output accuracy, inability to complete complex tasks, and high call costs.

Method used

By converting the original code format to the target code format, the number of lexical units is reduced. The target model is used to generate the output, and the output is converted back to the original code format. The translator is then used for error correction.

Benefits of technology

It reduces the probability of lexical terms exceeding the window limit, improves output accuracy, saves calling costs, and increases information density by simplifying code format, making it easier to correct errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024122842_02042026_PF_FP_ABST
    Figure CN2024122842_02042026_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide an information output method, a device, a storage medium, and a computer program product. The method comprises acquiring an original input in an original code format. The method also comprises converting the original input into a target input in a target code format. The number of tokens contained in the target input is less than the number of tokens contained in the original input. The method also comprises providing the target input to a target model. The method also comprises acquiring an original output in the target code format from the target model. The method further comprises converting the original output into a target output in the original code format.
Need to check novelty before this filing date? Find Prior Art

Description

Information output method, device, medium, and program product TECHNICAL FIELD

[0001] The present disclosure relates generally to the field of computers, and more specifically to an information output method, an electronic device, a computer-readable storage medium, and a computer program product. BACKGROUND

[0002] In the process of content generation using a large language model (LLM), a user usually needs to write a system prompt word and input a question, expecting the LLM to output a reply as required. Such application scenarios are widespread, and may include, for example, completing the configuration work of a node according to user input and workflow context, completing the writing of web page code according to user input, and completing the extraction of complex information according to user input.

[0003] In some use scenarios, when a user inputs text to an LLM, the model will split the text into a series of tokens. This helps the model better understand and process the input content. For example, after splitting a sentence into tokens, it is more convenient to perform semantic analysis and feature extraction. In addition, when training a large language model, tokens are the basic units of model learning. The model improves its understanding and generation capabilities of language by learning the relationships and patterns between tokens in a large amount of text. At the same time, when the model generates text, it also outputs in units of tokens. The model generates tokens one by one and finally combines them into a complete text output.

[0004] SUMMARY

[0005] According to example embodiments of the present disclosure, an information output method, an electronic device, a computer storage medium, and a computer program product are provided.

[0006] In a first aspect of the present disclosure, an information output method is provided. The method includes obtaining an original input in an original code format. The method also includes converting the original input into a target input in a target code format. The number of tokens included in the target input is less than the number of tokens included in the original input. The method also includes providing the target input to a target model. The method also includes obtaining an original output in the target code format from the target model. The method also includes converting the original output into a target output in the original code format.

[0007] In a second aspect of the present disclosure, an electronic device is provided, comprising: at least one processing unit; at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, which when executed by the at least one processing unit causes the electronic device to perform the method described in the first aspect of the present disclosure.

[0008] In a third aspect of the present disclosure, an information output apparatus is provided. The apparatus includes an input obtaining module configured to obtain an original input in an original code format. The apparatus further includes an input converting module configured to convert the original input into a target input in a target code format. The target input contains a smaller number of tokens than the original input. The apparatus further includes an input providing module configured to provide the target input to a target model. The apparatus further includes an output obtaining module configured to obtain an original output in the target code format from the target model. The apparatus further includes an output converting module configured to convert the original output into a target output in the original code format.

[0009] In a fourth aspect of the present disclosure, a computer-readable storage medium having stored thereon machine executable instructions, which when executed by a device, cause the device to perform the method described according to the first aspect of the present disclosure.

[0010] In a fifth aspect of the present disclosure, a computer program product is provided, comprising computer executable instructions, wherein the computer executable instructions, when executed by a processor, implement the method described according to the first aspect of the present disclosure.

[0011] The summary is provided to introduce a selection of concepts that are further described below in the of the Invention. This summary is not intended to identify key or essential features of the disclosure, nor is it intended to limit the scope of the disclosure. Other features will be more fully described in the following detailed description. BRIEF DESCRIPTION OF DRAWINGS

[0012] The above and other features, aspects and advantages of embodiments of the present disclosure will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings. In the drawings:

[0013] FIG. 1 shows a schematic diagram of an example system in which embodiments of the present disclosure can be implemented;

[0014] FIG. 2 shows a flowchart of an information output method according to an embodiment of the present disclosure;

[0015] FIG. 3 shows a schematic diagram of an example structure of a target code format according to an embodiment of the present disclosure;

[0016] FIGs. 4A-4B show schematic diagrams of an example process for converting code formats according to an embodiment of the present disclosure;

[0017] FIG. 5 shows a schematic diagram of another example environment in which embodiments of the present disclosure can be implemented;

[0018] FIGS. 6A-6C show schematic diagrams of an exemplary process for correcting error codes, according to embodiments of the present disclosure;

[0019] FIG. 7 shows a schematic block diagram of an exemplary device 700, according to some embodiments of the present disclosure.

[0020] FIG. 8 shows a block diagram of an example device that can be used to implement embodiments of the present disclosure. DETAILED DESCRIPTION

[0021] Embodiments of the present disclosure will be described in more detail with reference to the drawings. While certain embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be interpreted as being limited to the embodiments set forth herein, but rather should be interpreted to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for illustrative purposes and should not be construed as limiting the scope of protection of the present disclosure.

[0022] As discussed above, tokens play an important role in large language models. Therefore, there are some requirements for tokens. For example, large language models usually have a token window limit problem, i.e., when the number of input tokens exceeds the upper limit set by the model, the large language model cannot provide services. Not only that, even if the upper limit is not exceeded, when the number of input tokens is large, the output accuracy of the large language model will decrease, resulting in the inability to complete more complex outputs or tasks with high accuracy requirements.

[0023] In view of this, embodiments of the present disclosure provide a solution of using code format conversion to reduce the number of tokens. In this solution, when an input code with an original format is received, the input code is converted into a target input code with a target format, and the number of tokens of the converted target input code is less than that of the original input code in the original code format. Then, the target input code with reduced number of tokens is input into a language model as a target model to obtain an original output output by the language model. It should be understood that although the language model is exemplarily described in many places in the present disclosure, the language model is only exemplary. The target model can also be other types of token-sensitive machine learning models.

[0024] According to embodiments of the present disclosure, by reducing the tokens in the code, the probability of calling failure due to exceeding the window limit of the tokens is reduced. In addition, due to the reduction in the number of tokens, the accuracy of the results output by the language model is improved. Especially when dealing with complex tasks, the applicability of the results can be significantly improved. Secondly, due to the reduction in the number of tokens, the cost of calling the language model is saved.

[0025] Embodiments of the present disclosure will be described below in further detail with reference to the accompanying drawings, in which FIG. 1 shows a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. The example environment 100 includes a translator 102. The translator 102 can be a standalone computing device, or a translation module of a computing device. The translator 102 includes a forward translation module that can perform a forward translation 104, and a corresponding reverse translation module that performs a reverse translation 106. The operation of the forward translation 104 can convert code having an original code format into code having a target code format. Conversely, the operation of the reverse translation 106 can convert code having the target code format into code having the original code format. The example environment 100 also includes a language model 112. The language model 112 can be deployed in the same device as the translator 102, or can also be deployed in a different device. The language model 112 has an output module that can perform a generate output 114 operation. Further, the language model 112 can communicate with the translator 102 to exchange data.

[0026] In the embodiment shown in FIG. 1, after the translator 102 receives an original input 108 having an original code format, the translator 102 performs the forward translation 104 on the original input 108 to generate a target input having a target code format. Thereafter, the translator 102 provides the target input 110 to the language model 114. Upon receiving the target input 110, the language model 114 performs the generate output 114 operation to generate an original output having the target code format, using the target input 110 as a prompt word. Here, the language model 114 is trained to generate an original output having the target code format based on a received input having the target code format. Thereafter, the language model 114 provides the generated original output 116 to the translator 102. Upon receiving the original output 116, the translator 102 performs the reverse translation 106 operation to convert the original output 116 having the target code format into a target output 118 having the original code format.

[0027] In this embodiment, the original code format is JavaScript Object Notation (JSON) and the target code format is YAML Ain't Markup Language (YAML). As can be seen, the number of tokens contained in the original input 108 having the JSON code format as the original code format is much more than the number of tokens of the target input 110 having the YAML code format as the target code format. It should be understood that JSON and YAML are merely two exemplary code formats. The original code format can also be HyperText Markup Language (HTML) or Cascading Style Sheets (CSS), or other code formats. In contrast, the target code format can be any existing code format or specially predetermined code format that has a more concise structure than the original code format. Although a more concise code format is applied in the embodiment shown in FIG. 1, the target code format merely borrows the framework of YAML, and it can also include other mapping rules for reducing the number of tokens according to the present disclosure.

[0028] According to the output method for a language model of embodiments of the present disclosure, the number of tokens in the code can be reduced, so as to avoid exceeding the token window limit of the language model. In addition, the fewer number of tokens makes the information density in the target input higher, which is easier for the language model to understand, so as to improve the accuracy of the output of the language model.

[0029] The block diagram of the example environment 100 in which embodiments of the present disclosure can be implemented is described above in connection with FIG. 1. The information output method according to embodiments of the present disclosure is described below in connection with FIGS. 2-6C. FIG. 2 shows a flowchart of an example output method 200 for a language model according to embodiments of the present disclosure. The method 200 can be executed at the translator 102 in FIG. 1 and any suitable computing device. It should be understood that the numbering in the flowchart of the method 200 does not represent the order of execution of the steps, some or all of the steps can be executed in parallel, or the order of execution can be interchanged, which is not limited in the present disclosure. In addition, the method 200 in FIG. 2 can also include additional steps not shown and / or the steps shown can be omitted, and the scope of the present disclosure is not limited in this regard.

[0030] As shown in FIG. 2, at 202, the method 200 includes obtaining an original input in an original code format. For example, in the embodiment shown in FIG. 1, the translator 102 can obtain the original input 108 in the original code format. At 204, the method 200 includes converting the original input into a target input in a target code format. Here, the target input contains a smaller number of tokens than the original input. For example, in the embodiment shown in FIG. 1, upon receiving the original input 108, the translator 102 can convert the original input 108 into the target input 110 in the target code format that contains fewer tokens.

[0031] In some embodiments, the original code format can be an existing code format. To adapt the existing code format to reduce the number of tokens, the target code format can be created for the existing code format. In some embodiments, a more concise code format than the original code format can be selected. For example, in the case that the original code is in JSON, YAML can be selected as the target code format. In such an embodiment, the objects in JSON include preset characters such as curly braces and quotation marks. However, the objects in YAML use indentation as a kind of preset character to replace the preset characters such as punctuation marks, so it itself has fewer tokens than the code in JSON format.

[0032] In some embodiments, both the original code format and the target code format are similar to JSON and YAML formats that are composed of key-value pairs. In such an embodiment, the translator 102 can parse the original input according to a first syntax of the original code format to obtain a first set of key-value pairs. In the case that the original code format is not composed of key-value pairs, the original code can be first converted into a format composed of key-value pairs, such as JSON format. Then, the translator 102 can convert the first set of key-value pairs into a second set of key-value pairs according to a mapping rule between the first syntax and a second syntax of the target code format. Here, the first set of key-value pairs contains a larger number of tokens than the second set of key-value pairs. Finally, the translator 102 can generate the target input based on the second set of key-value pairs according to the second syntax.

[0033] In some embodiments, in order to ensure the integrity of the data included in the original input, reduction can be performed on the keys in the obtained key-value pairs. For example, a key of a key-value pair in the original code format has multiple tokens, and when constructing the target code format, the key can be summarized to have only one token. In this way, the tokens can be reduced by simplifying the keys with multiple tokens.

[0034] In some embodiments, a key-value pair representing a fixed meaning can also be converted into a preset symbol representing the corresponding meaning, and the preset symbol can be added to the value of the key-value pair it indicates. For example, in the case where the original code format contains a key-value pair indicating a data type, such a key-value pair can be converted into a specific punctuation symbol and added to the value of the key-value pair with the object of the data type. In this way, at least one token can be reduced by omitting the entire key-value pair.

[0035] In some embodiments, although the value of a key-value pair cannot be reduced, the respective values of multiple key-value pairs associated can be combined. For example, in the case where multiple other key-value pairs are nested in a key-value pair in the original code format, the multiple values in the nested key-value pairs can be merged into one synthetic value using a connecting symbol. For example, the values of the key-value pairs of each layer of an object organized into multiple layers can be connected into one value using a punctuation symbol, “period”. In this way, tokens of the code can also be reduced by reducing the keys of the key-value pairs.

[0036] At 206, the method 200 includes providing the target input to the language model. For example, in the embodiment shown in FIG. 1, the translator 102 can provide the target input 110 to the language model 112. At 208, the method 200 includes obtaining, from the language model, an original output in the target code format. For example, in the embodiment shown in FIG. 1, the translator 102 can obtain, from the language model 112, the original output 116 in the target code format. At 210, the method 200 includes converting the original output into a target output in the original code format. For example, in the embodiment shown in FIG. 1, the translator 102 can convert the original output 116 into the target output 118 in the original code format by reverse translation.

[0037] In some alternative embodiments, the language model 112 can be trained to directly generate an output in the original code format using an input in the target code format. In such embodiments, the language model 112 can directly provide an output in the original code format without the need for the translator 102 to perform reverse translation.

[0038] According to embodiments of the present disclosure, the translator 102 converts an input code in the original code format with more tokens into an input code in the target code format with fewer tokens according to predetermined rules, and inputs the input code with fewer tokens into the language model. In this way, the code input into the language model has fewer tokens, thereby reducing the probability of a call failure caused by the input containing more tokens than the token upper limit of the language model.

[0039] The preset target code format will be described below in combination with FIG. 3. FIG. 3 shows a schematic diagram of an example structure 300 of a target code format according to an embodiment of the present disclosure. As shown in FIG. 3, the structure 300 includes a workflow 310. The workflow 310 includes multiple nodes and edges for connecting the relevant nodes. The workflow 310 includes a start node 311, nodes 312, 313, 314 respectively associated with different tasks, and an end node 315. The connection manner of the edges embodies that the nodes 311, 312, 313, 314 and the end node 315 are executed in sequence. A target code format 320 for the workflow 310 includes segments respectively describing the nodes. As shown in FIG. 3, the target code format 320 includes a segment 321 for the node 311, a segment 322 for the node 312, and a segment 323 for the node 313.

[0040] In this embodiment, a single segment for a node can include an "id". The "id" represents the number of the node, which is kept unique. The single segment can also include a "name" field. The "name" represents the name of the node, which is convenient for users to read and serves as an identification of parameter mapping or reference, and is kept unique. The single segment can also include a "type" field. The "type" represents the type of the node. The type of the node can include, for example, a "start" node as an input of the workflow, an "end" as an output of the workflow, a "code" node, a "knowledge" node, a "condition" branch, and the like. The single segment can also include an "inputs / outputs" field. The "inputs / outputs" represents the input and output parameter definition of the node. The variable type can support, for example, integer, string, Boolean, floating point, array, dictionary, and composite nesting of the above types. The single segment can also include a "config" field. The "config" represents the configuration of the node, and different nodes have their own unique configuration fields, such as a prompt field for an LLM node, a code field for a code node, and the like. Here, each field is a key-value pair.

[0041] For brevity and without loss of generality, the following describes the stanza 322 for the node 312. The "type:LLM" in the stanza 322 indicates that the type of the node is LLM. LLM nodes have the capability of text intelligent processing, which can implement functions such as translation, summarization, expansion, reorganization, reasoning, parameter extraction, etc. of text. The "name:LLM_0" field in the stanza 322 indicates that this is the first LLM node, and the number starts from 0. The "desc:"LLM nodes have the capability of text intelligent processing, which can implement functions such as translation, summarization, expansion, reorganization, reasoning, parameter extraction, etc. of text." in the stanza 322 indicates the description of the node. The "config:" field in the stanza 322 includes multiple fields. The "model:gpt-3.5-16k" field among them indicates the underlying solution of the LLM, and the default value is gpt-3.5-16k. The "temperature:0.7" field indicates that the temperature of the model is 0.7 by default. The "mode:single" field has a value range of "single" or "batch", "single" indicating single processing, and "batch" indicating batch processing.

[0042] The "prompt:"The user's input is as follows:\n{{i_input}}\nYou need to extract the relevant topics of academic research from it and output to the keyword field. If the user's input does not contain the topics of academic research, please set the keyword field to empty." field in the stanza 322, where {{i_input}} corresponds to the input parameter described in the "inputs" of the "Start" node. The parameters mentioned in the prompt of the LLM node need to appear in the "inputs" of the LLM node. The "inputs:" in the stanza 322 leads to the fields it includes. The input parameters of the LLM node are free format and can have multiple parameters. In the embodiment shown in FIG. 3, "inputs:" includes "name:i_input" and "value:$Start.input". Here, the "inputs:" field indicates that the "i_input" parameter references the input field in the inputs of the Start node. In addition, the LLM node also includes output parameters "outputs:" field. The "outputs:" field includes "name:keyword" and "type:string". The "name:keyword" field indicates that the academic topics extracted by the LLM after processing the user's input are output to the keyword field. The "type:string" indicates that the type of the output is a string.

[0043] As can be seen, in one node in the embodiment shown in FIG. 3, only the node field and the output field include the corresponding type field, and the input field does not include the type field in the case where the input field indicates reference to other data. That is, after the attribute of the data is defined, the field referring to the data can no longer redefine the attribute, thereby reducing redundant information and improving the overall information density of the code.

[0044] In order to describe the relationship between the nodes, the target code format 320 further includes a segment 324 describing edges. As shown in FIG. 3, the segment 324 describes the next node of a node through the "next" field. The "next" of the "Start" node is the "LLM_0" node. The "next" node of the "if" branch of the "Condition_0" node is the "End" node, indicating that the "if" condition is hit and the return is early, and the "next" node of the "else" is the "GetArticleListByKeyword_0". As can be seen, the connection relationship of the two nodes only needs the names of the two nodes and a "next" three tokens. Compared with the description manner in the JSON format, for example, through the key value pair of the source node and the key value pair of the target node, at least one token can be reduced.

[0045] In addition to the aforementioned omission of tokens by definition of the structure, tokens can also be reduced by other specific mapping rules. In some embodiments, tokens can be reduced by simplifying the naming. For example, in a case where the original input is parsed into a first set of key-value pairs according to the syntax of the original code format, all key-value pairs in which the key in the first set of key-value pairs comprises at least two tokens can be found. Thereafter, the keys in these key-value pairs can be converted to keys comprising a single token for generating corresponding key-value pairs in a second set of key-value pairs of the target input. A schematic diagram of an exemplary process 400A for converting a code format according to some embodiments of the present disclosure is shown in FIG. 4A. As shown in FIG. 4A, in the process 400A, the translator receives an original input 402 having an original code format. The translator converts the original input 402 into a target input 404 having a target code format according to mapping rules between the original code format and the target code format. The original input 402 comprises an "inputParameters" field. The key of the "inputParameters" field is "inputParameters" 406, which has 2 tokens. In the converted target input 404, the field corresponding to the "inputParameters" field is an "inputs" field, and the key of the "inputs" field is "inputs", which has 1 token. In this way, the number of tokens can be reduced without changing the values in the key-value pairs. The mapping rules can be created, for example, by the following steps: parsing out all the "keys" of the objects defined in the original code format; determining the number of tokens of each key; obtaining corresponding simplified keys by generalizing or determining abbreviations of the keys comprising at least two tokens; and finally associating the original keys with the simplified keys.

[0046] In some embodiments, tokens can be reduced by merging associated fields. For example, it can be first determined that a plurality of key-value pairs are nested in a superior key-value pair in a first set of key-value pairs parsed from the original input. Thereafter, a plurality of values in the plurality of key-value pairs can be combined to generate a single synthesized value. Finally, the plurality of key-value pairs can be converted to one corresponding key-value pair for a second set of key-value pairs based on the synthesized value. In some embodiments, if the plurality of key-value pairs comprise key-value pairs organized as a plurality of levels, the values of the key-value pairs of the plurality of levels can be combined with at least one connector symbol to generate the synthesized value. Thereafter, one corresponding key-value pair can be generated based on the synthesized value and the key of the superior key-value pair. In other embodiments, if the plurality of key-value pairs comprise type key-value pairs indicating a reference type, the type key-value pairs can be converted to a reference symbol, and the reference symbol can be added to the synthesized value.

[0047] An exemplary process 400B for converting code format is shown in FIG. 4B, according to some embodiments of the present disclosure. As shown in FIG. 4B, the original input 402 includes a variable “var5” field 410. The field 410 includes a “value” field 412. In the “value” field 412, two fields are nested, i.e., a “type” field 414 and a “content” field 416. Meanwhile, in the “content” field 416, three fields are nested, i.e., a “source” field 418, a “blockID” field 420, and a “name” field 422. Here, the “source” field 418, the “blockID” field 420, and the “name” field 422 are different levels to which the value referenced by the variable “var5” belongs. Therefore, the translator can convert the values of the key-value pairs corresponding to the “source” field 418, the “blockID” field 420, and the “name” field 422 into one synthetic value. That is, the value “10001” of the “blockID” field 420 and the value “query” of the “name” field 422 can be combined into “node_10001.query” using a connector symbol “.”. Since it can be known from the value “query” of the “name” field 422 that it is the output of the node “10001”, the key-value pair of the “source” field 418 is omitted. In addition, the “type” field 414 indicates that the “value” field 412 is a reference type. Therefore, the translator can convert the “type” field 414 into a reference symbol “$” and add the symbol to the synthetic value “node_10001.query” to obtain the final key “$node_10001.query”. In this way, the “value” field 412 in the original code is converted to the “value” field 426 of the corresponding variable “var5” field 424. Thus, 6 word tokens are reduced.

[0048] In some embodiments, tokens can be reduced by omitting invariant data. For example, at least one key-value pair associated with code that remains invariant in the target output from the original input can be determined. Thereafter, the at least one key-value pair can be removed from the first set of key-value pairs to obtain a third set of key-value pairs. Finally, the third set of key-value pairs can be converted to the second set of key-value pairs. Since some code content is deleted before inputting to the language model, the translator needs to add back the code associated with the at least one key-value pair that is deleted to generate the target output in the original code format when obtaining the original output. For example, in the case of the original code format being JSON, the fields related to the user interface can be fixed values in the protocol described thereby. For example, the logo in the interface can be a fixed link. In this case, the output of the large language model will not change the logo data, and thus such logo data can not be included in the target input.

[0049] In some embodiments, tokens can be reduced by a designer designing a reasonable protocol. For example, when designing the target code format, only one or two punctuation marks can be used, and the division of the structure can be represented by indentation. Thus, the code of an object with the target code format contains less punctuation marks relative to the code of the same object with the original code format. For example, YAML format has fewer characters and is easier to correct than JSON.

[0050] To this end, the scheme of reducing wordpieces in the information output method utilizing embodiments of the present disclosure is described. The original output generated by the language model is in the target code format, thus having a higher information density, and such target code format is beneficial for code error correction. The scheme of performing code error correction will be described in conjunction with FIGS. 5-6C. FIG. 5 illustrates a schematic diagram of another example environment 500 in which embodiments of the present disclosure can be implemented. As shown in FIG. 5, the environment 500 includes an example environment 500 includes an interactive device 510. The interactive device 510 can interact with a user to generate an original input. For example, the user can utilize an editing module and perform an editing operation 512 to generate an original input 505 associated with a workflow in an original code format. The interactive device 510 provides the original input 505 to a translator 520. The translator 520 performs a forward translation operation 522 for the original input 505 utilizing a forward translation module to obtain a target input 515. Thereafter, the translator 520 provides the target input 515 to a language model 530. Upon receiving the target input 515, the language model 530 performs an operation of generating an output 532 in the target input 515 as a prompt word to generate an original output in a target code format. Thereafter, the language model 530 provides the generated original output 525 to the translator 520. Upon receiving the original output 525, the translator 520 performs a verification and correction operation 524 for the original output 525. The translator 520 verifies the original output in the target code format. If the translator 520 determines that the original output 525 includes an error, the translator 520 corrects the detected error to obtain a verified output 535. Alternatively, if the translator 520 determines that the original output 525 does not include an error, the translator 520 determines the original output as the verified output 535. Thereafter, the translator 520 performs an operation of generating a reverse translation 526 for the verified output 535 to convert the verified output 535 in the target code format to a target output 545 in the original code format. The scheme of performing a correction operation for a specific error will be described in conjunction with FIGS. 6A-6C.

[0051] FIG. 6A illustrates a diagram of an example process 600A for correcting a type of error code, according to an embodiment of the present disclosure. As shown in FIG. 6A, the "config" field 604 of the original output 602 in the target code format has two extra indents 606. Upon detecting the indentation error, the translator can adjust the indentation at the error location, i.e., remove the indents 606. It should be understood that in the case where the target code format is a YAML-based format, the target code format is sensitive to indentation, and thus the translator can easily detect the indentation error. In other embodiments, the target code format can also be sensitive to other preset characters. In such embodiments, the translator can detect the corresponding preset character error and perform correction by adding or removing the preset character.

[0052] FIG. 6B illustrates a diagram of an example process 600B for correcting another type of error code, according to an embodiment of the present disclosure. As shown in FIG. 6B, the "inputs" field of the original output 602 in the target code format has two extra indents 610. In addition, the "type" field 612 of the "inputs" field is missing. Upon detecting these errors, the translator will remove the extra indents 610. In addition, the translator will determine the "type" field 612 to be "type: string" according to the type of data referenced by the "value" field of the "inputs" field.

[0053] FIG. 6C illustrates a diagram of an example process 600C for correcting yet another type of error code, according to an embodiment of the present disclosure. As shown in FIG. 6C, the workflow indicated by the original output includes a start node 620, a loop node 622, a first node 624, and a second node 626. The translator detects that there is an edge relationship error in the code of the original output, i.e., the original output describes that the loop node 622 is connected to the second node 626 through a connection 630. The translator corrects the edge relationship of the workflow according to the information of the nodes and the language rules. In this embodiment, the translator can determine that the next node of the loop node 622 can only be the node closest to the loop node, and thus the loop node 622 should be connected to the first node 624 through a connection 628.

[0054] In addition, in some embodiments, the translator can detect errors in the "id" or "name" field of a node. For example, the translator can determine that the original output of the language model has an identifier error. At this time, the translator can determine the correct identifier by determining the correct mapping relationship between the target input and the original output. Alternatively, the translator can determine the correct identifier by calculating the distance of the erroneous identifier from all identifiers in the target input, and confirming the identifier with the smallest distance, i.e., the highest similarity, as the correct identifier.

[0055] FIG. 7 illustrates a schematic block diagram of an example apparatus 700 according to some embodiments of the present disclosure. The apparatus 700 can be implemented in software, hardware, or a combination of both. As shown in FIG. 7, the apparatus 700 includes an input obtaining module 710 configured to obtain an original input in an original code format. The apparatus 700 also includes an input converting module 720 configured to convert the original input into a target input in a target code format. The target input includes a number of tokens that is less than a number of tokens included in the original input. The apparatus 700 also includes an input providing module 730 configured to provide the target input to a language model. The apparatus 700 also includes an output obtaining module 740 configured to obtain an original output in the target code format from the language model. The apparatus 700 also includes an output converting module 750 configured to convert the original output into a target output in the original code format.

[0056] The apparatus 700 of FIG. 7 can be used to implement the processes described above in connection with FIGS. 1-6C, and for brevity, details shall not be repeated here.

[0057] The division of modules or units in the embodiments of the present disclosure is illustrative, and is merely a logical function division. When actually implemented, another division manner can be used. In addition, each functional unit in the disclosed embodiments can be integrated into one unit, or can be physically separated, or two or more units can be integrated into one unit. The integrated unit can be implemented in the form of hardware, or in the form of a software functional unit.

[0058] FIG. 8 illustrates a block diagram of an example device 800 that can be used to implement embodiments of the present disclosure. It should be understood that the device 800 illustrated in FIG. 8 is merely an example and should not be construed to limit the functionality and scope of the implementations described herein. For example, the device 800 can correspond to the computing device 120 described herein in connection with FIG. 1, and can be used to perform the method of FIG. 2 or the processes of FIGS. 4A-4B and 6A-6C described above.

[0059] As shown in FIG. 8, the device 800 is in the form of a general-purpose computing device. Components of the computing device 800 can include, but are not limited to, one or more processors or processing units 810, a memory 820, a storage device 830, one or more communication units 840, one or more input devices 850, and one or more output devices 860. The processing unit 810 can be a real or virtual processor and is capable of executing various processing in accordance with programs stored in the memory 820. In a multi-processor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capability of the computing device 800.

[0060] The computing device 800 typically includes a plurality of computer storage media. Such media can be volatile, nonvolatile, removable, and / or non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Storage 820 can be volatile (such as RAM), non-volatile (such as ROM, EEPROM, flash memory, etc.), or some combination of the two. Storage 830 can be removable or non-removable and can include machine readable media such as flash drives, magnetic disks, or any other medium that can be used to store information and / or data (e.g., training data for training) and that can be accessed by the computing device 800.

[0061] The computing device 800 can further include additional removable / non-removable, volatile / non-volatile storage media. Although not shown in FIG. 8, a disk drive or other computer readable media drive can provide for reading from and writing to a removable, non-removable, and / or non-volatile media such as a floppy disk, a ZIP® disk, a magnetic tape, or a flash drive. In such cases, the disk drive or other computer readable media drive can be connected to the bus by one or more data media interfaces. The memory 820 can include a computer program product 825 having one or more program modules configured to carry out the various methods or actions of the various implementations of the present disclosure.

[0062] The communication unit 840 enables communications with other computing devices over a communication media. Additionally, the functionality of the components of the computing device 800 can be implemented in a single computing cluster or a plurality of computer machines that are capable of communicating over a communication connection. Thus, the computing device 800 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network nodes in the networking environment.

[0063] Input device 850 can be one or more input devices, such as a mouse, a keyboard, a trackball, etc. Output device 860 can be one or more output devices, such as a display, a speaker, a printer, etc. Computing device 800 can also communicate with one or more external devices (not shown) such as a storage device, a display device, etc. through communication unit 840, and with one or more devices that enable a user to interact with computing device 800, or any devices (e.g., a network card, a modem, etc.) that enable computing device 800 to communicate with one or more other computing devices. Such communication can occur via Input / Output (I / O) interface (not shown).

[0064] According to example implementations of the present disclosure, a computer readable storage medium is provided having computer executable instructions stored thereon, where the computer executable instructions are executed by a processor to implement the method described above. According to example implementations of the present disclosure, a computer program product is also provided that is tangibly stored on a non-transitory computer readable medium and includes computer executable instructions, where the computer executable instructions are executed by a processor to implement the method described above. According to example implementations of the present disclosure, a computer program product is provided having a computer program stored thereon, which when executed by a processor implements the method described above.

[0065] Various aspects of the disclosure are now described with reference to the drawings. In general, the drawings described below are diagrammatic and schematic representations of actual or conceptual structures and processes, and are not limiting of the scope of the present disclosure. In the drawings, the same reference numerals are used to represent similar or like items.

[0066] These computer readable program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer readable program instructions can also be stored in a computer readable storage medium that can include a non-transitory computer readable storage medium that can direct a computer, a programmable data processing apparatus, and / or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including a manufacture including instructions which implement aspects of the function / act specified in the flowchart and / or block diagram block or blocks.

[0067] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer, other programmable data processing apparatus, or other device implement the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0068] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer, other programmable data processing apparatus, or other device implement the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0069] The implementations of the disclosure have been described above with the intent to be illustrative rather than limiting. Although being shown and described in terms of certain implementations and overall functions, the implementations are not intended to exclude other implementations or technologies. Modifications and changes can be made in arrangement, operation, and details of the methods and apparatus described. Many modifications and variations of the described implementations are possible and will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. It is therefore intended that the description be considered in all respects as illustrative, rather than limiting, of the disclosed implementations. Changes are made to the descriptions that are intended to be protective of the applications claimed. It is therefore intended that the description be considered in all respects as illustrative, rather than limiting, of the disclosed implementations. Changes are made to the descriptions that are intended to be protective of the applications claimed.

Claims

1. An information output method, comprising: obtaining an original input in an original code format; converting the original input into a target input in a target code format, the target input containing a number of tokens less than a number of tokens contained in the original input; providing the target input to a target model; obtaining an original output in the target code format from the target model; and converting the original output into a target output in the original code format.

2. The method of claim 1, wherein converting the original input into the target input in a target code format comprises: parsing the original input according to a first syntax of the original code format to obtain a first set of key-value pairs; converting the first set of key-value pairs into a second set of key-value pairs according to a mapping rule between the first syntax and a second syntax of the target code format, the first set of key-value pairs containing a number of tokens greater than a number of tokens contained in the second set of key-value pairs; and generating the target input based on the second set of key-value pairs according to the second syntax.

3. The method of claim 2, wherein converting the first set of key-value pairs into the second set of key-value pairs according to the mapping rule between the first syntax and the second syntax of the target code format comprises: determining that a first key of a first key-value pair in the first set of key-value pairs includes at least two tokens; and converting the first key into a second key including a single token for a corresponding key-value pair in the second set of key-value pairs.

4. The method of claim 2, wherein converting the first set of key-value pairs into the second set of key-value pairs according to the mapping rule between the first syntax and the second syntax of the target code format comprises: determining that a plurality of key-value pairs are nested in a superior key-value pair in the first set of key-value pairs; combining a plurality of values in the plurality of key-value pairs to generate a single synthesized value; and converting the plurality of key-value pairs into one corresponding key-value pair for the second set of key-value pairs based on the synthesized value.

5. The method of claim 4, wherein converting the plurality of key-value pairs into one corresponding key-value pair for the second set of key-value pairs based on the synthesized value comprises: determining that the plurality of key-value pairs include key-value pairs organized into a plurality of levels; combining values of the key-value pairs of the plurality of levels with at least one connector symbol to generate the synthesized value; and generating one corresponding key-value pair based on the synthesized value and a key of the superior key-value pair.

6. The method of claim 5, wherein converting the plurality of key-value pairs into one corresponding key-value pair for the second set of key-value pairs based on the synthesized value further comprises: determining that the plurality of key-value pairs include a type key-value pair indicating a reference type; converting the type key-value pair into a reference symbol; and adding the reference symbol to the synthesized value.

7. The method of claim 2, wherein converting the first set of key-value pairs into the second set of key-value pairs according to the mapping rule between the first syntax and the second syntax of the target code format comprises: ​ ​ ​ ​ ​ ​ determining at least one key-value pair associated with code in the original input that remains unchanged in the target output; removing the at least one key-value pair from the first set of key-value pairs to obtain a third set of key-value pairs; and converting the third set of key-value pairs to the second set of key-value pairs.

8. The method of claim 7, wherein generating the target output in the original code format based on the original output comprises: converting the original output to an intermediate output in the original code format according to a second syntax of the target code format; and adding code associated with the removed at least one key-value pair to the intermediate output to generate the target output.

9. The method of claim 1, wherein code of an object in the target code format contains fewer preset characters relative to code of the same object in the original code format.

10. The method of claim 1, further comprising: verifying the original output according to a second syntax of the target code format; and in response to determining that the original output includes an error, correcting the error to obtain a verified output, or in response to determining that the original output does not include an error, determining the original output as a verified output, and wherein the target output is generated based on the verified output.

11. The method of claim 10, wherein correcting the error to obtain a verified output comprises: in response to detecting an error of an indentation, adjusting the indentation at the error location.

12. The method of claim 10, wherein correcting the error to obtain a verified output comprises: in response to detecting an error of a missing key-value pair, determining a key-value pair associated with the missing key-value pair; generating a corresponding supplemental key-value pair based on the associated key-value pair; and adding the supplemental key-value pair at a predetermined location for the missing key-value pair.

13. The method of claim 10, wherein correcting the error to obtain a verified output comprises: in response to detecting an error of an object sequence indicated in the original output, correcting the object sequence based on key-value pairs associated with the object sequence and the target code format.

14. The method of claim 10, wherein correcting the error to obtain a verified output comprises: in response to detecting an error identifier, determining a distance between an identifier in the target input and the error identifier; determining an identifier with a minimum distance as a replacement identifier; and correcting the error identifier to the replacement identifier.

15. An electronic device, comprising: at least one processing unit; at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, which when executed by the at least one processing unit, cause the electronic device to perform the method of any of claims 1-14.

16. An information output apparatus, comprising: an input obtaining module configured to obtain an original input in an original code format; ​ ​ ​ ​ an input conversion module configured to convert the original input into a target input in a target code format, the target input containing a number of tokens less than a number of tokens contained in the original input; an input providing module configured to provide the target input to a target model; an output obtaining module configured to obtain an original output in the target code format from the target model; and an output conversion module configured to convert the original output into a target output in the original code format. 17.A computer readable storage medium having stored thereon a computer program, the computer program being executable by a processor to implement the method according to any one of claims 1 to 14. 18.A computer program product having stored thereon a computer program, the computer program being executable by a processor to implement the method according to any one of claims 1 to 14. ​

Citation Information

Patent Citations

  • Data processing method and device, equipment and storage medium

    CN114489670A

  • Programming-based large language model fine-tuning-free pre-training method and device

    CN116910535A

  • Repeated code detection method and device, terminal equipment and storage medium

    CN117573519A

  • Test case code generation method and related equipment

    CN117707983A

  • Generating music accompaniment

    US20240203387A1