METHOD, APPARATUS, ELECTRONIC DEVICE AND STORAGE MEDIUM FOR TRAINING LANGUAGE MODEL
By converting non-text format data to text format for unified language model training, the method addresses the inefficiencies of separate data processing, enhancing modeling and management efficiency and accuracy.
Patent Information
- Application Number
- JP2023036351
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2022-06-27
- Filing Date
- 2023-03-09
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2043-03-09
AI Technical Summary
Existing technologies face challenges in efficiently modeling and managing language models due to the need for separate processing of data in different formats, leading to increased costs and inefficiencies.
A method and apparatus for converting non-text format data into text format data for unified language model training, using techniques such as optical character recognition and pre-trained information extraction models, followed by fine-tuning the pre-trained model with converted data.
Enables unified modeling and management of heterogeneous data formats, reducing development and maintenance costs while improving modeling efficiency and accuracy.
Smart Images

Figure 0007615431000002 
Figure 0007615431000003 
Figure 0007615431000004
Abstract
Description
[Technical field]
[0001] The present disclosure relates to the field of computer technology, specifically to the field of artificial intelligence technologies such as machine learning and natural language processing, and in particular to methods, apparatus, electronic devices and storage media for training language models. [Background technology]
[0002] Prior art businesses use a variety of data structures, from relatively simple, fixed-format data structures such as text and pictures to more complex structured data structures such as databases, tables, and knowledge maps.
[0003] When performing specific business processing based on data, data of different formats are generally processed in different ways. For example, when modeling a language model based on data of different formats, the recognition methods for data of different formats are different, and it is difficult to model in the same way, so in the conventional technology, developers modeled language models corresponding to each of the different formats. Summary of the Invention [Problem to be solved by the invention]
[0004] The present disclosure provides a method, apparatus, electronic device, and storage medium for training a language model. [Means for solving the problem]
[0005] According to one aspect of the present disclosure, there is provided a method for training a language model, comprising: converting sample data in a non-text format into sample data in a text format; and training a language model based on the converted sample data in the text format.
[0006] According to another aspect of the present disclosure, there is provided an apparatus for training a language model, comprising: a conversion module for converting sample data in a non-text format into sample data in a text format; and a training module for training a language model based on the converted sample data in the text format.
[0007] According to another aspect of the present disclosure, there is provided an electronic device comprising at least one processor and a memory communicatively connected to the at least one processor, the memory storing commands executable by the at least one processor, the commands, when executed by the at least one processor, causing the at least one processor to perform a method of any one of the aspects and possible embodiments described above.
[0008] According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to carry out the method of any one of the above aspects and possible embodiments.
[0009] According to another aspect of the present disclosure there is provided a computer program product comprising a computer program which, when executed by a processor, performs the method of any one of the above aspects and possible embodiments.
[0010] According to the technology of the present disclosure, unified modeling of heterogeneous data can be effectively achieved, and modeling efficiency can be improved.
[0011] It should be understood that the contents described in this section are not intended to identify key or essential features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will be readily understood from the following specification. [Brief description of the drawings]
[0012] The drawings are for better understanding of the technical solution and are not intended to limit the present disclosure. [Figure 1] FIG. 1 is a schematic diagram according to a first embodiment of the present disclosure. [Diagram 2] FIG. 2 is a schematic diagram according to a second embodiment of the present disclosure. [Diagram 3] FIG. 13 is a schematic diagram according to a third embodiment of the present disclosure. [Figure 4] FIG. 13 is a schematic diagram according to a fourth embodiment of the present disclosure. [Diagram 5] FIG. 1 is a block diagram of an electronic device for implementing the method of an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0013] Hereinafter, exemplary embodiments of the present application will be described based on the drawings. For ease of understanding, various details of the embodiments of the present application are included, and they should be regarded as merely examples. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of simplicity, the following description omits the description of well-known functions and structures.
[0014] Apparently, the described embodiments are only some of the embodiments of the present disclosure, but not all of the embodiments. All other embodiments obtained based on the embodiments of the present disclosure under the premise that a person skilled in the art does not perform creative labor, belong to the scope of protection of the present disclosure.
[0015] It should be noted that the terminal device according to the embodiment of the present disclosure may include, but is not limited to, smart devices such as mobile phones, personal digital assistants (PDAs), wireless handheld devices, and tablet computers. The display device may include, but is not limited to, devices having a display function such as personal computers and televisions.
[0016] Furthermore, the term "and / or" in this specification is simply a relational relationship describing related objects, and means that three relations may exist. For example, A and / or B can mean three situations: A exists alone, A and B exist simultaneously, and B exists alone. Also, the character " / " in this specification generally means that the related objects before and after it are in an "or" relationship.
[0017] Given that in conventional techniques, data in various different formats is modeled using different language models, developing and maintaining multiple language models for multiple data formats is costly and inefficient.
[0018] 1 is a schematic diagram according to a first embodiment of the present disclosure. As shown in FIG. 1, this embodiment provides a method for training a language model, which specifically can include the following steps:
[0019] In S101, sample data in a non-text format is converted into sample data in a text format.
[0020] At S102, a language model is trained based on the sample data in the converted text format.
[0021] The language model training method of the present embodiment can be used to realize modeling of a language model of heterogeneous data. Specifically, in the modeling process, sample data in a non-text format can be converted into sample data in a text format. This makes it possible to uniformly convert the format of heterogeneous data into sample data in a text format. Then, the converted sample data in the text format is used to train the language model.
[0022] For example, the non-text format sample data of the present embodiment may include sample data in a picture format, and may include sample data having structured data such as a database, a table, a knowledge map, and the like.
[0023] In this embodiment, a unified processing method is adopted regardless of the non-text format of the sample data, so that the non-text format sample data can be uniformly converted into text format sample data. Furthermore, it is possible to uniformly model sample data of different formats and subsequently manage and maintain them in a uniform manner, thereby effectively improving the efficiency of management / maintenance of language models.
[0024] The language model training method of this embodiment converts sample data in non-text format into sample data in text format, and trains a language model based on the converted sample data in text format, thereby performing unified format conversion for heterogeneous data and further performing unified modeling, and avoiding separate modeling, management and maintenance for data in different formats, so as to effectively realize unified modeling of heterogeneous data, save costs of development, management and maintenance, and further effectively improve the efficiency of modeling, management and maintenance.
[0025] 2 is a schematic diagram according to a second embodiment of the present disclosure. As shown in FIG. 2, this embodiment provides a method for training a language model, which specifically can include the following steps:
[0026] In S201, it is determined whether the current sample data is in a non-text format, and if it is, step S202 is executed; if it is not, it is determined that the sample data is in a text format, and the sample data is discarded, and the next sample data is detected. The sample data in this embodiment is pre-mined, and may include positive sample data and negative sample data.
[0027] It should be noted that, for example, before step S201, sample data of non-text format clicked by the user can be mined as positive sample data from online logs in order to improve the accuracy of the mined samples.
[0028] The technical solution of this embodiment can be applied to a usage scenario involving sample data in non-text format. In order to make the language model learning adaptable to the field, the pre-trained language model can be fine-tuned using sample data in the field. Since the purpose of this embodiment is to make the language model learn the recognition ability of sample data after the non-text format sample data in the field is converted into text format sample data, in the scenario of this embodiment, the text format sample data is not taken into consideration and is discarded once.
[0029] In S202, it is determined whether or not structured data is included in the sample data in non-text format. If the determination is affirmative, step S203 is executed, and if the determination is negative, the process proceeds to step S204.
[0030] The structured data of this embodiment may include, but is not limited to, databases, tables, knowledge maps, and the like.
[0031] In S203, the data of each part in the structured data is linked and converted into sample data in a text format, and step S206 is executed.
[0032] In this embodiment, structured data is converted into text data without setting complex rules. The text data converted in this embodiment may be understood as text data written in a natural language, and can be applied to modeling of a natural language model.
[0033] In this embodiment, the structured data is converted into sample data in text format by concatenating each part of the structured data with a simple concatenation. It is considered that most data is stored in a computer in a simple structure such as a string or data, or in a complex structure such as json or a table. The most basic data structures such as numbers, strings, and lists can be easily converted into text format. On the other hand, somewhat complex data structures such as json and tables can be converted as follows.
[0034] For data in JSON format, the contents of the keys and values can be extracted and sequentially concatenated as text.
[0035] For example, the original structured data is: Data={ "Key1": "Value1", "KEY2": "VALUE2" }
[0036] The converted text format data can be expressed as follows: Data=“${key1}:${value1},${key2}:${value2}”
[0037] If the original structured data contains nested structures, after converting the child structures in the nesting according to the above method, the key of the parent node can be added before the conversion result of the child structure.
[0038] On the other hand, for table data, the contents and headers of each cell are concatenated to generate data in a short text format, and the short texts of all the cells can be concatenated in sequence.
[0039] For example, the original data is as follows: data= TIFF0007615431000001.tif13167
[0040] The converted text format data can be expressed as follows: data=“${H1}:${Value1},${H2}:${Value2},${H2}:${Value2},${H2}:${Value2}”
[0041] According to the above-described embodiment, all structured data can be quickly converted into data in text format, and unified modeling can be further facilitated based on the data in text format.
[0042] In S204, it is determined whether the non-text format sample data contains a picture, and if so, the process proceeds to step S205; if not, the sample data is discarded and the process returns to step S201 to start detecting the next sample data.
[0043] That is, in this embodiment, the non-text format sample data includes structured data and pictures as an example. In actual applications, it can be extended to sample data of other non-text formats. For example, in the case of semi-structured data, it includes both unstructured text data and structured data, so that the structured data portion is converted to text as in this embodiment, and sample data of a simple text format converted by linking it with the text data portion according to its position in the original data can be obtained. Alternatively, in actual applications, it can be extended to sample data of other non-text formats, but since the principle is the same, it will not be described in detail here. In this embodiment, sample data of non-text formats other than pictures and structured data is not considered. Such sample data may be ignored and discarded, and not used for modeling the language model.
[0044] In S205, the characters corresponding to the picture are extracted to obtain sample data in the text format, and step S206 is executed.
[0045] For example, in this embodiment, sample data including pictures can be converted into sample data in text format in the following two ways.
[0046] The first method employs an Optical Character Recognition (OCR) method to recognize characters in a picture and obtain sample data in text format.
[0047] Specifically, when a picture contains text, the method can extract the text corresponding to the picture, and can also convert sample data in picture format into sample data in text format.
[0048] The second method uses a pre-trained information extraction model to extract characters corresponding to the picture to obtain sample data in text format.
[0049] Specifically, when a picture contains not only text but also other target content, or when the picture does not contain text, a pre-trained information extraction model can be used to extract text in the picture or text corresponding to each target content in the picture, thereby realizing the conversion of sample data in picture format into sample data in text format.
[0050] It should be noted that, in addition to the above-mentioned first method, when the picture only contains text, it is also possible to use a pre-trained information extraction model to extract text from the picture and convert the sample data in the picture format into the sample data in the text format. However, when the picture contains target content other than text, the above-mentioned first method cannot be realized, and the above-mentioned second method needs to be adopted to realize the conversion of the sample data in the picture format into the sample data in the text format.
[0051] Any one of the above methods makes it possible to accurately convert sample data in picture format into sample data in text format.
[0052] At S206, the pre-trained language model is fine-tuned based on the sample data in the converted text format.
[0053] The language model of this embodiment is based on natural language processing, and by uniformly converting all non-text format sample data into text format sample data, it is possible to achieve unified modeling of all heterogeneous sample data.
[0054] In practical applications, model training can include two stages: pre-trained stage and fine-tuning stage. The pre-training stage can be considered as the process of pre-training the model. In this process, the model can be trained from scratch based on a larger dataset so that the model is in a good state. Meanwhile, the fine-tuning stage can be considered as taking a specific task or a specific domain dataset and fine-tuning the pre-trained model so that the model can adapt to the dataset. Fine-tuning can save time and computing resources and make the model reach a better effect quickly.
[0055] In this embodiment, when training a language model based on sample data in a converted text format, the method may be applied to a pre-training stage or a fine-tuning stage.
[0056] For example, the source data is very rich in sample data in text format. In this embodiment, the language model can be pre-trained using abundant sample data in text format. Since the non-text format sample data is converted into sample data in text format and the amount of data is relatively small, the pre-trained language model can be fine-tuned using the converted sample data in text format in the fine-tuning stage. This allows the training time to be short and the fine-tuned language model to be well adapted to processing the converted sample data in text format. That is, the pre-trained language model in this embodiment can be pre-trained based on a large amount of natural language text.
[0057] In the scenario of semantic recall, the language model of the present embodiment can be a semantic search module and / or a sorting model. The language model can be pre-trained using the common training method in current state-of-the-art natural language processing. Under this, many mainstream natural language processing tasks can be achieved with good results. For example, the technical solution of the present embodiment can use sample data in converted text format to fine-tune the pre-trained language model to achieve data recall and sorting in all formats.
[0058] Specifically, a large amount of weakly supervised data in a text search scenario can be used to pre-train a semantic search model and a sorting model, and then in the fine-tuning stage, the pre-trained semantic search model and the sorting model can be used on data in various formats, so that some niche, data-scarce scenarios can enjoy the dividends of the language model, and the effect can be further improved with the help of a large amount of text data.
[0059] The language model training method of this embodiment adopts the above method to convert non-text format sample data into text format sample data, and then fine-tune the pre-trained language model based on the converted text format sample data, and then apply the language model to process the converted text format data. Therefore, the language model trained by the method of this embodiment can perform unified modeling, unified management, and unified maintenance based on all sample data of different formats, which can reduce costs and effectively improve modeling, management, and maintenance efficiency compared with the conventional case where sample data of different formats are individually modeled, managed, and maintained.
[0060] For example, in a field scenario where the sample data is in a non-text format, the technical solution of the embodiment shown in Figure 2 above can be used to pre-tune the language model in the field scenario based on weakly supervised data. If further iteration of the effect is required, the end-to-end effect of the language model in the field scenario can be evaluated, and the poor expression of the language model can be found out and directional optimization can be performed. For example, the following aspects can be included.
[0061] The first aspect is the problem of model robustness. Specifically, after the embodiment shown in FIG. 2 described above, the following steps can be included:
[0062] (a1) Based on a test set of a predetermined scenario, detect whether the accuracy of the trained language model meets a first predetermined requirement, and if not, execute step (b1), and if yes, do nothing temporarily.
[0063] (b1) Mine sample data for a given scenario.
[0064] (c1) Training a language model based on sample data of a given scenario.
[0065] The given scenario in this embodiment may be a scenario in which sample data in a non-text format is applied to validate a trained language model.
[0066] For example, a test set of the given scenario is used to detect whether the accuracy of the language model meets a first predetermined requirement. The first predetermined requirement may refer to a preset accuracy requirement, such as an accuracy of 90% or more, or an accuracy of 95% or more. If the accuracy does not reach this requirement, it indicates that the language model needs to be fine-tuned and optimized using sample data of the given scenario. In this case, the sample data of the given scenario is further mined to train the language model. Alternatively, the language model can be further fine-tuned based on the mined sample data of the given scenario to make the language model suitable for the given scenario, and the accuracy of the language model can be further improved.
[0067] For example, in an entity-attribute Q&A scenario, the language model may have problems such as entity matching errors, attribute range matching errors, etc. In this case, a certain strategy can be adopted to directionally mine such data to further fine-tune the language model and further improve the accuracy of the language model.
[0068] The second aspect is the over-recall problem of the model. When the language model is the semantic search model, the fine-tuning of the embodiment shown in Fig. 2 above is to fine-tune the semantic search model accordingly. Specifically, after the embodiment shown in Fig. 2 above, the following steps can be included:
[0069] (a2) Based on the test set of semantic search and the original semantic search model, detect whether the recall result of the semantic search model is within a second predetermined requirement. If not, execute step (b2); if yes, do nothing temporarily.
[0070] (b2) Train a semantic retrieval model based on the recall results.
[0071] The original semantic search model of this embodiment is trained using sample data whose source data is in text format, that is, in this embodiment, the semantic search model obtained by training is verified using the original semantic search model.
[0072] Specifically, for any query in the semantic search test set, the recall result of the original semantic search model and the recall result of the trained semantic search model are obtained, and the difference between the two recall results is compared to see whether it is within a second predetermined requirement. If the recall result of the semantic search model recalls a search result that should not be recalled, the corresponding negative sample data should be constructed based on the recall result, and the semantic search model should be trained and further fine-tuned to prevent the semantic search model from recalling results that should not be recalled, so as to further improve the accuracy of the model.
[0073] In practical applications, for simple queries in online logs, the trained semantic search model can return accurate results, but at the same time, some answers that should not be returned may be triggered. In such a case, as in the present embodiment, a method of taking the difference (diff) with the original semantic search model of general-purpose text training is adopted, and the over-recalled ones are mined and added to the training set as negative samples, so that the semantic search model can be further fine-tuned and the accuracy of the model can be further improved.
[0074] The third aspect is the problem of unreliable model scoring. This problem may occur in models where the language model is a semantic search model, as well as in models where the language model is a sorting model. For example, for some border samples, the language model may have a problem of biased and unreliable scoring. Based on this problem, specifically, after the embodiment shown in FIG. 2 above, the following steps can be included.
[0075] (a3) Obtain multiple reference language models in different settings.
[0076] (b3) Detect whether the processing ability of the language model meets a third predetermined requirement according to the test samples of the test set and the multiple reference models. If not, execute step (c3); if yes, do nothing at once.
[0077] (c3) Training a language model based on the test samples.
[0078] For example, detecting whether the processing capability of the language model satisfies the third predetermined requirement based on the test sample of the test set and the multiple reference models can specifically include obtaining a test processing result corresponding to the language model, such as scoring the test sample by the language model, based on the test sample of the test set, and obtaining an overall processing result based on the test sample and the multiple reference language models. The overall processing result here can be understood as a result of comprehensively considering the processing results of the test sample by the multiple reference language models. For example, the scoring of the test sample by each of the multiple reference language models can be obtained. Next, an overall score is obtained based on the scoring of the test sample by each of the multiple reference language models. For example. The overall score may be equal to the average score of the multiple reference language models, or the test sample may be scored based on the multiple reference language models using other mathematical expressions. Finally, detecting whether the processing capability of the language model satisfies the third predetermined requirement based on the overall processing result and the test processing result. For example, comparing whether the difference (diff) between the score of the test sample by the language model and the overall score satisfies the third predetermined requirement, for example comparing whether it is smaller than a predetermined threshold. If it is positive, it indicates that the score of the language model is valid and not significantly different from the overall score. On the other hand, if the third predetermined requirement is not met, for example, if it is greater than a predetermined threshold, it can be considered that the score of the current test sample by the language model is inappropriate. In this case, the accuracy of the language model can be improved by simply mining the test sample that is incorrectly scored by the language model and adding it to the training set and performing reinforcement training.
[0079] By verifying the above three aspects and directionally mining sample data if the requirements are not met, the language model can be iterated several more times to obtain an end-to-end language model that fits the scenario in the target field and exceeds the effectiveness of conventional systems.
[0080] Through the enhanced training of the above three aspects, the accuracy of the language model can be further improved and the language model can be more suitable for the scenario of the corresponding domain.
[0081] In the prior art, for general data such as text and pictures, researchers have made great efforts to develop effective search algorithms based on the data of the corresponding categories. Such data has a unified format and a very large amount of data, so that accurately improving the search ability of such data will bring great benefits to the final search effect. Meanwhile, structured data such as tables and knowledge maps often have different formats, making it difficult to search and model in the same way, and the scale of each type of data is not large, so the benefit of designing a search algorithm is relatively small. Therefore, the search effect of various structured data varies widely, which is a weakness in the entire search business. According to the above-mentioned aspects of the embodiment of the present disclosure, it is possible to uniformly model, manage, and maintain the data based on sample data of various formats. For example, a language model can be trained using a large amount of text data, and then the non-text format sample data in the scenario of the field is converted into text format sample data, and the trained language model can be fine-tuned based on the converted text format sample data, so that the language model can be applied to the scenario of the field. In practical applications, the language model can be fine-tuned using sample data in non-text formats in various domain scenarios, so that the language model can adapt to various domain scenarios, has the ability to handle data in various formats, and is highly practicable.
[0082] According to the above-mentioned language model training method of the present embodiment, modeling can be realized with the same simple architecture whether it is unstructured text data or structured or semi-structured data. Each type of data can be fine-tuned with a small amount of data on a base model, which is a pre-trained language model, to obtain good results.
[0083] According to the language model training method of the present embodiment, the research and development cost is low, and it is only necessary to fine-tune the language model using sample data of text formats in different fields, and there is no need to create complex templates or rules based on business logic, and model transfer between different fields can be quickly realized, so that the personnel cost and research and development cost can be greatly reduced. For all types of data, the most advanced pre-trained language model can be used, and the advantages of text data can be transferred to other types with less data, so that the effect of the corresponding language processing can be effectively improved.
[0084] 3 is a schematic diagram according to a third embodiment of the present disclosure. As shown in FIG. 3, the present embodiment provides a language model training device 300, which includes a conversion module 301 for converting sample data in a non-text format into sample data in a text format, and a training module 302 for training a language model based on the converted sample data in the text format.
[0085] The implementation principle and technical effect of the language model training device 300 of this embodiment, which uses the above-mentioned modules to implement language model training, are the same as those of the above-mentioned embodiment of the related method. For details, please refer to the description of the above-mentioned embodiment of the related method, and therefore will not be described in detail here.
[0086] 4 is a schematic diagram according to a fourth embodiment of the present disclosure. As shown in FIG. 4, this embodiment provides a language model training device 400 including a conversion module 401 and a training module 402, which are modules with the same names and functions as those in FIG. 3 described above.
[0087] In this embodiment, when the sample data in non-text format contains structured data, the conversion module 401 concatenates each part of the data in the structured data to convert it into sample data in text format; or when the sample data in non-text format contains a picture, the conversion module 401 extracts characters corresponding to the picture to obtain sample data in text format.
[0088] Further, in one embodiment of the present disclosure, the conversion module 401 uses an optical character recognition method to recognize characters in the picture to obtain sample data in text format, and / or uses a pre-trained information extraction model to extract characters corresponding to the picture to obtain sample data in text format.
[0089] Further, as shown in FIG. 4, the language model training apparatus 400 of this embodiment may include a mining module 403 for mining sample data in a non-text format clicked by a user from an online log as positive sample data.
[0090] Further, as shown in FIG. 4, the language model training apparatus 400 of the present embodiment may include a detection module 404 .
[0091] The detection module 404 detects whether the accuracy of the trained language model meets a first predetermined requirement based on a test set of a predetermined scenario, where the sample data in a non-text format is applied.
[0092] The mining module 403 further mines sample data for the given scenario if not satisfied.
[0093] The training module 402 trains a language model based on sample data of a given scenario.
[0094] In addition, in one embodiment of the present disclosure, when the language model is a semantic search model, the detection module 404 further detects whether the recall result of the semantic search model is within a second predetermined requirement based on the test set of semantic search and the original semantic search model, where the original semantic search model was trained with sample data whose source data is in text format.
[0095] The training module 402 further trains a semantic search model based on the recall results in the negative case.
[0096] Further, in one embodiment of the present disclosure, the language model training apparatus 400 of the present embodiment may include an acquisition module 405 .
[0097] The acquisition module 405 acquires multiple reference language models in different settings.
[0098] The detection module 404 further detects, based on the test samples of the test set and the multiple reference models, whether the processing capability of the language model meets a third predetermined requirement.
[0099] The training module 402 further trains the language model based on the test samples if not met.
[0100] Further, in an embodiment of the present disclosure, the detection module 404 obtains a test processing result corresponding to the language model based on the test samples in the test set, obtains an integrated processing result based on the test samples and multiple reference language models, and detects whether the processing capability of the language model meets a third predetermined requirement based on the integrated processing result and the test processing result.
[0101] Furthermore, in one embodiment of the present disclosure, the training module fine-tunes the pre-trained language model based on the sample data in the converted text format.
[0102] The implementation principle and technical effect of the language model training device 400 of this embodiment, which uses the above modules to realize language model training, are the same as those of the embodiment of the related method. For details, please refer to the description of the embodiment of the related method, so a detailed description is not provided here.
[0103] In the technical solution disclosed herein, the acquisition, storage, application, etc. of personal information of users involved are in accordance with the provisions of relevant laws and regulations and are not contrary to public order and morals.
[0104] According to an embodiment of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium, and a computer program product.
[0105] 5 shows a schematic block diagram of an exemplary electronic device 500 capable of implementing embodiments of the present disclosure. The electronic device represents various forms of digital computers, such as laptops, desktop computers, workbenches, servers, blade servers, mainframes, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as PDAs, mobile phones, smartphones, wearable devices, and other similar computing devices. The components, their connections and relationships, and their functions shown herein are merely examples and are not intended to limit the implementation of the present disclosure as described and / or claimed herein.
[0106] 5, the device 500 includes a computing means 501 capable of performing various appropriate operations and processes according to a computer program stored in a read only memory (ROM) 502 or loaded from a storage means 508 into a random access memory (RAM) 503. The RAM 503 may store various programs and data necessary for the operation of the device 500. The computing means 501, the ROM 502, and the RAM 503 are connected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0107] Several components of device 500 are connected to I / O interface 505, including input means 506, e.g. a keyboard, mouse, etc., output means 507, e.g. various types of displays, speakers, etc., storage means 508, e.g. magnetic disks, optical disks, etc., and communication means 509, e.g. a network card, modem, wireless communication transceiver, etc. The communication means 509 enables device 500 to exchange information / data with other devices via computer networks, e.g. the Internet, and / or various telecommunication networks.
[0108] The computing means 501 may be various general-purpose and / or dedicated processing components having processing and computing capabilities. Some examples of the computing means 501 include, but are not limited to, a central processing unit (CPU), a graphic processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that execute machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing means 501 executes various methods and processes described above, such as the methods of the present disclosure. For example, in some embodiments, the methods of the present disclosure may be implemented as a computer software program physically embodied in a machine-readable medium, such as the storage means 508. In some embodiments, some or all of the computer program may be loaded and / or installed in the device 500 via the ROM 502 and / or the communication means 509. When the computer program is loaded into the RAM 503 and executed by the computing means 501, one or more steps of the above methods of the present disclosure may be executed. Alternatively, in other embodiments, the computing means 501 may be configured in any other suitable manner (eg, via firmware) to perform the methods of the present disclosure.
[0109] Various embodiments of the systems and techniques described herein may be implemented in digital electronic circuitry systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), field programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include being embodied in one or more computer programs that may be executed and / or interpreted on a programmable system that includes at least one programmable processor. The programmable processor may be a special purpose or general purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and may transfer data and instructions to the storage system, the at least one input device, and the at least one output device.
[0110] Program codes for implementing the methods of the present disclosure can be written using any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general purpose computer, a special purpose computer, or other programmable data processing apparatus such that, when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are performed. The program codes can be executed entirely on the machine, partially on the machine, as a stand-alone package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0111] In the context of this disclosure, a machine-readable medium is a tangible medium that can contain or store a program used by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination thereof. More specific examples of machine-readable storage media include one or more line-based electrical connections, portable computer disks, hard disks, random access memories (RAMs), read-only memories (ROMs), erasable programmable read-only memories (EPROMs or flash memories), optical fibers, portable compact disk read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0112] To provide interaction with a user, the systems and techniques described herein may be implemented on a computer that includes a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user, and a keyboard and pointing device (e.g., a mouse or trackball) for providing input to the computer by the user. Other types of devices may also be used to provide interaction with a user. For example, feedback provided to the user may be any form of sensing feedback (e.g., visual feedback, auditory feedback, or haptic feedback), and input from the user may be received in any form (including sound input, speech input, or tactile input).
[0113] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a client computer having a graphical user interface or a web browser through which a user can interact with embodiments of the systems and techniques described herein), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communications network). Examples of communications networks include a local area network ("LAN"), a wide area network ("WAN"), and an internetwork.
[0114] The computer system may include clients and servers. The clients and servers are generally remote from each other and typically interact through a communication network. The relationship of the clients and servers arises by computer programs running on the corresponding computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server in combination with a blockchain.
[0115] It should be understood that steps can be rearranged, added, or removed using the various types of flows shown above. For example, each step described in this application can be performed in a parallel order or a sequential order, or can be performed in a different order, and is not limited thereto, as long as the desired results of the technical solution disclosed in this application can be achieved.
[0116] The above specific embodiments do not constitute limitations on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, partial combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the scope of protection of this application.
Claims
1. A computer-implemented method for training a language model, comprising: converting the sample data in a non-text format into sample data in a text format; training a language model based on the converted sample data in the text format; converting the sample data in the non-text format into the sample data in the text format includes, when the sample data in the non-text format includes structured data, converting the structured data into the sample data in the text format by concatenating data of each portion of the structured data; The structured data includes data in a json format and table data, The step of converting the data of each part in the structured data into the sample data in the text format by concatenating the data of each part in the structured data is performed by For the json format data, extract the key and value contents and sequentially concatenate them as text, or For the table data, the contents and headers of each cell are concatenated to generate data in a short text format, and the short texts of all the cells are concatenated in sequence. How to train a language model.
2. Prior to converting the sample data in non-text format into sample data in text format, mining sample data of the non-text format clicked by users from an online log as positive sample data; The method of claim 1 further comprising:
3. After training a language model based on the converted sample data in the text format, Detecting whether the accuracy of the trained language model satisfies a first predetermined requirement based on a test set of predetermined scenarios to which sample data in a non-text format is applied; mining sample data of the predetermined scenario if the first predetermined requirement is not met; training the language model based on sample data of the given scenario; The method of claim 1 further comprising:
4. After training a language model based on the converted sample data in the text format, If the language model is a semantic search model, detect whether a recall result of the semantic search model is within a second predetermined requirement based on a test set of semantic search and an original semantic search model trained using sample data, the source data of which is in text format; if not within a second predetermined requirement, training the semantic search model based on the recall results; The method of claim 1 further comprising:
5. After training a language model based on the converted sample data in the text format, Obtaining multiple reference language models in different settings; Detecting whether the processing capability of the language model satisfies a third predetermined requirement based on the test samples of a test set and the plurality of reference language models; training the language model based on the test samples if a third predetermined requirement is not met; The method of claim 1 , further comprising:
6. Detecting whether a processing capability of the language model satisfies a third predetermined requirement based on test samples of a test set and the plurality of reference language models includes: obtaining a test processing result corresponding to the language model based on test samples in the test set; obtaining an integrated processing result based on the test sample and the plurality of reference language models; Detecting whether the processing capability of the language model satisfies the third predetermined requirement based on the integrated processing result and the test processing result.
6. A method for training a language model according to claim 5, comprising:
7. the language model is a pre-trained model; Training a language model based on the converted sample data in the text format includes: fine-tuning the pre-trained language model based on sample data in the converted text format; 2. A method for training a language model according to claim 1, comprising:
8. An apparatus for training a language model, comprising: a conversion module for converting the sample data in a non-text format into sample data in a text format; a training module for training a language model based on the converted sample data in the text format; The conversion module, when the sample data in the non-text format includes structured data, converts the structured data into the sample data in the text format by concatenating data of each part in the structured data; The structured data includes data in a json format and table data, The conversion module includes: For the data in the JSON format, extract the contents of the keys and values and sequentially concatenate them as text, or For the table data, the contents and headers of each cell are concatenated to create data in a short text format, and the short texts of all the cells are concatenated in sequence; A language model training device.
9. The method further includes a mining module for mining sample data of the non-text format clicked by a user from an online log as positive sample data.
9. An apparatus for training a language model according to claim 8.
10. Further comprising a detection module; The detection module detects whether the accuracy of the trained language model meets a first predetermined requirement based on a test set of predetermined scenarios to which sample data in a non-text format is applied; The mining module further comprises mining sample data of the predetermined scenario if a first predetermined requirement is not met; the training module trains the language model based on sample data of the given scenario; 10. An apparatus for training a language model according to claim 9.
11. The detection module further detects, when the language model is a semantic search model, whether a recall result of the semantic search model is within a second predetermined requirement based on a test set of semantic search and an original semantic search model trained using sample data whose source data is in text format; The training module further trains the semantic search model based on the recall result if the recall result is not within a second predetermined requirement. An apparatus for training a language model according to claim 10.
12. Further comprising an acquisition module; The acquisition module acquires a plurality of reference language models in different settings; The detection module further detects whether the processing capability of the language model meets a third predetermined requirement based on the test samples of a test set and the plurality of reference language models; The training module further trains the language model based on the test samples if a third predetermined requirement is not satisfied. An apparatus for training a language model according to claim 10.
13. The detection module includes: obtaining a test processing result corresponding to the language model based on test samples in the test set; Obtaining an integrated processing result based on the test sample and the plurality of reference language models; Detecting whether the processing capability of the language model satisfies the third predetermined requirement based on the integrated processing result and the test processing result. An apparatus for training a language model according to claim 12.
14. The training module includes: fine-tuning the pre-trained language model based on sample data in the converted text format; Apparatus for training a language model according to any one of claims 8 to 13.
15. At least one processor; a memory communicatively coupled to the at least one processor; An electronic device having stored in the memory instructions executable by the at least one processor, the commands, when executed by the at least one processor, causing the at least one processor to perform the method for training a language model according to any one of claims 1 to 7.
16. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method for training a language model according to any one of claims 1 to 7.
17. A computer program product which, when executed by a processor, implements the method for training a language model according to any one of claims 1 to 7.
Citation Information
Patent Citations
Natural language query method based on deep learning
CN111522839A
Language model learning device and program thereof and word estimation device and program thereof
JP2019219827A
Method for extracting information, method for training extraction model, device, and electronic apparatus
JP2021192277A
System and method for automatic language model generation
US20160365090A1