Data generation method, model training method, interaction method, apparatus, device, and program product
Patent Information
- Application Number
- PCT/CN2026/083115
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-04-18
- Filing Date
- 2026-03-12
- Publication Date
- 2026-10-22
Smart Images

Figure CN2026083115_22102026_PF_FP_ABST
Abstract
Description
Data generation, model training and interaction methods, devices, equipment and program products
[0001] This disclosure claims priority to Chinese Patent Application No. 202510495080.0, filed with the China Patent Office on April 18, 2025, entitled “Data Generation, Model Training and Interaction Method, Apparatus, Device and Program Product”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates to the fields of computer and artificial intelligence technology, and in particular to a data generation, model training and interaction method, apparatus, device and program product. Background Technology
[0003] With the development of computer technology, Large Language Models (LLMs) are increasingly being applied to various scenarios. In diverse cultural and ideological contexts, the extent to which LLMs grasp cultural knowledge, such as cultural perception and cross-cultural adaptability, is particularly important. By training LLMs with sample datasets that reflect different cultural characteristics, they can acquire diverse cultural knowledge and thus output answers with cultural nuances.
[0004] However, currently, the existing sample datasets that reflect different cultural characteristics are mainly created manually, with sample questions and answers written manually. Manual creation is slow, resulting in low efficiency and limited richness in the acquisition of these sample datasets. Summary of the Invention
[0005] This disclosure provides a data generation, model training, and interaction method, apparatus, device, and program product that can improve the efficiency and richness of data acquisition through automated data generation.
[0006] In a first aspect, this disclosure provides a data generation method, the method comprising:
[0007] Based on the cultural category description information in a multilingual cultural context, determine the cultural vocabulary for the target language;
[0008] Based on the cultural vocabulary of the target language, cultural knowledge of the target language is obtained;
[0009] Using a data generation model, based on the cultural knowledge of the target language, prompt data and response data corresponding to the cultural knowledge are generated. The response data is the response result of the prompt data, and the response data satisfies the cultural knowledge of the target language.
[0010] Optionally, the step of retrieving cultural vocabulary based on the target language to obtain cultural knowledge of the target language includes:
[0011] Based on the cultural vocabulary of the target language, a multilingual search is performed to obtain cultural knowledge of the target language described in multiple languages; the multiple languages include at least the target language and preset languages; the preset languages are related to the application region of the search engine.
[0012] Optionally, the step of generating prompt data and response data corresponding to the cultural knowledge of the target language through a data generation model includes:
[0013] Using the data generation model, based on the cultural knowledge of the target language, cultural characteristic knowledge points of the target language are obtained, and based on the cultural characteristic knowledge points of the target language, the prompt data and the response data are generated.
[0014] Optionally, obtaining cultural characteristic knowledge points of the target language based on the cultural knowledge of the target language through the data generation model includes:
[0015] Based on the cultural knowledge of the target language, a first prompt word is constructed; the first prompt word is used to indicate whether the cultural knowledge of the target language has cultural characteristics.
[0016] The first prompt word is input into the first data generation model to obtain a judgment result on whether the cultural knowledge of the target language has cultural characteristics;
[0017] In response to the judgment result used to characterize the cultural characteristics of the target language's cultural knowledge, a second prompt word is constructed based on the cultural knowledge of the target language and the conditions that the cultural characteristic knowledge points must satisfy.
[0018] The second prompt word is input into the second data generation model to obtain the cultural characteristic knowledge points.
[0019] Optionally, generating the prompt data and response data based on cultural characteristic knowledge points of the target language includes:
[0020] Based on the cultural characteristic knowledge points and the conditions that the prompt data must meet, prompt data corresponding to the cultural characteristic knowledge points is generated.
[0021] Based on the prompt data, the cultural characteristic knowledge points, and the conditions that the response data must meet, the response data corresponding to the prompt data is generated.
[0022] Optionally, before determining the cultural vocabulary of the target language based on the cultural category description information in a multilingual cultural context, the method includes:
[0023] Based on the library classification description information under the multilingual cultural background, obtain the cultural category description information under the multilingual cultural background.
[0024] Optionally, determining the cultural vocabulary of the target language based on cultural category description information in a multilingual cultural context includes:
[0025] Based on the cultural category description information and the scene indication used to describe the region where the target language is used, the cultural category is expanded to the next level to obtain the cultural characteristic category of the target language under the cultural category, and generate multiple cultural terms under the cultural characteristic category of the target language.
[0026] Secondly, this disclosure provides a model training method, the method comprising:
[0027] Obtain a sample dataset, the sample dataset comprising: prompt data and response data generated based on the method as described in any of the first aspects;
[0028] The model is trained using the sample dataset to obtain a prompt response model; the prompt response model is used to output a target response that satisfies the cultural knowledge of the language used in the target prompt based on the target prompt.
[0029] Thirdly, this disclosure provides an interaction method, the method comprising:
[0030] Receive target prompt;
[0031] The target prompt is input into the prompt response model to obtain the target response corresponding to the target prompt; the prompt response model is obtained based on the model training method described in the second aspect; the target response satisfies the cultural knowledge of the language used in the target prompt.
[0032] Output the target response.
[0033] Fourthly, this disclosure provides a data generation apparatus, the apparatus comprising:
[0034] The processing module is used to determine the cultural vocabulary of the target language based on the cultural category description information in a multilingual cultural context.
[0035] The retrieval module is used to retrieve cultural vocabulary based on the target language to obtain cultural knowledge of the target language.
[0036] The generation module is used to generate prompt data and response data corresponding to the cultural knowledge of the target language through a data generation model. The response data is the response result of the prompt data and satisfies the cultural knowledge of the target language.
[0037] Fifthly, this disclosure provides an electronic device, including: a processor and a memory; the processor is communicatively connected to the memory;
[0038] The memory stores computer instructions;
[0039] The processor executes computer instructions stored in the memory to implement the method as described in any one of the first, second, and third aspects.
[0040] In a sixth aspect, this disclosure provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of the first, second, and third aspects.
[0041] In a seventh aspect, this disclosure provides a computer program product comprising a computer program that, when executed by a processor, implements the method as described in any one of the first, second, and third aspects.
[0042] The data generation, model training, and interaction methods, apparatus, devices, and program products disclosed herein determine the cultural vocabulary of the target language by using cultural category description information within a multilingual cultural context. This ensures that the cultural vocabulary of the target language is derived from a combination of multilingual cultures, thereby guaranteeing the richness of the target language's cultural vocabulary and, consequently, the richness of the cultural knowledge obtained through subsequent searches using this vocabulary. The data generation model automates the generation of prompt and response data that reflect the cultural knowledge of the target language. This method eliminates the need for manual writing or annotation of the prompt or response data, reducing reliance on manual labor and thus improving data acquisition efficiency. Furthermore, the automated generation of prompt and response data is not limited by manual annotation capabilities and can automatically generate large amounts of prompt and response data, further enhancing data richness. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 is a flowchart illustrating a data generation method provided in this disclosure;
[0045] Figure 2 is a flowchart illustrating a method for generating prompt data and response data based on cultural knowledge of the target language provided in this disclosure.
[0046] Figure 3 is a flowchart illustrating another data generation method provided in this disclosure;
[0047] Figure 4 is a flowchart illustrating a model training method provided in this disclosure;
[0048] Figure 5 is a flowchart illustrating an interaction method provided in this disclosure;
[0049] Figure 6 is a schematic diagram of a data generation device provided in this disclosure;
[0050] Figure 7 is a schematic diagram of a model training device provided in this disclosure;
[0051] Figure 8 is a schematic diagram of the structure of an interactive device provided in this disclosure;
[0052] Figure 9 is a schematic diagram of the hardware structure of an electronic device provided in this disclosure.
[0053] The accompanying drawings have illustrated specific embodiments of this disclosure, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concepts of this disclosure to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0055] As the user base of large language models grows, their ability to grasp cultural knowledge, such as cultural perception and cross-cultural adaptability, becomes particularly important in contexts with diverse cultures and ideologies.
[0056] When a large language model has a low level of cultural knowledge, it may output culturally incompatible content to users, such as content that does not fit the user's cultural background or even offends the user's culture. Therefore, improving the cultural adaptability of large language models is crucial.
[0057] Currently, large language models can be trained using sample datasets that reflect different cultural characteristics, enabling them to master different cultural knowledge features and output answers with cultural characteristics.
[0058] Existing methods for obtaining sample datasets include manually constructing culture-related multiple-choice questions and providing fixed options to quantify the cultural knowledge mastery of large language models. For example, focusing on cross-cultural conflict scenarios, multiple-choice questions containing correct and distractor options are designed through manual annotation, covering sample datasets in areas such as etiquette, traditional culture, and laws in different regions.
[0059] However, the aforementioned method of obtaining samples by manually crafting questions and answers is limited by the scope of individual human experience. Humans typically only have access to a limited number of discrete cultural categories, lack comprehensive cultural knowledge, and struggle to capture cultural understanding within open contexts. This results in poor richness of sample data obtained from existing datasets. Furthermore, manually constructing sample datasets is inefficient. As the granularity of cultural understanding increases, the human effort required grows exponentially.
[0060] Considering the aforementioned problems with existing methods of acquiring sample datasets, this disclosure proposes a data generation method that reduces reliance on manual labor and automates the acquisition of prompt and response data that reflects cultural knowledge across different languages. This method eliminates the need for manual data annotation and question writing, thus improving the efficiency of sample data acquisition. Furthermore, by automating the generation of prompt and response data, it overcomes the limitations of manual annotation capabilities, enabling the generation of large amounts of prompt and response data and enhancing the richness of the sample data.
[0061] Optionally, the execution subject of the data generation method provided in this disclosure can be, for example, a server, or any electronic device with specific processing capabilities such as a terminal device, and this disclosure does not limit it in this regard.
[0062] The technical solutions of this disclosure will be described in detail below with reference to specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0063] Figure 1 is a flowchart illustrating a data generation method provided in this disclosure. As shown in Figure 1, the method may include the following steps:
[0064] S101. Based on the cultural category description information in a multilingual cultural context, determine the cultural vocabulary for the target language.
[0065] For example, the aforementioned multilingual cultural background can refer to the cultural background of any number of languages. It should be understood that the cultural category description information may differ across different language and cultural backgrounds. The aforementioned multilingual cultural background cultural category description information ensures the richness of the cultural category description information.
[0066] For example, cultural category description information can be used to describe the classification results of cultural topics. For example, the cultural topic can refer to cultural themes that people discuss in daily conversations. It should be understood that this disclosure does not limit the number of levels in the classification of the aforementioned cultural topics. For example, the cultural category description information may include: first-level cultural topic categories, and / or, second-level cultural topic categories, etc.
[0067] For example, if the cultural category description includes a first-level cultural topic category, this cultural topic category could be at least one of the following: social sciences, philosophy and psychology, law, education, linguistics, literature, medicine, applied science and technology, art, leisure, sports and entertainment, etc. If the cultural category description includes a second-level cultural topic category, assuming the cultural topic category includes second-level cultural topic categories under the first-level cultural topic category of art, this cultural topic category could include, for example, art theory and aesthetics, art history, painting, sculpture, architecture, etc.
[0068] It should be understood that this disclosure does not limit the target language. For example, the target language can be any language such as Chinese or English. Alternatively, in some embodiments, the target language can also be a sub-language of a language (such as a local dialect).
[0069] For example, the aforementioned cultural terms could be cultural keywords that reflect the cultural characteristics of the target language. Alternatively, the cultural keywords could also be keywords related to any area of culture within the target language.
[0070] Optionally, the electronic device can construct prompt words based on cultural category description information within the multilingual cultural context, and input these prompt words into a vocabulary generation model to obtain cultural vocabulary for the target language. This vocabulary generation model can be any existing model capable of generating vocabulary keywords based on input information. For example, the vocabulary generation model can be a large language model.
[0071] S102. Search based on cultural vocabulary of the target language to obtain cultural knowledge of the target language.
[0072] For example, the cultural knowledge of the target language mentioned above could be, for instance, the cultural knowledge of the region where the target language is used. For example, the cultural knowledge of the target language could include: cultural knowledge unique to the target language (also known as distinctive cultural knowledge of the target language, such as cultural knowledge not found in other languages), knowledge of cultural differences between the target language and other languages, etc. Optionally, the cultural knowledge of the target language could be, for instance, cultural knowledge of any cultural field (such as literature, education, history, etc.) within the region where the target language is used.
[0073] For example, cultural knowledge can be unimodal data, or it can be multimodal data. Taking unimodal cultural knowledge as an example, it can be text modal data. Taking multimodal cultural knowledge as an example, it can include both text modal data and image modal data.
[0074] It should be understood that this disclosure does not limit the form in which the cultural knowledge of the target language is manifested. For example, the cultural knowledge of the target language can be the content of books such as literature textbooks, the dialogue between two speakers discussing the cultural knowledge of the target language, or any descriptive information that can reflect the cultural knowledge of the target language.
[0075] Optionally, electronic devices can use search engines to retrieve cultural vocabulary related to the target language, thereby obtaining cultural knowledge in that language. For example, an electronic device can use a search engine to retrieve webpage content based on cultural vocabulary in the target language. The electronic device can then use this webpage content as cultural knowledge in the target language.
[0076] S103. Using a data generation model, based on cultural knowledge of the target language, generate corresponding prompt data and response data for the cultural knowledge.
[0077] The aforementioned response data can be the result of responding to the prompt data. Furthermore, this response data must satisfy the cultural knowledge of the target language. For example, the prompt data can be prompt data related to this cultural knowledge.
[0078] For example, taking the prompt data as question data, the corresponding response data is the answer data. Furthermore, the answer data satisfies the cultural knowledge of the target language used in the question data.
[0079] Alternatively, for example, the aforementioned prompt data can also be instruction data. Accordingly, the response data can be the result obtained by executing the data processing purpose (or data processing flow, etc.) indicated by the instruction data based on the instruction data.
[0080] Alternatively, the aforementioned prompt data and response data could also be dialogue data between the two parties. For example, the prompt data could be the speech content of speaker 1, and the response data could be the speech content of speaker 2.
[0081] For example, the data generation model described above can be any existing machine learning model that generates prompt data and response data corresponding to the input content. Alternatively, in some embodiments, the data generation model described above can also be any existing large language model.
[0082] Optionally, taking the above data generation model as a large language model as an example, the electronic device can, for example, construct prompt words based on the cultural knowledge of the target language, and input the prompt words into the large language model to obtain the prompt data and response data corresponding to the cultural knowledge generated by the large language model based on the cultural knowledge of the target language.
[0083] It should be understood that this disclosure does not limit the application scenarios of the aforementioned prompt data and response data. For example, the aforementioned prompt data and response data can be used for model training to obtain a prompt-response model. This prompt-response model can be used to output a target response based on a target prompt. This target response is a target response that satisfies the cultural knowledge of the language used in the target prompt. Alternatively, the aforementioned prompt data and response data can also be used, for example, to test the accuracy of machine learning models, test the accuracy of large language models, and serve as a corpus for chatbots.
[0084] In this embodiment, cultural vocabulary in the target language is determined by using cultural category descriptions within a multilingual cultural context. This ensures that the target language's cultural vocabulary is derived from a combination of multilingual cultures, thereby guaranteeing its richness and consequently ensuring the richness of cultural knowledge obtained through subsequent searches using this vocabulary. A data generation model is used to automatically generate prompt and response data that reflect the cultural knowledge of the target language. This method eliminates the need for manual editing or annotation of the prompt and response data, reducing reliance on human intervention and improving data acquisition efficiency. Furthermore, this automated generation of prompt and response data is not limited by manual annotation capabilities and can automatically generate a large amount of prompt and response data, further enhancing data richness.
[0085] The following section details how electronic devices can determine the cultural vocabulary of the target language based on cultural category descriptions within a multilingual cultural context:
[0086] In some embodiments, the electronic device may, for example, expand the cultural category to the next level based on the cultural category description information and the scene indication for describing the region where the target language is used, to obtain the "cultural characteristic category of the target language" under the cultural category, and generate multiple cultural terms under the cultural characteristic category of the target language.
[0087] Optionally, the scenario indications described above for describing the region where the target language is used can be used, for example, to limit the cultural knowledge of the target language to obtain cultural characteristic categories and cultural vocabulary. By using these scenario indications to describe the region where the target language is used, the accuracy of generating multiple cultural vocabulary items under the cultural characteristic categories of the target language is improved.
[0088] Optionally, the aforementioned cultural characteristic categories for the target language can be summarized based on knowledge of the cultural features of the target language (or knowledge of the cultural differences between the target language and other languages). For example, for any of the aforementioned cultural categories, at least one cultural characteristic category for the target language can be derived from that category. For each of the aforementioned cultural characteristic categories, there may be at least one corresponding cultural term.
[0089] Optionally, the electronic device may, for example, construct prompt words based on the aforementioned cultural category description information, scene indications for describing the region using the target language, and the conditions that the cultural characteristic category and cultural vocabulary must meet, and input the prompt words into a large language model to obtain the cultural vocabulary under the aforementioned cultural characteristic category of the target language.
[0090] For example, the prompt word may include the following:
[0091] Assuming you are an expert in the [Cultural Topics Category] for [The Name of the Region Using the Sample Language], please assess whether there are cultural differences between [The Name of the Region Using the Sample Language] and other regions for each cultural topics category. If cultural differences exist, please expand the cultural topics category to five or more cultural characteristic categories and cultural vocabulary to reflect the cultural uniqueness of [The Name of the Region Using the Sample Language] and to cover as much content as possible.
[0092] Taking the aforementioned prompts as an example, the scenario indications describing the region using the target language could include, for example, descriptions such as "Assuming you are an expert in the [cultural topic category] of [the name of the region using the sample language]". The conditions that the aforementioned cultural characteristic category and cultural vocabulary must meet could include, for example, descriptions such as "Reflecting the cultural uniqueness of [the name of the region using the sample language], covering as much content as possible, and expanding to five or more cultural characteristic categories and cultural vocabulary".
[0093] By using scenario indicators to describe the regions where the target language is used, the cultural categories are expanded to the next level, so that the cultural characteristic categories and cultural vocabulary can meet the scenarios of the target language, that is, meet the cultural characteristics corresponding to the target language, and improve the accuracy of the cultural vocabulary.
[0094] In some embodiments, the electronic device may, for example, obtain the content of textbooks and other books in the target language under the cultural category based on the cultural category description information. Then, the electronic device may, for example, extract keywords from the aforementioned textbooks and other book content to obtain multiple cultural terms in the target language.
[0095] For example, an electronic device can perform a web search based on the above-mentioned cultural category description information and the target language to obtain a preset number of textbooks and other books in the target language.
[0096] Optionally, the electronic device can extract keywords from the content of the aforementioned textbooks and other books in any way, such as referring to any existing keyword extraction method, which will not be elaborated here.
[0097] In some embodiments, the electronic device may obtain the cultural category description information in the multilingual cultural context based on library classification description information in a multilingual cultural context.
[0098] For example, library classification descriptions in a multilingual cultural context can be used to describe library classification systems. These descriptions could include, for instance, the Dewey Decimal Classification (DDC), the Universal Decimal Classification (UDC), or other library classification systems from different language and cultural contexts.
[0099] For example, an electronic device may construct a prompt word based on the library classification description information in the multilingual cultural context (the prompt word may be used to instruct the large language model to summarize multiple cultural topic categories based on the "library classification description information in the multilingual cultural context"), and input the prompt word into the large language model to obtain the cultural category description information in the multilingual cultural context.
[0100] The above method enables the automated acquisition of cultural category descriptions within a multilingual cultural context, based on library classification descriptions. This improves the efficiency of acquiring such descriptions, thereby increasing the efficiency of subsequent acquisition of prompt and response data based on these descriptions. Furthermore, because library classification descriptions encompass comprehensive cultural knowledge, this multilingual approach enhances the richness and comprehensiveness of the information used to determine cultural categories, further enriching the prompt and response data obtained from these descriptions.
[0101] Alternatively, in some embodiments, the electronic device may also receive cultural category description information input by other electronic devices or by humans, for example, through an Application Programming Interface (API) or a Graphical User Interface (GUI). Taking the electronic device receiving manually input cultural category description information as an example, this cultural category description information may be obtained by human analysis of library classification systems within a multilingual cultural context.
[0102] The following provides a detailed explanation of how electronic devices can retrieve cultural knowledge of the target language based on cultural vocabulary:
[0103] Optionally, the cultural knowledge of the target language mentioned above can be described in the target language or in a language other than the target language (that is, the cultural knowledge of the target language can be described in other languages).
[0104] For example, taking the cultural knowledge of the target language as an example: cultural knowledge of the target language described in multiple languages, in some embodiments, the electronic device can, for example, perform multilingual retrieval based on the cultural vocabulary of the target language to obtain the cultural knowledge of the target language described in multiple languages. The multiple languages may include, for example, at least the target language and preset languages.
[0105] For example, the preset language can be different from the target language. Taking an electronic device using a search engine to perform multilingual searches based on cultural vocabulary in the target language, obtaining cultural knowledge of the target language described in multiple languages, as an example, the preset language can be related to the geographical application of the search engine. For instance, assuming the search engine is primarily used by people who speak the first language, the preset language could be the first language, making the retrieved "cultural knowledge of the target language described in the first language" richer, thereby improving the accuracy and richness of subsequent "cultural knowledge of the target language described in multiple languages" obtained based on the search.
[0106] Alternatively, if the preset language is the same as the target language, for example, the electronic device can perform a search based on the cultural vocabulary of the target language to obtain cultural knowledge of the target language described in the target language.
[0107] Optionally, the above-mentioned multilingual retrieval can be implemented by referring to any existing multilingual retrieval method. For example, an electronic device can use cultural terms of the target language as search terms to retrieve the content of web pages in the target language from an internet platform, which serves as the retrieved cultural knowledge of the target language described in the target language; and it can also retrieve the content of web pages in a preset language from an internet platform, which serves as the cultural knowledge of the target language described in the preset language.
[0108] In this embodiment, by performing a multilingual search, the cultural knowledge of the target language described in multiple languages is obtained, enriching the cultural knowledge used to determine subsequent cultural characteristic knowledge points. By increasing the richness of the cultural knowledge used to determine cultural characteristic knowledge points, the accuracy and richness of the determination of these cultural characteristic knowledge points can be improved, further enhancing the accuracy and richness of the subsequent prompt and response data generated based on these cultural characteristic knowledge points.
[0109] The following provides a detailed explanation of how electronic devices, through data generation models, generate corresponding prompt and response data based on cultural knowledge of the target language:
[0110] The following section provides a detailed explanation of how electronic devices can generate corresponding prompts and responses based on cultural knowledge of the target language:
[0111] Figure 2 is a flowchart illustrating a method for generating prompt and response data based on cultural knowledge of a target language, as provided in this disclosure. As shown in Figure 2, as one possible implementation, the method may include the following steps:
[0112] S201. Using a data generation model, based on cultural knowledge of the target language, obtain the cultural characteristics of the target language.
[0113] Optionally, the electronic device may first construct a first prompt word based on cultural knowledge of the target language. This first prompt word can be used to indicate whether the cultural knowledge of the target language has cultural characteristics. Then, the electronic device can input the first prompt word into a first data generation model to obtain a judgment result on whether the cultural knowledge of the target language has cultural characteristics. The first data generation model belongs to the aforementioned data generation model.
[0114] For example, an electronic device can input the aforementioned first prompt word into any existing data generation model, and through this data generation model, obtain a judgment result on whether cultural knowledge of the target language possesses cultural characteristics. For example, the aforementioned data generation model can be any existing large language model.
[0115] For example, the content of the first prompt word could be as follows:
[0116] Assume you are an expert in the [target language]. Please determine whether the text content contains multicultural differences or cultural knowledge specific to the [region where the target language is used]. Output only options A, B, or C; do not output any other content.
[0117] A. Includes cultural differences across different regions
[0118] B. Cultural knowledge unique to the region where the target language is used.
[0119] C. None of the above
[0120] Optionally, if the electronic device outputs A or B, it indicates that the cultural knowledge of the target language possesses cultural characteristics. If the electronic device outputs C, the cultural knowledge of the target language does not possess cultural characteristics. Optionally, if the cultural knowledge of the target language does not possess cultural characteristics, the electronic device may, for example, cease further processing based on the cultural knowledge of the target language.
[0121] The electronic device can respond to the above judgment result to characterize the cultural characteristics of the target language's cultural knowledge. Based on the cultural knowledge of the target language and the conditions that the cultural characteristic knowledge points must satisfy, the electronic device constructs a second prompt word. Then, the electronic device can input the second prompt word into a second data generation model to obtain the cultural characteristic knowledge points. The second data generation model belongs to the aforementioned data generation model.
[0122] For example, the electronic device can input the aforementioned second prompt word into any existing data generation model, and through this data generation model, obtain cultural characteristic knowledge points of the target language based on cultural knowledge of the target language. For example, the second data generation model can be any existing large language model. Optionally, the second data generation model and the aforementioned first data generation model can be the same data generation model or different data generation models; this disclosure does not limit this.
[0123] For example, the content of the second prompt word could be as follows:
[0124] Based on the following references [References], please extract no more than three text fragments that best reflect the unique culture of [the region where the target language is used], especially knowledge points about specific behaviors within that culture.
[0125] Extraction requirements:
[0126] 1. Please do not extract historical information or knowledge points unrelated to [the region where the target language is used].
[0127] 2. Return results in JSON (JavaScript Object Notation, an open standard file and data exchange format) format.
[0128] 3. Language used: [Target language]
[0129] Taking the second prompt word mentioned above as an example, the cultural characteristics knowledge points of the target language can include [reference materials]. The conditions that cultural characteristics knowledge points need to meet can include the three requirements extracted above, as well as, "textual fragments that best reflect the unique culture of [the region where the target language is used], especially knowledge points about specific behaviors in that culture," etc.
[0130] In this embodiment, it is first determined whether the cultural knowledge of the target language has cultural characteristics. If the cultural knowledge of the target language has cultural characteristics, the cultural characteristic knowledge points are obtained. This ensures that the cultural characteristic knowledge points of the target language are obtained based on the existence of cultural characteristics, so that the prompt data and response data corresponding to the cultural knowledge generated based on the cultural characteristic knowledge points reflect the cultural characteristics of the target language.
[0131] S202. Using a data generation model, based on the cultural characteristics of the target language, generate the corresponding prompt data and response data for the aforementioned cultural knowledge.
[0132] In some embodiments, the generation of the above-mentioned prompt data and response data based on cultural characteristics of the target language can be achieved, for example, through the following steps 1 to 2:
[0133] Step 1: Based on the cultural characteristic knowledge points and the conditions that the prompt data must meet, generate prompt data corresponding to the cultural characteristic knowledge points.
[0134] The conditions that the prompt data must meet can be used to restrict aspects such as the content, format, language, and style of the prompt data. For example, the conditions that the prompt data must meet may include at least one of the following:
[0135] Condition 1: The data must not contain any offensive or discriminatory content, nor may it involve any non-compliant or illegal elements;
[0136] Condition 2: The data can be submitted from different cultural backgrounds.
[0137] Condition 3: The data should not use referential words or demonstrative pronouns.
[0138] Condition 4: Output the prompt data directly; do not provide any other content.
[0139] Condition 5: The language of the prompt data is Chinese.
[0140] In one possible implementation, the electronic device can concatenate cultural characteristic knowledge points and the conditions that the prompt data must meet to generate a prompt word. This prompt word is then input into a large language model to obtain the prompt data corresponding to that cultural characteristic knowledge point, output by the large language model.
[0141] Optionally, the prompt may also include role-setting information. For example, the prompt may include: "You are an expert in a certain field." Optionally, the prompt may also include a sample example containing prompt data corresponding to other cultural characteristic knowledge points, to guide the large language model in generating prompt data corresponding to that cultural characteristic knowledge point by referring to the sample example.
[0142] In a specific example, the prompt word could be:
[0143] You are an expert in a specific field within a certain region. Please generate questions targeting the following cultural characteristics and related conditions. Conditions: The questions must not contain any offensive or discriminatory content, nor should they include any non-compliant or illegal elements; questions can be asked within different cultural contexts; do not use referential or demonstrative pronouns; directly output the questions, without providing any other content.
[0144] In another possible implementation, taking the aforementioned prompt data as the question data as an example, multiple question templates can be set according to the conditions that the prompt data must meet. Each question template contains a variable portion of fillable elements. For any given question template, data processing can be performed on the cultural characteristic knowledge points to extract the fillable elements corresponding to those points and fill them into the question template, thereby obtaining the prompt data.
[0145] For example, a question template could be: What is the purpose of the cultural behavior at [location]?
[0146] In the example above, [location] and [cultural behavior] are fillable elements.
[0147] Optionally, the above processing can be applied to all question templates to obtain the corresponding prompt data for the cultural characteristic knowledge point; alternatively, a target prompt template can be determined from all question templates based on the keywords in the cultural characteristic knowledge point, and then the prompt data for the cultural characteristic knowledge point can be generated using the target prompt template. For example, assuming the cultural characteristic knowledge point contains the keyword "because," then the question template containing the keywords "purpose" and "reason" will be determined as the target prompt template.
[0148] In another possible implementation, a corresponding knowledge graph can be constructed based on cultural characteristic knowledge points. Based on the relationships between different entities in the knowledge graph and the conditions that the prompt data must meet, prompt data corresponding to the cultural characteristic knowledge points can be generated.
[0149] For example, assuming the knowledge graph constructed based on cultural characteristic knowledge points is: Wazi (entity A) - performance form (relationship) - Goulan (entity B), then prompt data can be generated: What performance forms are there in Wazi?
[0150] Step 2: Based on the prompt data, cultural characteristics and knowledge points, and the conditions that the response data must meet, generate the response data corresponding to the prompt data.
[0151] In one possible implementation, the conditions that the response data must meet are used to restrict aspects such as the content, format, language, and style of the response data. For example, the conditions that the response data must meet may include at least one of the following:
[0152] Condition 1: Answer in as much detail as possible, and strictly adhere to the provided cultural characteristics knowledge points.
[0153] Condition 2: The answer must be clear, detailed, and comprehensively cover multiple aspects of the provided data.
[0154] Condition 3: Do not use referential words or demonstrative pronouns.
[0155] Condition 4: Output the response data directly; do not provide any other content.
[0156] Condition 5: The language of the response data is Chinese.
[0157] In one possible implementation, the prompt data, cultural characteristic knowledge points, and conditions that the response data must meet can be concatenated to generate a prompt word. This prompt word is then input into a large language model to obtain the response data corresponding to the prompt data output by the large language model.
[0158] Optionally, the prompt may also include role-setting information. For example, the prompt may include: "You are an expert in a certain field." Optionally, the prompt may also include a sample example containing prompt data corresponding to other cultural characteristic knowledge points, to guide the large language model in generating prompt data corresponding to that cultural characteristic knowledge point by referring to the sample example.
[0159] In a specific example, the prompt word could be:
[0160] You are an expert in a specific field within a certain region. Please answer the question based on the following cultural characteristics. Requirements: Answer in as much detail as possible, strictly adhering to the provided cultural characteristics; answers must be clear, comprehensive, and cover all aspects of the question; do not use referential or demonstrative pronouns; provide your answer directly, without providing any additional content; use Chinese.
[0161] Optionally, the prompt words may also include a demonstration example, which contains prompt data and response data corresponding to other cultural feature knowledge points, to guide the large language model to generate response data corresponding to the prompt data by referring to the demonstration example.
[0162] In this embodiment, by utilizing cultural knowledge of the target language, cultural characteristic knowledge points of the target language can be identified, and prompt data and response data can be generated based on these cultural characteristic knowledge points. Through this method, the prompt data and response data can reflect the cultural characteristic knowledge of the target language, thereby enabling the prompt-response model trained based on this data to distinguish the cultural characteristics between languages, thus further improving the accuracy of the target response output by the prompt-response model.
[0163] As another possible implementation, the electronic device could, for example, construct prompt words based on the cultural knowledge of the target language (the prompt words could be used to instruct the generation of multiple prompt data and response data related to the cultural knowledge of a given language). The electronic device could then input these prompt words into a data generation model, such as a large language model, to obtain the prompt data and response data corresponding to the cultural knowledge.
[0164] In some embodiments, after acquiring the aforementioned prompt data and response data, the electronic device may, for example, construct a sample dataset based on the prompt data and response data. This sample dataset can be used for model training to obtain a prompt-response model (which is used to output a target response that satisfies the cultural knowledge of the language used in the target prompt based on the target prompt).
[0165] Optionally, taking multiple target languages as an example, each target language may correspond to multiple prompt data and response data. For instance, after acquiring the multiple prompt data and response data corresponding to the multiple target languages, the electronic device may further balance the quantity of prompt data and response data corresponding to the multiple target languages to ensure that the quantity of prompt data and response data corresponding to different target languages is balanced (e.g., the quantity of prompt data and response data corresponding to different target languages is the same, or the difference between the quantity of prompt data and response data corresponding to different target languages is less than a preset value). Then, the electronic device may, for example, use the balanced prompt data and response data corresponding to each target language as a sample dataset, and use this sample dataset to train the model to obtain the aforementioned prompt-response model.
[0166] The following section details how electronic devices obtain sample datasets based on prompt and response data:
[0167] As one possible implementation, the electronic device can determine the prompt and response data corresponding to a cultural category based on the cultural category to which the prompt and response data belong, and the number of prompt and response data items corresponding to a preset cultural category. Then, the electronic device can obtain a sample dataset based on the prompt and response data corresponding to the aforementioned multiple cultural categories.
[0168] For example, the amount of prompt data and response data corresponding to the above-mentioned cultural categories can be, for instance, pre-stored in the electronic device.
[0169] Optionally, among the above multiple cultural categories, the number of corresponding prompt data and response data for different cultural categories can be the same or different.
[0170] Taking the example that the number of prompt data and response data corresponding to different cultural categories should be the same, by ensuring that the number of prompt data and response data corresponding to different cultural categories is the same, the balance of the number of prompt data and response data corresponding to different cultural categories in the sample dataset is guaranteed. This reduces the deviation of the prompt response model's understanding ability on different cultural categories when the model is trained based on the sample dataset, and further improves the accuracy of the prompt response model.
[0171] As another possible implementation, the aforementioned sample dataset may further include, for example, a first subset of sample data and a second subset of sample data. The electronic device may, for example, obtain the first subset of sample data based on the first prompt data and response data corresponding to the cultural category, and obtain the second subset of sample data based on the second prompt data and response data corresponding to the cultural category.
[0172] The cultural terms corresponding to the first set of prompt data and response data are different from those corresponding to the second set of prompt data and response data.
[0173] By ensuring that the cultural vocabulary corresponding to the first set of prompts and responses differs from that corresponding to the second set of prompts and responses, the first and second sample data subsets become orthogonal subsets of question-answer pairs that do not share the same cultural knowledge. Using this method, taking an example where the first sample data subset contains more prompts and responses than the second sample data subset, the first sample data subset can be used for model training, i.e., as a training set. The second sample data subset can be used for model validation, i.e., as a validation set.
[0174] The data generation method provided in this disclosure will be illustrated by the following embodiments:
[0175] Figure 3 is a flowchart illustrating a data generation method provided in this disclosure. As shown in Figure 3, as a possible implementation, primary cultural topic categories (i.e., the aforementioned cultural categories, for example, primary cultural topic category n in Figure 3) and secondary cultural topic categories (for example, secondary cultural topic category 1 to secondary cultural topic category m in Figure 3) can be constructed manually using five different library classification systems (Library Classification System 1, Library Classification System 2, Library Classification System 3, Library Classification System 4, and Library Classification System 5) from different cultural backgrounds. This ensures that the cultural topic categories can comprehensively consider topics from different cultural backgrounds.
[0176] Then, for each language, the electronic device can embed cultural identity (e.g., the aforementioned scene indication used to describe the region using the target language) and provide thought chain prompts for loading specific cultural attributes (e.g., the conditions that the aforementioned cultural characteristic categories and cultural keywords must meet) to enable the large language model to expand subcategories from top to bottom, constructing cultural characteristic categories (e.g., cultural characteristic category 11, cultural characteristic category 12, cultural characteristic category 13, ..., cultural characteristic category m1, cultural characteristic category m2, Chinese literature, etc.) and cultural keywords.
[0177] Then, for each cultural keyword, such as classical prose, external cultural knowledge in languages such as English and the target language is introduced through multilingual retrieval. The electronic device can also determine whether it has cultural characteristics (such as cultural features and cultural differences) through a large model. If cultural characteristics exist, the next step is to extract cultural knowledge to obtain cultural characteristic knowledge points.
[0178] Electronic devices can, for example, load thought chain prompts generated by specific cultural questions based on cultural knowledge (such as the conditions that the aforementioned prompt data must meet) to enable the large language model to generate questions related to that knowledge point, and then load thought chain prompts generated by specific answers (such as the conditions that the aforementioned response data must meet) to enable the large language model to generate the corresponding detailed answers.
[0179] For example, taking the aforementioned knowledge point about differences as an example, "In major cities of the Song Dynasty, many bustling areas where crowds gathered appeared on the streets, which were then called 'Wazi'. Among the 'Wazi' were places like 'Goulan' for performing dramas and telling stories," the prompt data could be something like: What kinds of performances and entertainment were available in the Wazi of the Song Dynasty?
[0180] Response data could be, for example, that in the Song Dynasty's entertainment districts, there was a performance style called "Goulan." Goulan was a venue for theatrical and storytelling performances. The performances included theatrical performances, storytelling, acrobatics, puppet shows, magic tricks, and more. These diverse programs attracted large audiences. The performances in the entertainment districts were often adapted from popular topics and legends, making them highly entertaining and engaging. Particularly popular programs included classic historical stories. These performances, through their vivid acting and captivating storylines, were deeply loved by the people.
[0181] This disclosure also provides a model training method. Optionally, the execution subject of this model training method can be, for example, a server, or any electronic device with processing capabilities such as a terminal. It should be understood that the execution subject of this model training method can be the same electronic device as the execution subject of the aforementioned data generation method, or it can be a different electronic device; this disclosure does not limit this.
[0182] Figure 4 is a flowchart illustrating a model training method provided in this disclosure. As shown in Figure 4, the method may include, for example, the following steps:
[0183] S301. Obtain the sample dataset.
[0184] For example, the electronic device can receive the aforementioned sample dataset from user input via a GUI or API. Alternatively, the sample dataset can be stored within the electronic device. The electronic device can then retrieve the sample dataset by reading its own stored data.
[0185] The sample dataset may include prompt data and response data obtained based on the method described in any of the foregoing embodiments.
[0186] S302. Train the model using the sample dataset to obtain the prompt response model.
[0187] This prompt-response model can be used to output a target response that satisfies the cultural knowledge of the language used in the target prompt, based on the target prompt.
[0188] Optionally, the electronic device can train a preset model using a sample dataset to obtain the trained prompt response model. For example, the preset model can refer to any existing large language model, which will not be elaborated upon here. The prompt response model can be a large language model obtained after training the model based on the sample dataset.
[0189] Optionally, the electronic device can train the model using a sample dataset to obtain the implementation of the prompt response model, and can refer to any existing model training method. Taking the prompt response model as a large language model as an example, the electronic device can use the cross-entropy loss function to perform supervised fine-tuning (SFT) on the large language model before training using a sample dataset, thereby achieving full parameter fine-tuning of the large language model and obtaining the trained large language model.
[0190] In this embodiment, a prompt-response model is obtained by training the model using the aforementioned sample dataset. Because the sample dataset includes prompt data and response data that reflect multilingual cultural knowledge, the prompt-response model can output a target response that satisfies the cultural knowledge of the language used in the target prompt, thus improving the accuracy of the target response. Furthermore, compared to existing methods that train models using multiple-choice questions, this method of training models using prompt and response data better aligns with the thinking logic of prompt-response models (i.e., providing accurate answers based on questions). Therefore, it can further improve the prompt-response model's ability to consider cultural characteristics, thereby further improving the accuracy of the target response.
[0191] This disclosure also provides an interaction method. Optionally, the executing entity of this interaction method can be, for example, a server, or any electronic device with processing capabilities such as a terminal. Alternatively, the executing entity of this interaction method can also be an interactive system, etc. This disclosure does not limit the executing entity of the interaction method. Taking an electronic device as an example, it should be understood that the executing entity of this interaction method and the executing entity of the aforementioned data generation method can be the same electronic device or different electronic devices.
[0192] The following example, using the interaction system as the executing entity, illustrates this interaction method:
[0193] Figure 5 is a flowchart illustrating an interaction method provided in this disclosure. As shown in Figure 5, the method may include the following steps:
[0194] S401, Receive target prompt.
[0195] Optionally, the aforementioned target prompts can be prompts in any application scenario, such as engaging in dialogue with the user, providing solutions to the user's problems, analyzing and reasoning about text content, and providing the conclusions required by the user.
[0196] For example, taking a prompt-response model as a large language model, the target prompt can also be called a prompt word.
[0197] Optionally, the interactive system may receive the aforementioned target prompts, for example, through a client of the interactive system.
[0198] S402. Input the target prompt into the prompt response model to obtain the target response corresponding to the target prompt.
[0199] The cue response model is obtained based on the model training method described above. For example, this cue response model can be a large language model trained using the aforementioned sample dataset.
[0200] The above target response can satisfy the cultural knowledge of the language used in the target prompt.
[0201] S403, Output target response.
[0202] For example, the interactive system can output the target response through the client so that the user can know the target response in a timely manner.
[0203] In this embodiment, the above-described prompt response model can output a target response that satisfies the cultural knowledge of the language used in the target prompt, thereby improving the accuracy of the target response and enhancing the user experience.
[0204] Figure 6 is a schematic diagram of a data generation device provided in this disclosure. As shown in Figure 6, the data generation device 50 may include: a processing module 51, a retrieval module 52, and a generation module 53.
[0205] Processing module 51 is used to determine the cultural vocabulary of the target language based on the cultural category description information in a multilingual cultural context.
[0206] The retrieval module 52 is used to perform retrieval based on the cultural vocabulary of the target language to obtain cultural knowledge of the target language.
[0207] The generation module 53 is used to generate prompt data and response data corresponding to the cultural knowledge of the target language based on the data generation model. The response data is the response result of the prompt data, and the response data satisfies the cultural knowledge of the target language.
[0208] Optionally, the retrieval module 52 is specifically used to perform multilingual retrieval based on the cultural vocabulary of the target language, to obtain cultural knowledge of the target language described in multiple languages. The multiple languages include at least the target language and preset languages.
[0209] Optionally, the generation module 53 is specifically used to obtain cultural characteristic knowledge points of the target language based on the cultural knowledge of the target language through the data generation model, and generate the prompt data and the response data based on the cultural characteristic knowledge points of the target language.
[0210] Optionally, the generation module 53 is specifically configured to: construct a first prompt word based on the cultural knowledge of the target language; input the first prompt word into a first data generation model to obtain a judgment result indicating whether the cultural knowledge of the target language possesses cultural characteristics; in response to the judgment result representing the existence of cultural characteristics in the cultural knowledge of the target language, construct a second prompt word based on the cultural knowledge of the target language and the conditions that the cultural characteristic knowledge point must satisfy; and input the second prompt word into a second data generation model to obtain the cultural characteristic knowledge point. The first prompt word is used to indicate whether the cultural knowledge of the target language possesses cultural characteristics.
[0211] Optionally, the generation module 53 is specifically used to generate prompt data corresponding to the cultural characteristic knowledge points based on the cultural characteristic knowledge points and the conditions that the prompt data must meet; and to generate response data corresponding to the prompt data based on the prompt data, the cultural characteristic knowledge points, and the conditions that the response data must meet.
[0212] Optionally, the processing module 51 is further configured to obtain the cultural category description information in the multilingual cultural context based on the library classification description information in the multilingual cultural context before determining the cultural vocabulary of the target language based on the cultural category description information in the multilingual cultural context.
[0213] Optionally, the processing module 51 is specifically used to expand the cultural category to the next level based on the cultural category description information and the scene indication for describing the region where the target language is used, to obtain the cultural characteristic category of the target language under the cultural category, and to generate multiple cultural words under the cultural characteristic category of the target language.
[0214] The data generation apparatus 50 provided in this disclosure is used to execute the aforementioned data generation method embodiments. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0215] Figure 7 is a schematic diagram of a model training device provided in this disclosure. As shown in Figure 7, the model training device 60 may include: an acquisition module 61 and a training module 62.
[0216] The acquisition module 61 is used to acquire a sample dataset. The sample dataset includes prompt data and response data acquired based on the data generation method described in any of the preceding embodiments.
[0217] Training module 62 is used to train the model using the sample dataset to obtain a prompt response model. The prompt response model is used to output a target response that satisfies the cultural knowledge of the language used in the target prompt, based on the target prompt.
[0218] The model training device 60 provided in this disclosure is used to execute the aforementioned model training method embodiments. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0219] Figure 8 is a schematic diagram of the structure of an interactive device provided in this disclosure. As shown in Figure 8, the interactive device 70 may include: a receiving module 71, a processing module 72, and an output module 73.
[0220] The receiving module 71 is used to receive target prompts.
[0221] Processing module 72 is used to input the target prompt into the prompt response model to obtain the target response corresponding to the target prompt. The prompt response model is obtained based on the model training method described in any of the foregoing embodiments; the target response satisfies the cultural knowledge of the language used in the target prompt.
[0222] Output module 73 is used to output the target response.
[0223] The interactive device 70 provided in this disclosure is used to execute the aforementioned interactive method embodiments. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0224] Figure 9 is a schematic diagram of the hardware structure of an electronic device provided in this disclosure. The electronic device 80 shown in Figure 9 includes a memory 81, a processor 82, and a communication interface 83. The memory 81, processor 82, and communication interface 83 are communicatively connected to each other. For example, the memory 81, processor 82, and communication interface 83 can be connected via a network. Alternatively, the electronic device 80 may also include a bus 84. The memory 81, processor 82, and communication interface 83 are communicatively connected to each other via the bus 84. Figure 9 shows an electronic device 80 in which the memory 81, processor 82, and communication interface 83 are communicatively connected to each other via the bus 84.
[0225] The memory 81 may be a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 81 may store programs, and when the program stored in the memory 81 is executed by the processor 82, the processor 82 and the communication interface 83 are used to execute at least one method of the data generation, model training, and interaction methods described in any of the foregoing embodiments. The memory may also store data required for at least one method of the data generation, model training, and interaction methods.
[0226] The processor 82 can be a general-purpose CPU, microprocessor, application-specific integrated circuit (ASIC), graphics processing unit (GPU), or one or more integrated circuits.
[0227] The processor 82 can also be an integrated circuit chip with signal processing capabilities. In implementation, at least one method of the data generation, model training, and interaction methods of this disclosure can be completed by the integrated logic circuitry in the hardware of the processor 82 or by instructions in software form. The processor 82 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the following embodiments of this disclosure. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the following embodiments of this disclosure can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 81. Processor 82 reads the information in memory 81 and, in conjunction with its hardware, completes at least one of the data generation, model training and interaction methods disclosed herein.
[0228] The communication interface 83 uses transceiver modules, such as, but not limited to, transceivers, to enable communication between the electronic device 80 and other devices or communication networks. For example, a dataset can be acquired through the communication interface 83.
[0229] When the aforementioned electronic device 80 includes a bus 84, the bus 84 may include a path for transmitting information between various components of the electronic device 80 (e.g., memory 81, processor 82, communication interface 83).
[0230] This disclosure also provides a computer-readable storage medium, which may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. Specifically, the computer-readable storage medium stores program instructions that are used in the methods described in the above embodiments.
[0231] This disclosure also provides a program product including executable instructions stored in a readable storage medium. At least one processor of an electronic device can read the executable instructions from the readable storage medium, and the at least one processor executes the executable instructions to cause the electronic device to perform at least one of the data generation, model training, and interaction methods provided in the various embodiments described above.
[0232] The term "multiple" in this document refers to two or more. The term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Furthermore, the character " / " in this document generally indicates an "or" relationship between the preceding and following related objects; in formulas, the character " / " indicates a "division" relationship between the preceding and following related objects. Additionally, it should be understood that in the descriptions of this disclosure, terms such as "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or order.
[0233] It is understood that the various numerical designations used in the embodiments of this disclosure are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this disclosure.
[0234] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit them. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this disclosure.
Claims
1. A data generating method, wherein, The method includes: Based on the cultural category description information in a multilingual cultural context, determine the cultural vocabulary for the target language; Based on the cultural vocabulary of the target language, cultural knowledge of the target language is obtained; Using a data generation model, based on the cultural knowledge of the target language, prompt data and response data corresponding to the cultural knowledge are generated. The response data is the response result of the prompt data, and the response data satisfies the cultural knowledge of the target language.
2. The method of claim 1, wherein, The retrieval of cultural vocabulary based on the target language to obtain cultural knowledge of the target language includes: Based on the cultural vocabulary of the target language, a multilingual retrieval is performed to obtain cultural knowledge of the target language described in multiple languages; the multiple languages include at least the target language and preset languages.
3. The method of claim 1 or 2, wherein, The process of generating prompt data and response data corresponding to the cultural knowledge of the target language through a data generation model includes: Using the data generation model, based on the cultural knowledge of the target language, cultural characteristic knowledge points of the target language are obtained, and based on the cultural characteristic knowledge points of the target language, the prompt data and the response data are generated.
4. The method of claim 3, wherein, The process of obtaining cultural characteristic knowledge points of the target language through the data generation model, based on the cultural knowledge of the target language, includes: Based on the cultural knowledge of the target language, a first prompt word is constructed; the first prompt word is used to indicate whether the cultural knowledge of the target language has cultural characteristics. The first prompt word is input into the first data generation model to obtain a judgment result on whether the cultural knowledge of the target language has cultural characteristics; In response to the judgment result used to characterize the cultural characteristics of the target language's cultural knowledge, a second prompt word is constructed based on the cultural knowledge of the target language and the conditions that the cultural characteristic knowledge points must satisfy. The second prompt word is input into the second data generation model to obtain the cultural characteristic knowledge points.
5. The method of claim 3, wherein, The generation of the prompt data and response data based on the cultural characteristics knowledge points of the target language includes: Based on the cultural characteristic knowledge points and the conditions that the prompt data must meet, prompt data corresponding to the cultural characteristic knowledge points is generated. Based on the prompt data, the cultural characteristic knowledge points, and the conditions that the response data must meet, the response data corresponding to the prompt data is generated.
6. The method of claim 1 or 2, wherein, Before determining the cultural vocabulary of the target language based on the cultural category description information in a multilingual cultural context, the method includes: Based on the library classification description information under the multilingual cultural background, obtain the cultural category description information under the multilingual cultural background.
7. The method of claim 1 or 2, wherein, The cultural category description information based on a multilingual cultural background determines the cultural vocabulary of the target language, including: Based on the cultural category description information and the scene indication used to describe the region where the target language is used, the cultural category is expanded to the next level to obtain the cultural characteristic category of the target language under the cultural category, and generate multiple cultural terms under the cultural characteristic category of the target language.
8. The method of claim 1 or 2, wherein, After generating prompt data and response data corresponding to the cultural knowledge of the target language using a data generation model, the method further includes: Based on the prompt data and the response data, a sample dataset is constructed; the sample dataset is used for model training to obtain a prompt-response model, and the prompt-response model is used to output a target response that satisfies the cultural knowledge of the language used in the target prompt based on the target prompt.
9. A model training method, wherein, The method includes: Obtain a sample dataset, the sample dataset comprising: prompt data and response data generated based on the method described in any one of claims 1-8; The model is trained using the sample dataset to obtain a prompt response model; the prompt response model is used to output a target response that satisfies the cultural knowledge of the language used in the target prompt based on the target prompt.
10. An interaction method, wherein, The method includes: Receive target prompt; The target prompt is input into the prompt response model to obtain the target response corresponding to the target prompt; the prompt response model is obtained based on the model training method as described in claim 9; the target response satisfies the cultural knowledge of the language used in the target prompt. Output the target response.
11. A data generating apparatus, wherein, The device includes: The processing module is used to determine the cultural vocabulary of the target language based on the cultural category description information in a multilingual cultural context. The retrieval module is used to retrieve cultural vocabulary based on the target language to obtain cultural knowledge of the target language. The generation module is used to generate prompt data and response data corresponding to the cultural knowledge of the target language through a data generation model. The response data is the response result of the prompt data and satisfies the cultural knowledge of the target language.
12. The apparatus of claim 11, wherein, The retrieval module is specifically used for: Based on the cultural vocabulary of the target language, a multilingual retrieval is performed to obtain cultural knowledge of the target language described in multiple languages; the multiple languages include at least the target language and preset languages.
13. The apparatus according to claim 11 or 12, wherein, The generation module is specifically used for: Using the data generation model, based on the cultural knowledge of the target language, cultural characteristic knowledge points of the target language are obtained, and based on the cultural characteristic knowledge points of the target language, the prompt data and the response data are generated.
14. The apparatus according to claim 13, wherein, The generation module is specifically used for: Based on the cultural knowledge of the target language, a first prompt word is constructed; the first prompt word is used to indicate whether the cultural knowledge of the target language has cultural characteristics. The first prompt word is input into the first data generation model to obtain a judgment result on whether the cultural knowledge of the target language has cultural characteristics; In response to the judgment result used to characterize the cultural characteristics of the target language's cultural knowledge, a second prompt word is constructed based on the cultural knowledge of the target language and the conditions that the cultural characteristic knowledge points must satisfy. The second prompt word is input into the second data generation model to obtain the cultural characteristic knowledge points.
15. The apparatus according to claim 13, wherein, The generation module is specifically used for: Based on the cultural characteristic knowledge points and the conditions that the prompt data must meet, prompt data corresponding to the cultural characteristic knowledge points is generated. Based on the prompt data, the cultural characteristic knowledge points, and the conditions that the response data must meet, the response data corresponding to the prompt data is generated.
16. The apparatus according to claim 11 or 12, wherein, The processing module is also used for: Before determining the cultural vocabulary of the target language based on the cultural category description information in the multilingual cultural context, the cultural category description information in the multilingual cultural context is obtained based on the library classification description information in the multilingual cultural context.
17. The apparatus according to claim 11 or 12, wherein, The processing module is specifically used for: Based on the cultural category description information and the scene indication used to describe the region where the target language is used, the cultural category is expanded to the next level to obtain the cultural characteristic category of the target language under the cultural category, and generate multiple cultural terms under the cultural characteristic category of the target language.
18. An electronic device, wherein, include: Processor and memory; The processor is communicatively connected to the memory; The memory stores computer instructions; The processor executes computer instructions stored in the memory to implement the method as described in any one of claims 1-10.
19. A computer-readable storage medium, wherein, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-10.
20. A computer program product, wherein, The computer program product includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1-10.