A method and apparatus for generating training data, an electronic device, and a storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GREE ELECTRIC APPLIANCE INC OF ZHUHAI
- Filing Date
- 2026-07-09
- Publication Date
- 2026-08-07
AI Technical Summary
然而,人工标注方式存在标注成本高昂、难以覆盖多样化的实际应用场景等问题
[0021]本发明实施例的一种训练数据的生成方法,需要确定设备功能语义图谱,设备功能语义图谱包括多个设备的设备实体、功能参数、操作约束及设备间协同关系;根据设备功能语义图谱和预设提示词模板,生成预设场景对应的多个自然语言指令变体;根据自然语言指令变体和设备功能语义图谱,确定各自然语言指令变体对应的操作序列;在虚拟设备环境中,分别执行各自然语言指令变体对应的操作序列,生成各自然语言指令变体对应的操作逻辑链,操作逻辑链包括操作序列中各操作的执行结果、异常事件记录及异常处理操作;将各自然语言指令变体与对应的操作逻辑链关联,形成训练数据集。本发明实施例以设备功能语义图谱为知识基础,结合预设提示词模板,为预设场景批量生成多个自然语言指令变体,以自动化生成替代人工逐条编写,显著降低了训练数据的构建成本。同时,通过预设提示词模板能够生成涵盖多种句式、多种用词风格的自然语言指令变体,使训练数据能够覆盖多样化的实际应用场景。
Smart Images

Figure CN122531365A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of smart home technology, specifically relating to a method, apparatus, electronic device, and storage medium for generating training data. Background Technology
[0002] In the field of smart home technology, smart home control methods based on large language models are attracting increasing attention. These methods train large language models to understand home control commands issued by users in natural language. Therefore, constructing a high-quality training dataset is a crucial foundation for training high-performance smart home control models.
[0003] Currently, the construction of smart home training datasets typically employs a crowdsourced manual annotation approach. In this method, annotators write user instructions based on pre-defined scenario scripts and manually annotate corresponding standard data to generate training data. However, manual annotation suffers from high costs and difficulty in covering diverse real-world application scenarios. Summary of the Invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a method, apparatus, electronic device and storage medium for generating training data that overcomes or at least partially solves the above problems.
[0005] In a first aspect, embodiments of the present invention provide a method for generating training data, the method comprising: Determine the device functional semantic graph, which includes device entities, functional parameters, operational constraints, and inter-device collaboration relationships of multiple devices; Based on the device functional semantic graph and the preset prompt word template, generate multiple natural language instruction variants corresponding to preset scenarios; Based on the natural language instruction variants and the device function semantic map, determine the operation sequence corresponding to each natural language instruction variant; In a virtual device environment, the operation sequences corresponding to each of the natural language instruction variants are executed respectively to generate an operation logic chain corresponding to each of the natural language instruction variants. The operation logic chain includes the execution result of each operation in the operation sequence, the abnormal event record, and the abnormal handling operation. Each of the natural language instruction variants is associated with its corresponding operation logic chain to form a training dataset.
[0006] Optionally, determining the device functional semantic map includes: Obtain the device manuals for the aforementioned multiple devices; The equipment manual is analyzed to extract the equipment entity, functional parameters, operational constraints, and inter-equipment collaboration relationships. Based on the device entities, functional parameters, operational constraints, and inter-device collaboration relationships, a device functional semantic graph is constructed.
[0007] Optionally, the step of generating multiple natural language command variants corresponding to a preset scenario based on the device functional semantic graph and preset prompt word templates includes: Based on the device functional semantic graph, determine the device entity, functional parameters, and operational constraints corresponding to the preset scenario; Determine the user profile information and scene context information corresponding to the preset scene; The device entity, the functional parameters, the operational constraints, the user profile information, the scene context information, and the preset expression style information are filled into the preset prompt word template to generate a complete prompt word; The complete prompt word is input into the large model to generate multiple natural language instruction variants corresponding to the preset scenario.
[0008] Optionally, in the virtual device environment, executing the operation sequence corresponding to each of the natural language instruction variants includes: The virtual device interface is invoked to execute each operation in the operation sequence sequentially; the virtual device interface triggers an abnormal event with a preset probability. In the event of an abnormal event, execute the backup strategy and record the abnormal event and the execution result of the backup strategy.
[0009] Optionally, after generating multiple natural language instruction variants corresponding to the preset scenario, the generation method further includes: Based on the operational constraints in the device functional semantic graph, natural language instruction variants that do not conform to the operational constraints are eliminated; The remaining natural language instruction variants are clustered and deduplicated. Natural language instruction variants with semantic similarity greater than a first preset threshold are grouped into one category, and a preset number of natural language instruction variants are retained in each category.
[0010] Optionally, determining the operation sequence corresponding to each of the natural language instruction variants based on the natural language instruction variants and the device functional semantic map includes: The intent of the natural language instruction variant is parsed to obtain the intent label and function parameters of the natural language instruction variant; Based on the intent tag, query the inter-device collaboration relationship in the device function semantic graph to determine the multiple devices corresponding to the intent tag and the execution priority of each device; The operation sequence is generated based on the function parameters and the execution priority.
[0011] Optionally, the method further includes: When the number of abnormal events triggered by the same device exceeds a second preset threshold, the operational constraints of the device in the device functional semantic graph are enhanced.
[0012] Secondly, embodiments of the present invention provide a training data generation apparatus, the apparatus comprising: The device function semantic graph determination module is used to determine the device function semantic graph, which includes device entities, functional parameters, operational constraints and inter-device collaboration relationships of multiple devices. The natural language instruction variant generation module is used to generate multiple natural language instruction variants corresponding to a preset scenario based on the device functional semantic map and preset prompt word templates; An operation sequence determination module is used to determine the operation sequence corresponding to each of the natural language instruction variants based on the natural language instruction variants and the device functional semantic map; An operation logic chain generation module is used to execute operation sequences corresponding to each of the natural language instruction variants in a virtual device environment to generate operation logic chains corresponding to each of the natural language instruction variants. The operation logic chain includes the execution result of each operation in the operation sequence, an exception event record, and an exception handling operation. The training dataset forming module is used to associate each of the natural language instruction variants with the corresponding operation logic chain to form a training dataset.
[0013] Optionally, the device functional semantic graph determination module includes: The equipment manual acquisition submodule is used to acquire the equipment manuals of the multiple devices. The equipment manual parsing submodule is used to parse the equipment manual and extract the equipment entity, functional parameters, operating constraints and inter-equipment collaboration relationships. The device function semantic graph construction submodule is used to construct a device function semantic graph based on the device entities, functional parameters, operational constraints, and inter-device collaboration relationships.
[0014] Optional, the natural language instruction variant generation module includes: The corresponding device data acquisition submodule is used to determine the device entity, functional parameters and operational constraints corresponding to the preset scenario based on the device functional semantic graph. The corresponding context information acquisition submodule is used to determine the user profile information and scene context information corresponding to the preset scene; The complete prompt word generation submodule is used to fill the device entity, the functional parameters, the operational constraints, the user profile information, the scene context information, and the preset expression style information into the preset prompt word template to generate a complete prompt word; The Natural Language Instruction Variants Generation Submodule is used to input the complete prompt word into the large model and generate multiple natural language instruction variants corresponding to the preset scenario.
[0015] Optionally, the operation logic chain generation module includes: The virtual device interface invocation submodule is used to invoke the virtual device interface to execute each operation in the operation sequence in sequence; the virtual device interface triggers abnormal events with a preset probability. The backup strategy execution submodule is used to execute a backup strategy in the event of an abnormal event, and to record the abnormal event and the execution result of the backup strategy.
[0016] Optionally, the device further includes: The elimination module is used to eliminate natural language instruction variants that do not conform to the operational constraints in the device functional semantic graph. The clustering and deduplication module is used to cluster and deduplicat the remaining natural language instruction variants, grouping natural language instruction variants with semantic similarity greater than a first preset threshold into one class, and retaining a preset number of natural language instruction variants in each class.
[0017] Optionally, the operation sequence determination module includes: The intent parsing submodule is used to perform intent parsing on the natural language instruction variant to obtain the intent label and function parameters of the natural language instruction variant; The execution priority determination submodule is used to query the inter-device collaboration relationship in the device function semantic graph based on the intent tag, and determine the multiple devices corresponding to the intent tag and the execution priority of each device; The operation sequence generation submodule is used to generate the operation sequence based on the function parameters and the execution priority.
[0018] Optionally, the device further includes: The operation constraint update module is used to enhance the operation constraints of the device in the device functional semantic graph when the number of abnormal events triggered by the same device exceeds a second preset threshold.
[0019] Thirdly, embodiments of the present invention provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0020] Fourthly, embodiments of the present invention provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0021] An embodiment of the present invention provides a method for generating training data. This method involves determining a device functional semantic graph, which includes device entities, functional parameters, operational constraints, and inter-device collaborative relationships for multiple devices. Based on the device functional semantic graph and a preset prompt word template, multiple natural language command variants corresponding to a preset scenario are generated. Based on the natural language command variants and the device functional semantic graph, an operation sequence corresponding to each natural language command variant is determined. In a virtual device environment, the operation sequences corresponding to each natural language command variant are executed, generating an operation logic chain corresponding to each natural language command variant. The operation logic chain includes the execution results of each operation in the operation sequence, exception event records, and exception handling operations. Each natural language command variant is associated with its corresponding operation logic chain to form a training dataset. This embodiment of the present invention uses a device functional semantic graph as its knowledge base, combined with a preset prompt word template, to generate multiple natural language command variants in batches for a preset scenario. This automated generation replaces manual writing of each command, significantly reducing the cost of constructing training data. Furthermore, the preset prompt word template enables the generation of natural language command variants covering various sentence structures and word styles, allowing the training data to cover diverse real-world application scenarios. Attached Figure Description
[0022] Figure 1 This is a flowchart illustrating the steps of a method for generating training data according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of a training data generation device according to an embodiment of the present invention. Detailed Implementation
[0023] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] In the field of smart home technology, smart home control methods based on large language models are attracting increasing attention. These methods train large language models to understand home control commands issued by users in natural language. Constructing a high-quality training dataset is a crucial foundation for training high-performance smart home control models.
[0025] Currently, there are two main ways to construct training datasets for smart homes.
[0026] Human crowdsourced annotation. In this method, annotators write user instructions based on preset scenario scripts and manually annotate the corresponding device operation sequences, intent categories, and contextual constraints to generate training data. For example, for the "baby falling asleep" scenario, annotators write instructions such as "Baby is going to sleep, dim the lights" and manually annotate the corresponding operation sequences (such as dimming the lights, closing the curtains, playing white noise, etc.). However, this approach has the following problems: high annotation cost, with high cost for annotating a single high-quality instruction-operation sequence pair, requiring an investment of several million yuan to generate millions of training data sets, which is difficult to meet the urgent need for large-scale data for large model training; insufficient coverage of long-tail scenarios, making it difficult for annotators to exhaustively list complex scenarios in real life such as "baby is sleeping" that have low frequency but diverse needs, resulting in a low proportion of multi-device collaborative operation samples, and insufficient generalization ability of the model when dealing with such scenarios; and convergence of instruction expressions, with manually annotated instructions tending to be standardized in terms of sentence structure and word choice, lacking the ambiguity and colloquialism of real user expressions, such as the difficulty in thinking of or annotating expressions that real users might use, such as "full of atmosphere," which leads to a decrease in the accuracy of intent recognition in actual deployment of the trained model.
[0027] This method uses a template engine to generate instructions in batches. It generates instructions by filling preset slots with templates, for example, filling the template "{device}{action}{parameter}" with "Turn on air conditioning in cooling mode at 24 degrees". However, this method has the following problems: The instructions are semantically limited, resulting in highly homogenized instructions and an inability to generate ambiguous expressions like "The light is too bright," which require inference based on environmental context. It lacks physical constraint modeling for devices, making it difficult for the template engine to model functional constraints such as the requirement that the temperature in air conditioning cooling mode cannot be lower than 16°C. This leads to a significant proportion of generated instructions violating device limitations, polluting the training data. Furthermore, it cannot simulate multi-device collaboration and anomaly handling; the template engine can only generate independent operation instructions for a single device, failing to generate logical chains for multi-device collaboration or simulate abnormal scenarios such as device offline or invalid parameters, and their processing paths.
[0028] One of the core concepts of this invention is to use device functional semantic graphs and preset prompt word templates to automatically generate multiple natural language instruction variants for preset scenarios, execute operation sequences and inject abnormal events in a virtual device environment, forming an instruction-response pair training dataset covering normal and abnormal paths, thereby realizing the automatic generation of training data.
[0029] Reference Figure 1 The diagram illustrates a flowchart of a method for generating training data according to an embodiment of the present invention, which may specifically include the following steps: Step 101: Determine the device functional semantic graph. The device functional semantic graph includes the device entities, functional parameters, operational constraints, and collaborative relationships between multiple devices.
[0030] The training data generation method of this invention is applicable to generating training data for a large language model. The training data is used to train the large language model (smart home control model), enabling the model to understand home control commands issued by the user in natural language and automatically generate corresponding device operation sequences. These device operation sequences are used to control smart home devices, thereby achieving automated control of the smart home devices.
[0031] The entity executing the training data generation method can be an intelligent agent. An intelligent agent is an automated program based on a large language model, which has the ability to perceive the environment, understand user instructions, plan operation sequences, and execute actions. It can receive a target task, reason and plan the target task through the large language model, generate the operation steps required to complete the target task, and execute the operation steps by calling tools or interfaces to achieve the target task.
[0032] Device entities are used to identify specific devices, such as "smart desk lamp," "smart air conditioner," and "smart curtains." Functional parameters describe the adjustable attributes and value ranges of the device, such as the "brightness" parameter of a smart desk lamp and its value range of "1%-100%." Operational constraints define the physical limitations between device functional parameters, such as the maximum brightness of a smart desk lamp in children's mode being 50%. Device collaboration relationships describe the linkage logic and execution priority between multiple devices, such as in the "baby falling asleep" scenario, where lights, curtains, and speakers execute in sequence.
[0033] Step 102: Generate multiple natural language command variants corresponding to preset scenarios based on the device function semantic graph and preset prompt word templates.
[0034] For example, preset scenarios include everyday life scenarios such as "baby falling asleep," "coming home," "leaving home," and "watching a movie." Taking the "baby falling asleep" scenario as an example, the intelligent agent queries the device functional semantic graph based on the scenario identifier to determine the device entities, functional parameters, and operational constraints associated with the scenario. For example, the query results show that the devices associated with the "baby falling asleep" scenario include a smart lamp (brightness parameter, ranging from 1% to 100%, with an upper limit of 50% in children's mode), smart curtains (opening and closing parameters), and a smart speaker (playback parameters). Then, based on the queried device information and preset prompt word templates, multiple natural language command variations are generated, such as "Baby's eyelids are drooping, soften the light a bit," "The child is going to sleep, dim the light," and "The little one is sleepy, soften the light." These command variations express the same or similar intentions but differ in sentence structure and word choice, covering different natural language expressions in the same scenario.
[0035] Step 103: Determine the operation sequence corresponding to each natural language instruction variant based on the natural language instruction variants and the device function semantic map.
[0036] For each natural language instruction variant, the agent determines the device corresponding to the variant and the execution operations of each device based on the device functional semantic map, and generates an operation sequence according to the cooperative relationship between devices. For example, for the instruction variant "Baby's eyelids are drooping, soften the light", the agent determines its corresponding operation sequence based on the device functional semantic map as: [dim the lights, close the curtains, play white noise].
[0037] Step 104: In the virtual device environment, execute the operation sequence corresponding to each natural language instruction variant to generate the operation logic chain corresponding to each natural language instruction variant. The operation logic chain includes the execution result of each operation in the operation sequence, the exception event record, and the exception handling operation. A virtual device environment is a software-simulated execution environment that simulates device operation without requiring a real physical device. The agent invokes the virtual device interface to execute each operation in the operation sequence sequentially. Taking an operation sequence in a "baby falling asleep" scenario as an example, the sequence is: [dimming lights, closing curtains, playing white noise]. The agent executes this operation sequence sequentially in the virtual device environment and records the result of each operation. For example: if the light-dimming operation is successful, the agent records the result as success; if the curtain-closing operation fails, the agent performs an exception handling operation (e.g., attempts to re-execute the operation) and records the exception event and corresponding exception handling operation; if the white noise playback operation is successful, the agent records the result as success. After each operation is completed, the agent concatenates the execution results, exception events, and exception handling operations of each operation in the operation sequence in chronological order to generate an operation logic chain.
[0038] In one implementation, the operation logic chain is stored in the form of a directed acyclic graph (DAG). The nodes of the DAG include device entities, operations in the operation sequence, and the execution results of the operations. The edges of the DAG include temporal relationships and causal relationships. Temporal relationships characterize the chronological order of operations, abnormal events, and abnormal handling operations. Causal relationships characterize the relationship between an abnormal event and the operation that triggered it, as well as the triggering relationship between an abnormal event and an abnormal handling operation.
[0039] For example, the exception event is "Failed to close the curtains operation", and the operation that triggers this exception event is the "close the curtains operation". The exception handling operation is "Attempt to re-execute the operation". Thus, there is a causal relationship (triggering relationship) between "Failed to close the curtains operation" and "Failed to close the curtains operation", and there is also a causal relationship (triggering relationship) between "Failed to close the curtains operation" and "Attempt to re-execute the operation". By using a directed acyclic graph to structure and store the operation sequence, exception event, and exception handling operation according to time and causal relationship, the logical relationship between each node in the operation logic chain is clear and traceable, which facilitates efficient retrieval and use of subsequent training data.
[0040] Step 105: Associate each natural language instruction variant with its corresponding operation logic chain to form a training dataset.
[0041] Each natural language instruction variant corresponds to an operation logic chain, and the two together constitute a training dataset. The agent stores each natural language instruction variant and its corresponding operation logic chain in a structured manner according to a preset data format to form a training dataset.
[0042] In one implementation, the agent also calculates a data quality score for the training dataset, which measures the completeness and reasonableness of the training data. For example, the agent can calculate a completeness score based on whether each piece of training data contains complete instructions, operation logic chains, execution results, etc., and a reasonableness score based on whether the execution results of each operation conform to the device's functional parameters and operational constraints. If the data quality score is lower than a preset threshold, the corresponding training data is regenerated or a prompt message is issued. After associating all natural language instruction variants with their corresponding operation logic chains, the agent forms a training dataset for subsequent training of the smart home control model.
[0043] An embodiment of the present invention provides a method for generating training data. This method involves determining a device functional semantic graph, which includes device entities, functional parameters, operational constraints, and inter-device collaborative relationships for multiple devices. Based on the device functional semantic graph and a preset prompt word template, multiple natural language command variants corresponding to a preset scenario are generated. Based on the natural language command variants and the device functional semantic graph, an operation sequence corresponding to each natural language command variant is determined. In a virtual device environment, the operation sequences corresponding to each natural language command variant are executed, generating an operation logic chain corresponding to each natural language command variant. The operation logic chain includes the execution results of each operation in the operation sequence, exception event records, and exception handling operations. Each natural language command variant is associated with its corresponding operation logic chain to form a training dataset. This embodiment of the present invention uses a device functional semantic graph as its knowledge base, combined with a preset prompt word template, to generate multiple natural language command variants in batches for a preset scenario. This automated generation replaces manual writing of each command, significantly reducing the cost of constructing training data. Furthermore, the preset prompt word template enables the generation of natural language command variants covering various sentence structures and word styles, allowing the training data to cover diverse real-world application scenarios.
[0044] In this embodiment of the invention, step 101, determining the device functional semantic map, may specifically include the following sub-steps: Sub-step S11: Obtain the device manuals for multiple devices.
[0045] The intelligent agent obtains the instruction manuals for multiple devices. These manuals are documents describing the device's functions, parameters, and usage methods, and their formats include, but are not limited to, PDF, WORD, or text formats. For example, the intelligent agent obtains a PDF instruction manual for a brand of smart desk lamp, which contains constraints such as "the maximum brightness in children's mode is 50%."
[0046] Sub-step S12: Parse the equipment manual and extract the equipment entity, functional parameters, operational constraints, and inter-equipment collaboration relationships.
[0047] The intelligent agent can invoke a sequence labeling model to perform sequence labeling on the device instruction manual text to identify device entities, functional parameters, operational constraints, and inter-device collaborative relationships within the manual. During sequence labeling, the BIO labeling method is used to mark each character in the text, where B represents the beginning of an entity segment, I represents the inside of an entity segment, and O represents a non-entity character. By assigning a corresponding label to each character, the boundaries and types of each entity in the instruction manual text are determined, thereby identifying device entities, functional parameters, operational constraints, and inter-device collaborative relationships. For example, taking a smart desk lamp instruction manual as an example, the intelligent agent performs sequence labeling on the manual text and identifies: Device entity: "Smart Desk Lamp"; Functional parameter: "Brightness," with a value range of 1% to 100%; Operational constraint: "Brightness limit is 50% in child mode."
[0048] In the case of multiple devices, the agent also extracts the collaborative relationships between the devices. These relationships describe the functional cooperation and linkage logic between different devices.
[0049] The collaborative relationships extracted by the intelligent agent from the device manual include trigger-response relationships and functional dependencies between devices. A trigger-response relationship refers to the relationship in which a change in the state of one device or an event (trigger) causes another device to perform a corresponding operation (response); a functional dependency relationship refers to the relationship in which the function of one device depends on the state or function of another device as a prerequisite.
[0050] Taking door and window sensors and smart lights as examples: the door and window sensor manual states that it "sends a signal when the door is opened," while the smart light manual states that it "executes the light-on operation after receiving the opening command." The intelligent agent extracts the trigger information ("door open") from the door and window sensor manual and the response information ("executes light-on") from the smart light manual, thus determining the trigger-response coordination relationship of "door and window sensor: door open → smart light: light on."
[0051] After extracting the collaborative relationships of multiple devices, the agent can also determine the execution priority of each device in the collaborative relationship based on the triggering conditions and execution order of each collaborative relationship.
[0052] Sub-step S13: Construct a semantic graph of equipment functions based on equipment entities, functional parameters, operational constraints, and inter-equipment collaboration relationships.
[0053] The device functional semantic graph can be stored in a graph database as a graph structure. Agents create device nodes, parameter nodes, and constraint nodes, and establish directed edges between these nodes. For example, a device node is created with attributes including a device identifier (e.g., "smart desk lamp"); a parameter node is created with attributes including a parameter name (e.g., "brightness") and its value range (e.g., minimum 1, maximum 100); a constraint node is created with attributes including constraint conditions (e.g., "brightness limit is 50% in children's mode"); a "device-parameter" directed edge is established, indicating that the device has this functional parameter; a "constraint-parameter" directed edge is established, indicating that the constraint applies to this functional parameter.
[0054] The device functional semantic graph can also integrate a constraint verification algorithm, which is used to verify whether the target instruction violates operational constraints. When an instruction containing a functional parameter value is received, the constraint verification algorithm queries the semantic graph for the corresponding operational constraints of the device and the functional parameter, and determines whether the functional parameter value meets the operational constraints. If not, the functional parameter value is automatically adjusted to a value that meets the operational constraints, and a correction log is recorded. For example, when a subsequent instruction to "brighten to 70% in child mode" is generated, the semantic graph triggers the constraint verification algorithm, finds that the brightness limit in child mode is 50%, automatically corrects the brightness value from 70% to 50%, and records the correction log.
[0055] It should be noted that the device functional semantic graph can also be stored in the form of RDF (Resource Description Framework) triples, relational database tables, or even a combination of these methods. The core lies in the semantic content it represents, such as device entities, functional parameters, operational constraints, and inter-device collaborative relationships, rather than the specific storage format.
[0056] By automatically extracting equipment entities, functional parameters, operational constraints, and inter-equipment collaboration relationships from equipment manuals and constructing a semantic graph of equipment functions, this approach replaces the traditional method of relying on manual input of equipment information. This reduces the labor costs in the data preparation stage and avoids errors and omissions that may be introduced by manual input, providing an accurate and complete knowledge base for the automated generation of subsequent training data.
[0057] In this embodiment of the invention, step 102, which generates multiple natural language instruction variants corresponding to a preset scenario based on the device functional semantic map and preset prompt word templates, may specifically include the following sub-steps: Sub-step S21: Based on the device functional semantic graph, determine the device entities, functional parameters and operational constraints corresponding to the preset scenario.
[0058] Taking the "baby falling asleep" scenario as an example, the intelligent agent queries the device function semantic graph based on the scenario identifier to determine the device entities, functional parameters, and operational constraints associated with the scenario. For example, the devices associated with the "baby falling asleep" scenario include a smart lamp (brightness parameter, value range 1%-100%, upper limit 50% in children's mode), smart curtains (opening and closing parameters), and a smart speaker (playback parameters).
[0059] Sub-step S22: Determine the user profile information and scene context information corresponding to the preset scene.
[0060] User profile information is used to describe the characteristics of the target user, such as "the family has a 6-month-old baby"; scene context information is used to describe the current environmental state, such as "21:30, the outdoor light is dim".
[0061] In one implementation, the intelligent agent can generate user profile information and scene context information corresponding to a preset scenario through a large model. Taking the "baby falling asleep" scenario as an example, the intelligent agent inputs the scenario identifier "baby falling asleep" into the large model, and the large model generates user profile information and scene context information matching the scenario based on its understanding of smart home scenarios.
[0062] In another implementation, user profile information and scene context information can be pre-installed in the intelligent agent or configured by the user.
[0063] Sub-step S23: Fill the device entity, functional parameters, operational constraints, user profile information, scene context information and preset expression style information into the preset prompt word template to generate complete prompt words.
[0064] The preset prompt template is a pre-defined prompt framework used to organize device capability information, user profile information, scene context information, and expression style information into a structured input suitable for large-scale model understanding, i.e., complete prompts. Device capability information describes the device entities, functional parameters, and operational constraints associated with the preset scene. The expression style layer describes the language style of the generated instruction variations. Expression style information can be colloquial, avoids device names, and includes emotional words.
[0065] Sub-step S24: Input the complete prompt words into the large model to generate multiple natural language instruction variants corresponding to the preset scenario.
[0066] The agent inputs the complete prompt words into a large model, generating multiple natural language command variants corresponding to the preset scenario. The large model can be an LLaMA-3 fine-tuned model (specifically designed for smart home command generation). The agent can control the diversity and randomness of the generated command variants by setting relevant parameters of the large model. By inputting the complete prompt words into the large model to generate multiple natural language command variants, the traditional method of manually writing commands is replaced, significantly reducing the cost of constructing training data. At the same time, by adjusting the generation parameters of the large model, command variants covering various sentence structures and word styles can be generated, enabling the training data to cover diverse real-world application scenarios and improving the scenario coverage and expressive diversity of the training data.
[0067] In this embodiment of the invention, the method further includes: Based on the operational constraints in the device functional semantic graph, natural language instruction variants that do not conform to the operational constraints are eliminated; The remaining natural language instruction variants are clustered and deduplicated. Natural language instruction variants with semantic similarity greater than a first preset threshold are grouped into one category, and a preset number of natural language instruction variants are retained in each category.
[0068] The agent performs parameter rationality verification on each natural language instruction variant, parses the implicit functional parameter values in the natural language instruction variant, queries the operational constraints corresponding to the functional parameters in the device functional semantic graph, and determines whether the implicit functional parameter values meet the operational constraints. If not, the natural language instruction variant is removed.
[0069] Taking the "baby falling asleep" scenario as an example, the instruction variant "Baby's eyelids are drooping, soften the light" contains an implicit brightness parameter. The agent parses the instruction and identifies the implicit brightness value as approximately 15%. The semantic graph shows that the brightness constraint for children's mode is an upper limit of 50%. The agent determines that 15% meets this constraint and retains the instruction. If an instruction variant contains an implicit brightness value of 70%, it is determined that it exceeds the 50% constraint upper limit, and the agent removes that instruction variant.
[0070] The intelligent agent also performs syntax checking and semantic verification. Figure 1 Consistency checks. Syntax checks are used to eliminate instruction variants with syntax errors; meaning... Figure 1 Consistency checks are used to eliminate instruction variants whose intent deviates from the preset scenario.
[0071] The agent calculates the semantic similarity between various natural language command variants, groups command variants with a semantic similarity greater than a first preset threshold into the same category, and retains a preset number of command variants from each category. For example, the agent uses the Sentence-BERT model to calculate the semantic similarity between command variants, groups command variants with a similarity greater than 0.85 into one category, and retains the three most representative command variants from each category. Thus, the agent eliminates invalid commands that do not conform to the device's physical constraints and semantically redundant commands, retaining high-quality command variants. For example, after filtering and deduplication, the agent retains 10 high-quality commands, including "Baby's eyelids are drooping, soften the light a bit," etc.
[0072] After generating multiple natural language command variants corresponding to preset scenarios, command variants that do not meet the constraints are eliminated based on the operational constraints in the device functional semantic graph. This effectively avoids generating invalid training data that violates the physical limitations of the device, thus improving the effectiveness of the training data. At the same time, by clustering and deduplicating the remaining command variants, semantically similar command variants are grouped into one category and a preset number is retained in each category. This removes semantically redundant samples, allowing the training data to cover diverse expressions while maintaining the conciseness and efficiency of the dataset, thus improving the quality of the training data.
[0073] In this embodiment of the invention, step 103, determining the operation sequence corresponding to each natural language instruction variant based on the natural language instruction variants and the device function semantic map, may specifically include the following sub-steps: Sub-step S31: Perform intent parsing on the natural language instruction variant to obtain the intent label and function parameters of the natural language instruction variant.
[0074] Taking the instruction variant "Baby is going to sleep" as an example, the agent performs intent parsing on this instruction variant, identifies the user's intent as "baby falling asleep" (intent label), and extracts the corresponding functional parameters, such as the target brightness of 20%. The agent calls the intent parsing model to process the natural language instruction variant. The intent parsing model outputs structured intent labels and slot filling results, including functional parameters.
[0075] Sub-step S32: Based on the intent tag, query the inter-device collaboration relationship in the device function semantic graph to determine the multiple devices corresponding to the intent tag and the execution priority of each device.
[0076] The agent queries the device functional semantic graph to determine the collaborative relationships between devices, identifying the devices corresponding to the intent label as lights, curtains, and speakers. Execution priority is determined based on the semantic relevance of each device to the intent label. Higher semantic relevance indicates a closer connection between the device and the scene goal corresponding to the intent label, resulting in higher execution priority. For example, in the "baby falling asleep" scenario, dimming the lights has the highest semantic relevance to the goal of "falling asleep" (directly related to the impact of lighting on baby sleep), therefore the lights have the highest priority; closing the curtains has the next highest semantic relevance (related to external light and privacy), therefore the curtains have the next highest priority; and playing white noise from the speakers has the next lowest semantic relevance (serving a soothing role), therefore the speakers have the lowest priority.
[0077] Execution priority can also be determined based on the functional dependencies between devices, meaning that the operation of one device requires a change in the state of another device. For example, closing the curtains should be performed after the lights are dimmed to maintain the continuity of light adjustment. Execution priority can also be determined based on preset scene configuration information, which can be user-defined or system-preset.
[0078] Sub-step S33 generates an operation sequence based on the function parameters and execution priority.
[0079] Based on the function parameter of 20% target brightness and the execution priority of light > curtains > sound, the agent generates the operation sequence: [dimming the light to 20%, closing the curtains, playing white noise].
[0080] By parsing the intention of natural language command variants, the intent labels and functional parameters are obtained. Based on the intent labels, the inter-device collaboration relationships in the device functional semantic graph are queried to determine the corresponding multiple devices and the execution priority of each device. Then, an operation sequence is generated, which enables the intelligent agent to automatically transform ambiguous natural language commands into structured, executable multi-device collaborative operation sequences. This achieves a complete mapping from ambiguous user expressions to precise device control, solving the problems in existing technologies where template engines cannot handle ambiguous expressions and cannot simulate multi-device collaborative logic chains.
[0081] In this embodiment of the invention, step 104, in the virtual device environment, executes the operation sequence corresponding to each natural language instruction variant, which may specifically include the following sub-steps: Sub-step S41: Call the virtual device interface to execute each operation in the operation sequence in sequence; the virtual device interface triggers an abnormal event with a preset probability.
[0082] Sub-step S42: In the event of an abnormal event, execute the backup strategy and record the execution results of the abnormal event and the backup strategy.
[0083] For example, the preset probability is 10%. Abnormal events include device unresponsiveness, invalid parameters, network latency, or state conflicts. Backup strategies include skipping the current operation, performing an alternative operation, or generating a user prompt. Taking the "baby falling asleep" scenario as an example, for the operation of dimming the lights, the agent calls the virtual light device interface to perform the dimming operation. The interface returns success, and the agent records the execution result of the operation as success. For the operation of closing the curtains, the agent calls the virtual curtain device interface to perform the closing operation. The interface triggers a "device offline" abnormality with a 10% probability. The agent executes the backup strategy (skipping the operation and generating a voice prompt "curtain device is temporarily unavailable") and records the abnormal event and the execution result of the backup strategy. For the operation of playing audio, the agent calls the virtual speaker device interface. The interface returns success, and the agent records the execution result of the operation as success.
[0084] By calling the virtual device interface to execute operation sequences in a virtual device environment, device operation behavior can be simulated without relying on real physical devices. This reduces the dependence of training data generation on hardware resources and improves the efficiency and scalability of data generation. At the same time, the virtual device interface triggers abnormal events with preset probabilities, enabling the agent to learn and record abnormal handling operations in the simulation environment. This allows the generated training data to cover the abnormal handling path, improving the fault tolerance and robustness of the trained model in actual deployment.
[0085] In this embodiment of the invention, the method further includes: When the number of abnormal events triggered by the same device exceeds the second preset threshold, the operational constraints of the device in the device functional semantic graph are enhanced.
[0086] During the training data generation process, the agent also executes a feedback mechanism. Taking a curtain device as an example, the agent records the number of times the curtain device experiences an "offline" anomaly during multiple executions of the operation sequence. When the cumulative number of abnormal events triggered by the curtain device exceeds a second preset threshold (e.g., 10 times), the agent determines that the device has a reliability problem and strengthens the operational constraints of the curtain device in the device functional semantic graph. Strengthening operational constraints may include narrowing the range of values for the device's functional parameters, adding pre-verification conditions for the device, reducing the execution priority of the device in the collaborative relationship, or adjusting the device's backup strategy. For example, the agent may reduce the execution priority of the curtain device in the collaborative relationship or add pre-execution state verification to the curtain device when generating subsequent operation sequences. The agent can dynamically optimize the device functional semantic graph based on the execution feedback in the virtual device environment, enabling the agent to adjust the device's usage strategy (such as reducing execution priority or adding pre-verification) based on the device's reliability information during subsequent training data generation, thereby improving the reliability and effectiveness of the generated training data.
[0087] This invention automates the construction of device functional semantic graphs and generates natural language instructions and corresponding device operation sequences that conform to human language habits, thereby systematically solving problems such as high manual annotation costs, semantically limited rule generation, and lack of multi-device collaborative logic. Furthermore, this invention utilizes virtual device interfaces to simulate device responses, generating training data covering both normal and abnormal paths without relying on real physical devices, significantly improving the efficiency and quality of training data generation. Experimental results show that models trained using the training data generated by this invention achieve a 32.6% improvement in the accuracy of understanding fuzzy instructions and a 94.1% success rate in cross-device scheduling. The modular design of this invention supports flexible expansion and possesses significant industrial application value.
[0088] The following detailed description of the training data generation method provided by the present invention is based on a specific embodiment. Assume that a user's home includes a projector (brightness adjustment range 100-300 lumens), a smart lighting system (brightness 1%-100%), and motorized curtains (opening angle 0°-90°). The projector's instruction manual clearly states: "In movie viewing mode, the ambient light must be below 50 lux, otherwise the projection effect will be affected."
[0089] The agent parses the device manual, extracting device entities, functional parameters, operational constraints, and inter-device relationships. Taking a projector manual as an example, the agent uses a sequence labeling model to annotate the text, identifying key entities: "ambient light threshold = 50 lux," "device = projector," and "mode = viewing mode." The model analyzes the context through a context window, confirming that "otherwise it will affect the projection effect" is a consequence description of the constraint, rather than an independent entity. After parsing, the agent generates structured data, including constraint type as environmental constraint, device as projector, mode as viewing mode, and maximum ambient light as 50 lux.
[0090] The agent constructs a semantic graph of device functions based on the extracted device entities, functional parameters, operational constraints, and inter-device collaborative relationships. Specifically, the agent creates a "projector" device node and a "movie viewing mode" mode node in the semantic graph, establishing an association edge between the two. The agent further analyzes the "ambient light < 50 lux" constraint, automatically deducing the devices that need to be associated: smart lights and electric curtains, and establishing the corresponding collaborative relationships. The agent also performs graph verification: calculating the current ambient light intensity, when the detected light brightness is 70% and the curtain opening is 45°, the calculated ambient light is approximately 68 lux, exceeding the 50 lux threshold, triggering a constraint warning and logging the data.
[0091] Based on the device functional semantic graph, the intelligent agent determines the device entities, functional parameters, and operational constraints corresponding to the scenario. Specifically, querying the semantic graph reveals that the devices associated with the "evening movie viewing" scenario include projectors (ambient light constraints), smart lights (brightness parameters), and motorized curtains (opening / closing parameters). It also determines the user profile information and scenario context information corresponding to the preset scenario. For example, the user profile information is "family with movie viewing habits," and the scenario context information is "evening, current light brightness 65%, curtain opening 30%."
[0092] The agent queries the current environmental state from the semantic graph and calculates that the current ambient light is approximately 62 lux. The agent executes parameter calibration logic: with 45 lux as the target ambient light (leaving a 5 lux safety margin for the 50 lux threshold), it calculates in reverse that the light needs to be adjusted to 15% (calculation process: 45 = light × 0.8 + 12 × 0.2, where 12 is the light transmittance when the curtains are completely closed), and the curtains are closed to 10°.
[0093] The intelligent agent fills in the device entity, functional parameters, operational constraints, user profile information, scene context information, and preset expression style information into a preset prompt word template to generate a complete prompt word. This complete prompt word is then input into a large model to generate multiple natural language command variations corresponding to the preset scene. For example, the large model generates command variations such as "Is the light too bright, affecting the projection effect?"
[0094] The agent performs intent parsing on variations of natural language commands to obtain intent labels and functional parameters. For example, parsing the intent "Will the light be too bright and affect the projection effect?" yields the intent label "Movie viewing mode" and the functional parameter "Target ambient light 45 lux". Based on the intent label, it queries the inter-device collaboration relationships in the device functional semantic graph to determine the multiple devices corresponding to the intent and the execution priority of each device. For example, it determines that the devices corresponding to "Movie viewing mode" include lights and curtains, with the execution priority being lights (priority 1) > curtains (priority 2). Based on the functional parameters and execution priorities, it generates an operation sequence. For example, the operation sequence is: [Adjust lights to 15%, close curtains to 10°].
[0095] The agent invokes the virtual device interface to execute each operation in the operation sequence sequentially. For example, it first executes the lighting API, the parameters pass verification, and it returns a success message; then it executes the curtain API, simulating an exception module that triggers a "motor jamming" exception with a 5% probability. The agent records the first failed call and initiates a retry mechanism: the first retry waits 2 seconds before sending the command again; the second retry adjusts the control parameters (increasing the motor torque by 10%); the third call succeeds. The agent records the successful execution of the lighting operation and the successful execution of the curtain operation after experiencing an exception and retrying, and it chains the operation sequence, exception events, and handling actions in chronological order to generate an operation logic chain.
[0096] The agent associates various natural language instruction variants with their corresponding operational logic chains to form a training dataset. The agent also calculates a data quality score for the training dataset to measure its completeness and reasonableness. For example, a completeness score of 95 / 100 and a reasonableness score of 92 / 100 are used. The agent also implements a feedback mechanism: when the number of abnormal event triggers detected by the curtain device exceeds a second preset threshold, it strengthens the operational constraints of the curtain device in the device's functional semantic graph, such as reducing the execution priority of the curtain device in collaborative relationships or adding pre-execution state checks.
[0097] Reference Figure 2 The diagram illustrates a structural schematic of a training data generation device according to an embodiment of the present invention, which may specifically include the following structure: The device function semantic graph determination module 201 is used to determine the device function semantic graph, which includes the device entities, functional parameters, operational constraints and inter-device collaboration relationships of multiple devices. The natural language instruction variant generation module 202 is used to generate multiple natural language instruction variants corresponding to a preset scenario based on the device function semantic map and preset prompt word templates. The operation sequence determination module 203 is used to determine the operation sequence corresponding to each natural language instruction variant based on the natural language instruction variants and the device function semantic map; The operation logic chain generation module 204 is used to execute the operation sequence corresponding to each natural language instruction variant in the virtual device environment and generate the operation logic chain corresponding to each natural language instruction variant. The operation logic chain includes the execution result of each operation in the operation sequence, the exception event record and the exception handling operation. The training dataset forming module 205 is used to associate each natural language instruction variant with the corresponding operation logic chain to form a training dataset.
[0098] This invention discloses a training data generation device that uses a device functional semantic graph as its knowledge base and combines it with preset prompt word templates to generate multiple natural language instruction variants in batches for preset scenarios. This automated generation replaces manual, line-by-line writing, significantly reducing the cost of constructing training data. Furthermore, the preset prompt word templates enable the generation of natural language instruction variants covering various sentence structures and word styles, allowing the training data to cover diverse real-world application scenarios.
[0099] In this embodiment of the invention, the device functional semantic map determination module includes: The equipment manual acquisition submodule is used to acquire equipment manuals for multiple devices; The Equipment Manual Parsing Submodule is used to parse the equipment manual and extract equipment entities, functional parameters, operational constraints, and inter-equipment collaboration relationships. The Equipment Functional Semantic Graph Construction Submodule is used to construct an equipment functional semantic graph based on equipment entities, functional parameters, operational constraints, and inter-equipment collaboration relationships.
[0100] In this embodiment of the invention, the natural language instruction variant generation module includes: The corresponding device data acquisition submodule is used to determine the device entities, functional parameters and operational constraints corresponding to the preset scenario based on the device functional semantic graph; The corresponding context information acquisition submodule is used to determine the user profile information and scene context information corresponding to the preset scene; The complete prompt word generation submodule is used to fill in the device entity, functional parameters, operational constraints, user profile information, scene context information and preset expression style information into the preset prompt word template to generate complete prompt words; The Natural Language Instruction Variants Generation Submodule is used to input the complete prompt word into the large model and generate multiple natural language instruction variants corresponding to the preset scenario.
[0101] In this embodiment of the invention, the operation logic chain generation module includes: The virtual device interface call submodule is used to call the virtual device interface to execute each operation in the operation sequence in sequence; the virtual device interface triggers abnormal events with a preset probability; The backup strategy execution submodule is used to execute backup strategies in the event of an abnormal event, and to record the execution results of the abnormal event and the backup strategy.
[0102] In this embodiment of the invention, the device further includes: The elimination module is used to eliminate natural language instruction variants that do not conform to the operational constraints in the device functional semantic graph. The clustering and deduplication module is used to cluster and deduplicat the remaining natural language instruction variants, grouping natural language instruction variants with semantic similarity greater than a first preset threshold into one class, and retaining a preset number of natural language instruction variants in each class.
[0103] In this embodiment of the invention, the operation sequence determination module includes: The intent parsing submodule is used to parse the intent of natural language command variants to obtain the intent label and function parameters of the natural language command variants; The execution priority determination submodule is used to query the inter-device collaboration relationship in the device function semantic graph based on the intent tag, and determine the multiple devices corresponding to the intent tag and the execution priority of each device. The operation sequence generation submodule is used to generate operation sequences based on function parameters and execution priorities.
[0104] In this embodiment of the invention, the device further includes: The operation constraint update module is used to enhance the operation constraints of the device in the device functional semantic graph when the number of abnormal events triggered by the same device exceeds a second preset threshold.
[0105] The terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and are not used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0106] This invention also provides an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the various processes of the above-described training data generation method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.
[0107] It should be noted that the electronic devices in the embodiments of the present invention include the mobile electronic devices and non-mobile electronic devices described above.
[0108] This invention also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described training data generation method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.
[0109] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0110] This invention also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described training data generation method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0111] It should be understood that the chip mentioned in the embodiments of the present invention may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0112] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of the present invention is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0113] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0114] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of the present invention.
Claims
1. A method for generating training data, characterized in that, The generation method includes: Determine the device functional semantic graph, which includes device entities, functional parameters, operational constraints, and inter-device collaboration relationships of multiple devices; Based on the device functional semantic graph and the preset prompt word template, generate multiple natural language instruction variants corresponding to preset scenarios; Based on the natural language instruction variants and the device function semantic map, determine the operation sequence corresponding to each natural language instruction variant; In a virtual device environment, the operation sequences corresponding to each of the natural language instruction variants are executed respectively to generate an operation logic chain corresponding to each of the natural language instruction variants. The operation logic chain includes the execution result of each operation in the operation sequence, the abnormal event record, and the abnormal handling operation. Each of the natural language instruction variants is associated with its corresponding operation logic chain to form a training dataset.
2. The method for generating training data according to claim 1, characterized in that, The determination of the device functional semantic map includes: Obtain the device manuals for the aforementioned multiple devices; The equipment manual is analyzed to extract the equipment entity, functional parameters, operational constraints, and inter-equipment collaboration relationships. Based on the device entities, functional parameters, operational constraints, and inter-device collaboration relationships, a device functional semantic graph is constructed.
3. The method for generating training data according to claim 1, characterized in that, The step involves generating multiple natural language instruction variants corresponding to a preset scenario based on the device's functional semantic graph and preset prompt word templates, including: Based on the device functional semantic graph, determine the device entity, functional parameters, and operational constraints corresponding to the preset scenario; Determine the user profile information and scene context information corresponding to the preset scene; The device entity, the functional parameters, the operational constraints, the user profile information, the scene context information, and the preset expression style information are filled into the preset prompt word template to generate a complete prompt word; The complete prompt word is input into the large model to generate multiple natural language instruction variants corresponding to the preset scenario.
4. The method for generating training data according to claim 1, characterized in that, The step of executing the operation sequence corresponding to each of the natural language instruction variants in the virtual device environment includes: The virtual device interface is invoked to execute each operation in the operation sequence sequentially; the virtual device interface triggers an abnormal event with a preset probability. In the event of an abnormal event, execute the backup strategy and record the abnormal event and the execution result of the backup strategy.
5. The method for generating training data according to claim 1, characterized in that, After generating multiple natural language instruction variants corresponding to the preset scenario, the generation method further includes: Based on the operational constraints in the device functional semantic graph, natural language instruction variants that do not conform to the operational constraints are eliminated; The remaining natural language instruction variants are clustered and deduplicated. Natural language instruction variants with semantic similarity greater than a first preset threshold are grouped into one category, and a preset number of natural language instruction variants are retained in each category.
6. The method for generating training data according to claim 1, characterized in that, The step of determining the operation sequence corresponding to each natural language instruction variant based on the natural language instruction variant and the device functional semantic map includes: The intent of the natural language instruction variant is parsed to obtain the intent label and function parameters of the natural language instruction variant; Based on the intent tag, query the inter-device collaboration relationship in the device function semantic graph to determine the multiple devices corresponding to the intent tag and the execution priority of each device; The operation sequence is generated based on the function parameters and the execution priority.
7. The method for generating training data according to claim 1, characterized in that, The method further includes: When the number of abnormal events triggered by the same device exceeds a second preset threshold, the operational constraints of the device in the device functional semantic graph are enhanced.
8. A training data generation apparatus, characterized in that, The device includes: The device function semantic graph determination module is used to determine the device function semantic graph, which includes device entities, functional parameters, operational constraints and inter-device collaboration relationships of multiple devices. The natural language instruction variant generation module is used to generate multiple natural language instruction variants corresponding to a preset scenario based on the device functional semantic map and preset prompt word templates; An operation sequence determination module is used to determine the operation sequence corresponding to each of the natural language instruction variants based on the natural language instruction variants and the device functional semantic map; An operation logic chain generation module is used to execute operation sequences corresponding to each of the natural language instruction variants in a virtual device environment to generate operation logic chains corresponding to each of the natural language instruction variants. The operation logic chain includes the execution result of each operation in the operation sequence, an exception event record, and an exception handling operation. The training dataset forming module is used to associate each of the natural language instruction variants with the corresponding operation logic chain to form a training dataset.
9. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the training data generation method as described in claims 1-7.
10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the training data generation method as described in claims 1-7.