Instruction identification method and device, storage medium, program product and terminal
By adjusting the parameters of the base language model and fusing device type information, a lightweight intent recognition model is constructed. Combined with verification and update mechanisms, the problems of high cost and weak discrimination ability of cross-device command recognition are solved, and fast and accurate intent recognition is achieved.
Patent Information
- Application Number
- CN202511822777.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-04
- Publication Date
- 2026-02-10
AI Technical Summary
Existing instruction recognition methods are costly and have weak discrimination capabilities when recognizing across devices. Furthermore, large models rely on a large amount of data and computing power and cannot be run offline on devices with limited computing power. Small models are expensive to train and maintain and are difficult to scale up.
A base language model with a small number of parameters is fine-tuned to build an intent recognition model. The model is then combined with device type information to recognize commands. After outputting the initial intent analysis results, the model is verified and/or updated to ensure accuracy and adaptability.
It reduces reliance on hardware resources, simplifies the recognition process, and improves recognition speed and accuracy. It can accurately recognize command intent on different devices and adapt to dynamic scenarios.
Smart Images

Figure CN121502480A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of natural language processing, and in particular to an instruction recognition method, apparatus, storage medium, program product, and terminal. Background Technology
[0002] When using various smart terminal devices, users often encounter situations where the same command can have different intentions on different devices. Existing methods for identifying command intentions typically fall into two categories: one is based on a high-performance large model, which is then fine-tuned using massive amounts of data to distinguish intentions based on subtle semantic differences; the other is to train a small model separately for each device, learning only the mapping relationship between commands and intentions for that specific device. These methods can achieve cross-device intention recognition to some extent, but they still suffer from problems such as high cost and weak discriminative ability. Summary of the Invention
[0003] This application provides an instruction recognition method, apparatus, storage medium, program product, and terminal to solve the technical problems of high cost and weak discrimination ability of existing instruction recognition methods.
[0004] In a first aspect, embodiments of this application provide an instruction recognition method, the method comprising: Obtain the target command for the target device, and input the target command into the preset intent recognition model. The intent recognition model is obtained by adjusting the parameters of the preset base language model. The control intent recognition model outputs initial intent analysis results for the target instruction; The initial intent analysis results are verified and / or updated to obtain the intent analysis results of the target instruction for the target device.
[0005] Secondly, embodiments of this application provide an instruction recognition device, the device comprising: The instruction acquisition module is used to acquire the target instruction for the target device and input the target instruction into the preset intent recognition model. The intent recognition model is obtained by adjusting the parameters of the preset base language model. The model output module is used to control the intent recognition model to output the initial intent analysis results for the target instruction; The result determination module is used to verify and / or update the initial intent analysis results to obtain the intent analysis results of the target instruction for the target device.
[0006] Thirdly, embodiments of this application provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the steps of the method described above.
[0007] Fourthly, embodiments of this application provide a computer program product, including a computer program that, when executed, implements the steps of the above-described method.
[0008] Fifthly, embodiments of this application provide a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is adapted to be loaded by the processor and to execute the steps of the above-described method.
[0009] The beneficial effects of the technical solutions provided in some embodiments of this application include at least the following: This application provides a command recognition method, which acquires a target command for a target device, inputs the target command into a preset intent recognition model, the intent recognition model being obtained by adjusting the parameters of a preset base language model; controls the intent recognition model to output an initial intent analysis result for the target command; verifies and / or updates the initial intent analysis result to obtain the intent analysis result of the target command for the target device. First, a unified intent recognition model is obtained by fine-tuning a base language model with relatively few parameters. This avoids training a separate model for each type of device, reduces dependence on hardware resources, and makes the model easier to deploy and expand. It also avoids the drawback of traditional methods that rely on large amounts of data and computing resources to forcibly distinguish the intents of different devices. The acquired target instructions are input into this model, providing a reliable data foundation for subsequent intent recognition. Then, the initial intent analysis results are directly output through the intent recognition model, achieving a rapid response in intent recognition. Compared with traditional methods that require multiple independent models or complex calculations to distinguish intents, this simplifies the recognition process and improves the recognition speed. At the same time, since the model has been adjusted and optimized, the initial intent analysis results have high accuracy. Finally, the initial intent analysis results are further verified and / or updated to make up for the shortcomings of pure model inference. It can combine the real-time context of the device for refined intent parsing, thereby more accurately determining the specific intent of the target instruction for the target device, enabling the system to correctly respond to user instructions in dynamic scenarios. The method described in this application forms an intent recognition model by fine-tuning parameters based on a base language model. This model outputs initial intent analysis results for the target device. While maintaining the model's lightweight nature and low deployment cost, it can accurately identify the differentiated intents of the same command on different devices by combining subsequent verification and / or update operations, thereby improving the accuracy of intent recognition and device adaptability. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application 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 only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 An exemplary system architecture diagram of an instruction recognition method provided in this application embodiment; Figure 2 A flowchart illustrating an instruction recognition method provided in an embodiment of this application; Figure 3 A flowchart illustrating an instruction recognition method provided in an embodiment of this application; Figure 4 This is a schematic diagram illustrating the overall process of implementing an instruction recognition method according to an embodiment of this application. Figure 5 A flowchart illustrating an instruction recognition method provided in an embodiment of this application; Figure 6 A flowchart illustrating an instruction recognition method provided in an embodiment of this application; Figure 7 A structural block diagram of an instruction recognition device provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application. Detailed Implementation
[0012] To make the features and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0013] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0014] Currently, when users use various smart terminal devices (including smart home appliances and mobile terminals), they often encounter situations where the same command has different intentions depending on the smart device. For example, the command "stop" might mean "stop heating" on a microwave oven, "stop cleaning" on a robot vacuum cleaner, and "stop the current operating mode" on an air conditioner. This one-to-many semantic mapping relationship poses a challenge to the natural language understanding of smart devices. Existing methods for recognizing command intentions generally fall into two categories: The first is based on a high-performance, large-parameter base model, which uses massive labeled corpora to fine-tune or train a unified model from scratch, attempting to distinguish different intentions on different devices through subtle semantic differences in the command statements themselves. This method can achieve cross-device intention recognition to a certain extent and can cover multiple device scenarios through powerful model capacity, reducing the number of models; The second is to train and deploy dedicated small models (or adapters) separately for each device type, so that each model only learns the command-intention mapping relationship of its corresponding device. Due to its strong targeting, it often achieves high recognition accuracy on specific devices.
[0015] However, existing methods for identifying command intent still have some problems. First, large-model solutions rely on large amounts of data and computing power, and their semantic discrimination capabilities are limited. As the types of devices increase, many commands are essentially identical in meaning, and relying solely on subtle semantic differences is insufficient to reliably distinguish intents. Even increasing the amount of data cannot overcome performance bottlenecks. Furthermore, large models have excessively large parameters, making them unsuitable for offline operation on computing-constrained edge devices (such as home appliance control chips). They must rely on cloud inference, leading to issues such as response latency, privacy risks, and unavailability during network outages. Second, multi-small-model solutions are costly to train and maintain. Each new device type requires the collection of new data, training, validation, and deployment of a separate model, resulting in redundant development. Moreover, the system must manage multiple model versions simultaneously, leading to complex updates, significant resource waste, and difficulty in scaling.
[0016] Therefore, this application provides an instruction recognition method to solve the technical problems of high cost and weak discrimination ability of existing instruction recognition methods.
[0017] Please see Figure 1 , Figure 1 An exemplary system architecture diagram of an instruction recognition method provided in an embodiment of this application.
[0018] like Figure 1As shown, the system architecture may include a terminal 101, a network 102, and a server 103. The network 102 serves as the medium for providing a communication link between the terminal 101 and the server 103. The network 102 may include various types of wired or wireless communication links, such as wired communication links including fiber optic cables, twisted-pair cables, or coaxial cables, and wireless communication links including Bluetooth communication links, Wireless-Fidelity (Wi-Fi) communication links, or microwave communication links, etc.
[0019] Terminal 101 can interact with server 103 via network 102 to receive messages from or send messages to server 103. Alternatively, terminal 101 can interact with server 103 via network 102 to receive messages or data sent to server 103 by other users. Terminal 101 can be hardware or software. When terminal 101 is hardware, it can be various electronic devices, including but not limited to smartwatches, smartphones, tablets, laptops, and desktop computers. When terminal 101 is software, it can be installed in the aforementioned electronic devices and can be implemented as multiple software programs or software modules (e.g., to provide distributed services) or as a single software program or software module; no specific limitation is made here.
[0020] In this embodiment, terminal 101 first obtains the target instruction for the target device, inputs the target instruction into a preset intent recognition model, which is obtained by adjusting the parameters of a preset base language model; then terminal 101 controls the intent recognition model to output the initial intent analysis result for the target instruction; finally, terminal 101 verifies and / or updates the initial intent analysis result to obtain the intent analysis result of the target instruction for the target device.
[0021] Server 103 can be a business server providing various services. It should be noted that server 103 can be hardware or software. When server 103 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When server 103 is software, it can be implemented as multiple software programs or software modules (e.g., used to provide distributed services), or as a single software program or software module; no specific limitations are made here.
[0022] Alternatively, the system architecture may not include server 103. In other words, server 103 may be an optional device in the embodiments of this specification. That is, the method provided in the embodiments of this specification can be applied to a system structure that only includes terminal 101. The embodiments of this application do not limit this.
[0023] It should be understood that Figure 1The number of terminals, networks, and servers shown is only illustrative; the number can be any number of terminals, networks, and servers depending on the implementation requirements.
[0024] Please see Figure 2 , Figure 2 This is a flowchart illustrating an instruction recognition method provided in an embodiment of this application. The execution subject in this embodiment can be a terminal performing instruction recognition, a processor within the terminal performing the instruction recognition method, or an instruction recognition service within the terminal performing the instruction recognition method. For ease of description, the following example uses a processor within the terminal as the execution subject to illustrate the specific execution process of the instruction recognition method.
[0025] like Figure 2 As shown, the instruction recognition method may include at least: S202. Obtain the target instruction for the target device and input the target instruction into the preset intent recognition model. The intent recognition model is obtained by adjusting the parameters of the preset base language model.
[0026] Optionally, the base language model (such as a lightweight large language model) already possesses good natural language understanding capabilities. Through fine-tuning, it can be efficiently adapted to specific tasks, avoiding training from scratch. Furthermore, employing a "small parameter" design combined with low-rank fine-tuning strategies can significantly reduce the computational resource requirements for training and inference, enabling the model to be deployed on computationally limited edge devices, achieving offline, low-latency command response. Based on this, the method in this application embodiment selects a preset small-parameter base language model to construct an intent recognition model, which serves as the foundation for command recognition.
[0027] Specifically, the system first acquires the target command issued by the user for a specific device. This target command can originate from text output by speech recognition or from natural language commands input through other interactive methods. Then, the target command is fused with the device type information of the target device to construct a prompt word adapted to the model's input format. The device type information can be embedded in the prompt word as a contextual prefix, system prompt, or structured field to explicitly inform the model of the device category to which the current command is directed.
[0028] Optionally, the constructed prompt words are input into a pre-built intent recognition model, which is obtained by adjusting the parameters of a base language model with a relatively small number of parameters. The parameter adjustment process includes, but is not limited to, fine-tuning strategies such as full-parameter fine-tuning and low-rank fine-tuning. The training data comes from a specially constructed sample instruction dataset, in which each sample is explicitly associated with the instruction text, device type, and corresponding intent label, enabling the model to learn during the training phase the ability to map the same instruction to different intents in different device contexts.
[0029] S204. The control intent recognition model outputs the initial intent analysis results for the target instruction.
[0030] Optionally, after the constructed prompt words are input into the intent recognition model, the system controls the model to perform forward inference calculations and outputs initial intent analysis results for the target instruction. Specifically, the intent recognition model, upon receiving input that incorporates device context, automatically activates semantic understanding paths related to the device type, thereby generating differentiated and context-aware preliminary judgments on the target instruction in different device scenarios. This initial intent analysis result is generated based on the mapping relationships already learned by the model, possessing high semantic accuracy and device adaptability, providing a reliable foundation for subsequent verification and / or update operations.
[0031] S206. Verify and / or update the initial intent analysis results to obtain the intent analysis results of the target instruction for the target device.
[0032] Optionally, the specific business logic and dynamic operating status of the target device can affect the intent of different instructions on different devices. For example, the literal meaning of the instruction "stop" is clear, but the specific operation is highly dependent on the task currently being performed by the target device (such as stopping heating, stopping cleaning, or stopping playback). The model alone cannot know the real-time status of the target device. Based on this, in order to further improve the matching accuracy between the recognition results and the actual functional scenarios of the target device, the method in this embodiment performs subsequent verification and / or updates on the initial intent analysis results to generate the final intent analysis results adapted to the target device.
[0033] Specifically, based on the target device's current status information (such as operating mode, available function set, user configuration preferences, etc.), device capability description files (such as supported instruction sets, parameter ranges), or a pre-set business rule base, candidate categories or parameters in the initial intent analysis results can be verified, updated, or refined. For example, if the initial intent analysis results point to a function that the target device does not support, it can be mapped to the closest available intent according to rules; or the execution granularity of the intent can be dynamically adjusted based on the target device's real-time feedback. This process can be completed locally on the device or collaboratively executed on the cloud side, providing good deployment flexibility.
[0034] In this application embodiment, an instruction recognition method is provided, which obtains a target instruction for a target device, inputs the target instruction into a preset intent recognition model, the intent recognition model is obtained by adjusting the parameters of a preset base language model; controls the intent recognition model to output an initial intent analysis result for the target instruction; verifies and / or updates the initial intent analysis result to obtain the intent analysis result of the target instruction for the target device. First, a unified intent recognition model is obtained by fine-tuning a base language model with relatively few parameters. This avoids training a separate model for each type of device, reduces dependence on hardware resources, and makes the model easier to deploy and expand. It also avoids the drawback of traditional methods that rely on large amounts of data and computing resources to forcibly distinguish the intents of different devices. The acquired target instructions are input into this model, providing a reliable data foundation for subsequent intent recognition. Then, the initial intent analysis results are directly output through the intent recognition model, achieving a rapid response in intent recognition. Compared with traditional methods that require multiple independent models or complex calculations to distinguish intents, this simplifies the recognition process and improves the recognition speed. At the same time, since the model has been adjusted and optimized, the initial intent analysis results have high accuracy. Finally, the initial intent analysis results are further verified and / or updated to make up for the shortcomings of pure model inference. It can combine the real-time context of the device for refined intent parsing, thereby more accurately determining the specific intent of the target instruction for the target device, enabling the system to correctly respond to user instructions in dynamic scenarios. The method described in this application forms an intent recognition model by fine-tuning parameters based on a base language model. This model outputs initial intent analysis results for the target device. While maintaining the model's lightweight nature and low deployment cost, it can accurately identify the differentiated intents of the same command on different devices by combining subsequent verification and / or update operations, thereby improving the accuracy of intent recognition and device adaptability.
[0035] Please see Figure 3 , Figure 3 This is a flowchart illustrating an instruction recognition method provided in an embodiment of this application.
[0036] like Figure 3 As shown, the instruction recognition method may include at least: S302. Construct an initial intent recognition model for intent recognition scenarios based on the base language model.
[0037] Optionally, Figure 4 This is a schematic diagram illustrating the overall process of implementing an instruction recognition method according to an embodiment of this application, as shown below. Figure 4As shown, the method in this embodiment first fine-tunes the base language model using a sample instruction dataset to construct an intent recognition model. During actual execution, the system receives the target instruction from the target device and inputs it into the intent recognition model to obtain an initial intent analysis result. This result includes candidate intents and their corresponding confidence information, which the system uses to evaluate the reliability of the model's instruction recognition. Specifically, the recognition results are categorized based on confidence level: for high-confidence results, such as instructions like "roasted gluten" which are semantically clear but slightly complex, the initial intent analysis result can be directly output as the final intent analysis result; while for low-confidence results or results with potential ambiguity, such as instructions like "stop" which are semantically clear but simple and vague, subsequent update operations are triggered to further correct or refine the intent based on device context information, thereby improving the accuracy and robustness of instruction recognition.
[0038] Optionally, in the process of constructing the intent recognition model, an initial intent recognition model for the intent recognition task is first built based on the selected base language model. Specifically, a base language model with relatively few parameters but good language understanding ability is selected as the basic architecture. This model has the ability to output prediction results for the prediction object based on various different types of features of the prediction object. An output layer or fine-tuning structure adapted to the intent classification task is introduced on top of it, thereby forming an initial intent recognition model specifically for instruction intent recognition.
[0039] S304. Obtain the sample instruction dataset. In the sample instruction dataset, each sample instruction corresponds to device type information and sample intent for the device type information.
[0040] Optionally, when the initial intent recognition model is directly applied to a specific scenario, the large model without adjustment is difficult to adapt to the new scenario. Therefore, after building the initial intent recognition model for the intent recognition scenario, it is also necessary to train the initial intent recognition model in a targeted manner.
[0041] Optionally, firstly, based on task requirements and objectives, determine the types and quantities of sample data needed, and collect diverse sample instruction datasets. For example, we need to cover common instruction interaction events, including but not limited to device control events (such as "turn on the air conditioner," "pause sweeping," "switch light mode"), parameter adjustment events (such as "set the temperature to 26 degrees," "adjust the fan speed to level three," "lower the brightness"), status query events (such as "how long until the washing machine finishes?" "what is the current indoor humidity?" "is the device online?"), and scene linkage events (such as "I'm home" triggering multi-device collaborative actions, "turn on movie mode" automatically closing curtains and turning on the projector), etc. These sample instruction datasets cover different instruction types and application scenarios, thus providing sufficient and accurate training materials for the model. Furthermore, data augmentation techniques, such as adding random noise, feature transformation, and data synthesis, are used to expand the original sample instruction dataset, increase the model's generalization ability, and reduce the risk of overfitting.
[0042] Optionally, the sample instruction dataset can be obtained through methods including but not limited to the following: collecting historical interaction logs, extracting real user instructions from deployed smart device user operation records, voice assistant dialogue history, and customer service feedback, and reconstructing their true intent by combining the device's operating context; employing scenario-based instruction generation methods, where language experts or large models simulate natural language expressions under different device usage scenarios to proactively construct instruction samples covering various functional points; in addition, publicly available industry corpora or cross-project shared instruction-intent pair datasets can be referenced to further enrich data diversity. To improve model robustness, the original sample instruction dataset can also undergo data augmentation processing such as synonym rewriting, colloquialization transformation, and noise injection to enhance the model's adaptability to variations in actual user expressions.
[0043] Optionally, each sample instruction includes not only the instruction text in natural language but also explicitly associated device type information (such as "microwave oven," "air conditioner," etc.) and a standard sample intent label for that device type (such as "start heating," "adjust fan speed"). Specifically, the collected sample instructions are labeled with standard tags to ensure that each instruction has clear device type information and sample intent. After the standard labeling is completed, a random sample of instructions is reviewed to ensure the accuracy and consistency of the labeling. Alternatively, statistical methods can be used to evaluate the overall quality of the sample instruction dataset, such as whether the proportion of different instruction types is reasonable and whether there are significant deviations in sample intent. If problems are found, the affected data is corrected and relabeled promptly.
[0044] S306. Input each sample instruction and its corresponding device type information from the sample instruction dataset into the initial intent recognition model and train the initial intent recognition model.
[0045] Optionally, during the training phase, sample commands are fused with their corresponding device type information (e.g., by constructing an input sequence through prompt word engineering) and input into the initial intent recognition model. The initial intent recognition model is then controlled to automatically extract key information and perform command recognition based on the characteristics of the input data.
[0046] S308. During the training process of the initial intent recognition model, the initial intent recognition model is controlled to output the initial intent for each sample instruction based on the device type information, and the parameters of the initial intent recognition model are updated according to each initial intent and the corresponding sample intent until the initial intent recognition model converges, thus obtaining the trained intent recognition model.
[0047] Optionally, during the training process of the initial intent recognition model, the model outputs predicted initial intents for sample commands based on device type information. These initial intents are the command intent prediction results of the initial intent recognition model for multiple sample commands. Then, these initial intents are compared with the sample intents inherent in the sample commands. The difference between the initial intents and the sample intents is the difference between the current state of the initial intent recognition model and the expected performance.
[0048] Furthermore, a loss function is calculated based on the difference between the initial intent and the sample intent, and the parameters of the initial intent recognition model are adjusted according to the loss value until the initial intent recognition model converges to obtain the trained intent recognition model. For example, the learning rate is dynamically adjusted according to the changes in the model's loss function. When the loss function decreases slowly, the learning rate is appropriately reduced to avoid the model getting stuck in a local optimum; when the loss function decreases rapidly, the learning rate is appropriately increased to accelerate convergence.
[0049] Optionally, the model training process will be iterated multiple times. Each iteration will use all or part of the sample instruction dataset for training, and adjust the model architecture, increase training data, and optimize training strategies based on the training results, thereby gradually improving the model's ability to recognize instruction intent. In addition, distributed training techniques can be used to distribute the model training task across multiple computing nodes for parallel execution. This not only shortens the training time but also utilizes more computing resources to handle larger-scale training datasets.
[0050] S310. Obtain the target instruction for the target device, input the target instruction into the preset intent recognition model, which is obtained by adjusting the parameters of the preset base language model; control the intent recognition model to output the initial intent analysis result for the target instruction.
[0051] Optionally, for details regarding step S310, please refer to steps S202-S206, which will not be repeated here.
[0052] S312. Determine the confidence level of the initial intent analysis result, verify and / or update the initial intent analysis result based on the confidence level, and obtain the intent analysis result of the target instruction for the target device based on the verification and / or update result.
[0053] Optionally, after obtaining the initial intent analysis result output by the intent recognition model, the confidence information corresponding to the result is extracted. This confidence level reflects the model's certainty regarding its predicted intent. Subsequently, this confidence level is compared with a preset confidence threshold to determine the reliability of the current recognition result. If the confidence level is higher than or equal to the threshold, the initial intent analysis result is considered to have sufficient credibility and can be directly used as the final intent analysis result output to drive the target device to perform the corresponding operation. If the confidence level is lower than the threshold, it indicates that the model's intent judgment of the instruction has uncertainty or ambiguity risk. In this case, the system will trigger a subsequent update mechanism and obtain the intent analysis result of the target instruction for the target device based on the update result. Specifically, the verification and / or update process is detailed in step S206 and will not be repeated here.
[0054] In this embodiment, an instruction recognition method is provided. By introducing a mechanism to judge the confidence of the initial intent analysis results, it can dynamically decide whether to trigger the update process, thereby improving the accuracy and robustness of intent recognition while improving response efficiency. By constructing a sample instruction dataset that integrates device type information and sample intent, and specifically training a small-parameter base language model, the resulting intent recognition model can accurately distinguish the intent of the same instruction on different devices under a unified architecture. This avoids the high cost and maintenance burden of training a separate model for each type of device. At the same time, due to the small number of model parameters and clear training objectives, it has good generalization ability and end-side deployment feasibility, making it suitable for large-scale applications of multi-category smart terminals.
[0055] Please see Figure 5 , Figure 5 This is a flowchart illustrating an instruction recognition method provided in an embodiment of this application.
[0056] like Figure 5 As shown, the instruction recognition method may include at least: S502. Obtain multiple first sample instructions and determine the sample intent of each first sample instruction for each device type information. Based on each first sample instruction, each device type information and the sample intent for each device type information, construct a first sample instruction dataset. Each first sample instruction is an instruction with different sample intents for different device type information.
[0057] Optionally, to construct high-quality, high-coverage training data, multiple first-sample instructions are first obtained. These first-sample instructions specifically refer to instruction statements that are completely identical or highly similar in natural language form, but correspond to different operational intentions under different device types. These types of instructions are the core source of ambiguity in intent recognition. For each first-sample instruction, its specific sample intent under each relevant device type is clarified. Subsequently, the instruction is paired with each device type to generate multiple structured training samples.
[0058] For example, for the first sample instruction q1, if it applies to both device types X and Y, then samples are constructed as "q1→Device type X→Intent x" and "q1→Device type Y→Intent y" respectively. In this way, the originally single first sample instruction is expanded into multiple device-intent context combinations, forming a first sample instruction dataset. This dataset explicitly encodes polysemous mappings, enabling the model to learn the decisive role of device type as a key context in intent determination during the training phase.
[0059] S504. Obtain multiple second sample instructions and the sample intent of each second sample instruction, and determine the various device type information corresponding to each second sample instruction. Based on each second sample instruction, the sample intent of each second sample instruction, and the various device type information corresponding to each second sample instruction, construct a second sample instruction dataset. Each second sample instruction is an instruction that has the same sample intent for different device type information.
[0060] Optionally, to further improve the coverage and structural balance of the training data, multiple second sample instructions are also obtained. These second sample instructions refer to those instructions that are semantically clear and correspond to the same sample intent across multiple different device types. For each second sample instruction, its sample intent is first determined, and then all device types that support that intent are identified. Subsequently, the instruction is combined with its corresponding multiple device types to generate multiple training samples.
[0061] For example, for the second sample instruction q2, if it applies to device types X and Y, then samples are constructed as "q2→Device type X→Intent x" and "q2→Device type Y→Intent x" respectively. In this way, the same instruction is copied and bound to multiple device types, forming a second sample instruction dataset. This dataset maintains the consistency of the instruction-intent mapping while explicitly associating multiple applicable devices, ensuring that the model learns the pattern that some instructions have cross-device universality.
[0062] S506. Construct a sample instruction dataset based on the first sample instruction dataset and the second sample instruction dataset.
[0063] Optionally, after constructing the first and second sample instruction datasets respectively, they are integrated to form the final sample instruction dataset used for model training. The first sample instruction dataset focuses on typical ambiguous scenarios where the same instruction has different intentions on different device types, strengthening the model's ability to distinguish context-sensitive intentions by explicitly labeling each device-intention combination. The second sample instruction dataset covers common scenarios where the same instruction shares the same intention across multiple device types, ensuring the model can recognize cross-device functional consistency.
[0064] Specifically, these data undergo standardized format validation, deduplication, and distribution balancing to ensure a reasonable ratio of device types, intent categories, and instruction complexity in the final dataset. For example, if certain device types have fewer samples in the first sample instruction dataset, they can be supplemented with common instructions from the second sample instruction dataset to avoid training bias. Simultaneously, high-frequency ambiguous instructions are given appropriate weights in the first sample instruction dataset to improve the model's learning performance on key difficult examples.
[0065] S508. Construct an initial intent recognition model for intent recognition scenarios based on the base language model; obtain a sample instruction dataset, in which each sample instruction corresponds to device type information and a sample intent for the device type information; input each sample instruction and the corresponding device type information in the sample instruction dataset into the initial intent recognition model to train the initial intent recognition model.
[0066] Optionally, for details regarding step S508, please refer to steps S302-S306, which will not be repeated here.
[0067] S510. During the training process of the initial intent recognition model, the initial intent recognition model is controlled to output the initial intent for each sample instruction based on the device type information, and the parameters of the initial intent recognition model are updated according to each initial intent and the corresponding sample intent until the initial intent recognition model converges; the converged initial intent recognition model is compressed, and the compression process includes at least one of pruning and quantization to obtain the trained intent recognition model.
[0068] Optionally, for details regarding the model training process, please refer to step S308, which will not be repeated here.
[0069] Furthermore, after the initial intent recognition model completes training and reaches convergence, it undergoes compression processing, including but not limited to pruning and quantization, to reduce the number of parameters and inference computation overhead while preserving the model's recognition performance as much as possible. Specifically, pruning involves analyzing the importance of each weight or neuron in the model and removing redundant connections or structures that have little impact on the output, thereby obtaining a more compact sparse model. Quantization converts the original high-precision floating-point parameters in the model into low-precision integer representations, significantly reducing storage requirements and accelerating computation, thus making the model more suitable for edge chips that support low-precision operations.
[0070] S512. Obtain the target instruction for the target device, input the target instruction into the preset intent recognition model, which is obtained by adjusting the parameters of the preset base language model; control the intent recognition model to output the initial intent analysis result for the target instruction.
[0071] Optionally, for details regarding step S512, please refer to steps S202-S206, which will not be repeated here.
[0072] S514. Determine the confidence level of the initial intent analysis result. When the confidence level meets the preset reliability requirements, use the initial intent analysis result as the intent analysis result of the target instruction for the target device.
[0073] Optionally, Figure 4 This is a schematic diagram illustrating the overall process of implementing an instruction recognition method according to an embodiment of this application, as shown below. Figure 4 As shown in the “Similar Complex Explicit Semantic Instructions” section, after the intent recognition model outputs the initial intent analysis results for the target instruction, it will perform targeted verification operations on the initial intent analysis results to ensure that the final intent analysis results are more accurate and reliable.
[0074] Specifically, the first step is to determine whether the confidence level meets the preset reliability requirements. When the confidence level meets the requirements (e.g., it is higher than the set confidence level threshold), it indicates that the model has a high degree of certainty in the intent recognition of the target instruction. At this time, the verified initial intent analysis result can be directly used as the final intent analysis result output to drive the target device to perform the corresponding operation, thereby achieving an efficient and low-latency response.
[0075] For example, consider the semantically clear but slightly complex instruction scenario of "roasted gluten." In general natural language, this instruction is a typical verb-object structure, usually understood as a cooking action. However, its semantics may change in the context of a specific device. For instance, when the target device is a microwave or oven, the user's true intent is often to query how to make "roasted gluten" or related information; in this case, the instruction as a whole is considered a noun phrase. Thanks to our solution explicitly modeling these contextual differences through device type information during the training phase, the intent recognition model can accurately distinguish and output the intent matching the device function when faced with such high-confidence input, without additional intervention. Therefore, for semantic instructions that the model can reliably handle, directly adopting the initial intent analysis results as the intent analysis results for the target instruction targeting the target device ensures accuracy while avoiding unnecessary computational overhead.
[0076] S516. When the confidence level does not meet the preset reliability requirements, determine the type of the initial intent analysis result, update the initial intent analysis result based on the type, and use the updated initial intent analysis result as the intent analysis result of the target instruction for the target device.
[0077] Optionally, such as Figure 4 As illustrated by the "Similar Simple Fuzzy Instructions" example, when the system determines that the confidence level of the initial intent analysis result does not meet the preset reliability requirements, it indicates that the model's intent recognition of the target instruction has uncertainty or ambiguity risks. In this case, the initial intent analysis result will not be directly adopted. Instead, the system will further determine the instruction type to which the result belongs and trigger the corresponding update processing logic based on that type. Such low-confidence instructions are usually simple instructions with clear semantics but highly dependent on the device context or operating state. Their literal meaning is clear, but the specific target of the operation cannot be inferred solely from the language model.
[0078] For example, consider the semantically clear yet simple and ambiguous instruction "stop." This instruction is used in almost all smart devices, but the actual operation it refers to varies depending on the device type and current state—in an air conditioner, it might mean "stop cooling," in a robot vacuum cleaner, it means "interrupt cleaning," and in a multimedia device, it might mean "pause playback." Even within the same device, if multiple services are running simultaneously (such as cleaning while recharging), "stop" requires consideration of the device's real-time state. Because such instructions lack sufficient semantic distinguishing features, even with sufficient training, the model struggles to output a high-confidence, unique intent in all scenarios. Therefore, it is necessary to categorize these instructions into specific instruction types and update them accordingly based on those specific instruction types.
[0079] Specifically, customized decision-making processes can be executed by combining dynamic information such as device type, currently running task list, service priority, and user historical behavior. For example, for the target instruction "stop," the number of currently active services can be detected; if there is only one, it can be stopped directly; if there are multiple, the target service to be stopped can be selected according to a preset strategy (such as priority, queue order, etc.). For the target instruction "continue," the last stopped service can be resumed according to the queue order.
[0080] It should be noted that, in addition to the specific processing methods for "stop" and "continue" commands described above, the method in this application embodiment also allows for different update operations to be implemented based on different types of simple and ambiguous commands. For example, a command-operation mapping table can be designed to map different types of commands to specific operations or services, in order to support the customization of different update processing business logic for different device types and meet the needs of diverse application scenarios.
[0081] This application provides an instruction recognition method that dynamically determines the processing strategy based on the confidence level of the initial intent analysis result. When the confidence level is high, the output is directly provided to improve efficiency; when the confidence level is low, targeted updates are performed based on the instruction type. This achieves an adaptive balance between recognition accuracy and response speed, ensuring accurate parsing of complex or ambiguous instructions while avoiding redundant calculations for deterministic results, thus improving system robustness and user experience. After model convergence, pruning and quantization compression processes are introduced to reduce the number of parameters and computational overhead of the intent recognition model, enabling it to run efficiently offline on resource-constrained edge devices. This balances high performance and low power consumption deployment requirements, enhancing the practicality and feasibility of the solution in scenarios such as smart home appliances. By constructing a first sample dataset with multiple meanings and a second sample dataset with universal meanings, and fusing them to form a structurally balanced and comprehensively covered training corpus, the method effectively solves the data ambiguity and class imbalance problems in multi-device intent recognition. This allows the model to accurately distinguish context-sensitive instructions and generalize to cross-device universal instructions, improving overall recognition accuracy and generalization ability.
[0082] Please see Figure 6 , Figure 6 This is a flowchart illustrating an instruction recognition method provided in an embodiment of this application.
[0083] like Figure 6 As shown, the instruction recognition method may include at least: S602. Obtain the target instruction for the target device, input the target instruction into the preset intent recognition model, which is obtained by adjusting the parameters of the preset base language model; control the intent recognition model to output the initial intent analysis result for the target instruction; verify and / or update the initial intent analysis result.
[0084] Optionally, for details regarding step S602, please refer to steps S202-S206, which will not be repeated here.
[0085] S604. Query reference instructions that meet the first similarity threshold with the target instruction from the preset knowledge base, and determine reference device type information that meets the second similarity threshold with the target device from the device type information corresponding to the reference instructions, and determine the reference intent of the reference instruction under the reference device type information.
[0086] Optionally, before obtaining the final intent analysis result of the target instruction for the target device, the method of this application embodiment further introduces a retrieval enhancement mechanism based on a preset knowledge base to help improve the recognition accuracy of the target instruction. Specifically, it first retrieves reference instructions from a structured preset knowledge base that have a semantic or literal similarity to the current target instruction that reaches a first similarity threshold. This knowledge base pre-stores a large number of labeled instruction-device type-intent Figure 3 Tuples cover real-world data such as historical user interactions, product manuals, and customer service Q&A.
[0087] Furthermore, from the multiple device type information associated with the retrieved reference instructions, reference device type information that reaches a second similarity threshold in terms of device category, functional attributes, or model characteristics is further filtered out. For example, if the target device is a certain model of microwave oven, matching of the same category (such as "microwave oven" or "multi-functional microwave-steam-grill combination oven") is prioritized over matching of irrelevant categories (such as "air conditioner"). Based on this, the reference intent corresponding to the reference instruction under the current reference device type information is extracted as an external knowledge clue for the current intent recognition task.
[0088] S606. Based on the verification and / or update results, and in conjunction with the reference intent, obtain the intent analysis results of the target instruction for the target device.
[0089] Optionally, the reference intent determined by the knowledge base can be integrated with the preliminary results obtained based on verification and / or updates, for example, through weighted voting, rule validation, or as additional input features, to ultimately generate more reliable intent analysis results.
[0090] In this application embodiment, an instruction recognition method is provided. By introducing a preset knowledge base retrieval mechanism based on dual similarity thresholds, a reliable external reference intent is provided for the intent recognition process, which can effectively enhance the accuracy and robustness of the model's judgment.
[0091] Please see Figure 7 , Figure 7 This is a structural block diagram of an instruction recognition device provided in an embodiment of this application. Figure 7As shown, the instruction recognition device 700 includes: The instruction acquisition module 710 is used to acquire the target instruction for the target device and input the target instruction into the preset intent recognition model. The intent recognition model is obtained by adjusting the parameters of the preset base language model. The model output module 720 is used to control the intent recognition model to output the initial intent analysis results for the target instruction; The result determination module 730 is used to verify and / or update the initial intent analysis results to obtain the intent analysis results of the target instruction for the target device.
[0092] In some possible embodiments, the result determination module 730 is further configured to determine the confidence level of the initial intent analysis result, verify and / or update the initial intent analysis result based on the confidence level, and obtain the intent analysis result of the target instruction for the target device based on the verification and / or update result.
[0093] In some possible embodiments, the result determination module 730 is further configured to, when the confidence level meets the preset reliability requirements, use the initial intent analysis result as the intent analysis result of the target instruction for the target device; when the confidence level does not meet the preset reliability requirements, determine the type of the initial intent analysis result, update the initial intent analysis result based on the type, and use the updated initial intent analysis result as the intent analysis result of the target instruction for the target device.
[0094] In some possible embodiments, the instruction recognition device 700 further includes: a model training module, used to construct an initial intent recognition model for the intent recognition scenario based on a base language model; acquire a sample instruction dataset, in which each sample instruction corresponds to device type information and a sample intent for the device type information; input each sample instruction and the corresponding device type information in the sample instruction dataset into the initial intent recognition model to train the initial intent recognition model; during the training process of the initial intent recognition model, control the initial intent recognition model to output an initial intent for each sample instruction according to each device type information, and update the parameters of the initial intent recognition model according to each initial intent and the corresponding sample intent until the initial intent recognition model converges, thereby obtaining the trained intent recognition model.
[0095] In some possible embodiments, the instruction recognition device 700 further includes: a model compression module, used to compress the converged initial intention recognition model before the model training module obtains the trained intention recognition model, the compression process including at least one of pruning and quantization.
[0096] In some possible embodiments, the instruction recognition device 700 further includes: a dataset construction module, configured to acquire multiple first sample instructions and determine the sample intent of each first sample instruction for each device type information; construct a first sample instruction dataset based on each first sample instruction, each device type information, and the sample intent for each device type information, wherein each first sample instruction is an instruction with different sample intents for different device type information; acquire multiple second sample instructions and the sample intent of each second sample instruction, and determine the multiple device type information corresponding to each second sample instruction; construct a second sample instruction dataset based on each second sample instruction, the sample intent of each second sample instruction, and the multiple device type information corresponding to each second sample instruction, wherein each second sample instruction is an instruction with the same sample intent for different device type information; and construct a sample instruction dataset based on the first sample instruction dataset and the second sample instruction dataset.
[0097] In some possible embodiments, the instruction recognition device 700 further includes: an auxiliary judgment module, configured to query a reference instruction that meets a first similarity threshold from a preset knowledge base before the result determination module 730 obtains the intention analysis result of the target instruction for the target device, and determine the reference device type information that meets a second similarity threshold from the device type information corresponding to the reference instruction, and determine the reference intention of the reference instruction under the reference device type information; the result determination module 730 is configured to obtain the intention analysis result of the target instruction for the target device based on the verification and / or update results and the reference intention.
[0098] In this embodiment of the application, an instruction recognition device is provided, wherein the instruction acquisition module is used to acquire a target instruction for a target device and input the target instruction into a preset intent recognition model, the intent recognition model being obtained by adjusting the parameters of a preset base language model; the model output module is used to control the intent recognition model to output an initial intent analysis result for the target instruction; and the result determination module is used to verify and / or update the initial intent analysis result to obtain the intent analysis result of the target instruction for the target device. First, the instruction acquisition module fine-tunes a base language model with relatively few parameters to obtain a unified intent recognition model. This avoids training a separate model for each type of device, reduces dependence on hardware resources, and makes the model easier to deploy and expand. It also avoids the drawbacks of traditional methods that rely on large amounts of data and computing resources to forcibly distinguish the intents of different devices. The acquired target instruction is input into this model, providing a reliable data foundation for subsequent intent recognition. Then, the model output module directly outputs the initial intent analysis results through the intent recognition model, achieving rapid intent recognition response. Compared to traditional methods that require multiple independent models or complex calculations to distinguish intents, this simplifies the recognition process and improves recognition speed. Furthermore, since the model has already undergone parameter tuning and optimization, the initial intent analysis results have high accuracy. Finally, the result determination module further verifies and / or updates the initial intent analysis results, compensating for the shortcomings of pure model inference. It can combine the real-time context of the device for refined intent parsing, thereby more accurately determining the specific intent of the target instruction for the target device, enabling the system to correctly respond to user instructions in dynamic scenarios. The method described in this application forms an intent recognition model by fine-tuning parameters based on a base language model. This model outputs initial intent analysis results for the target device. While maintaining the model's lightweight nature and low deployment cost, it can accurately identify the differentiated intents of the same command on different devices by combining subsequent verification and / or update operations, thereby improving the accuracy of intent recognition and device adaptability.
[0099] This application also provides a computer storage medium that can store multiple instructions adapted for loading by a processor and executing the steps of any of the methods described in the above embodiments.
[0100] This application also provides a computer program product, including a computer program that, when executed, implements the steps of the method as described in any of the above embodiments.
[0101] Please see Figure 8 , Figure 8 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application. Figure 8As shown, terminal 800 may include: at least one terminal processor 801, at least one network interface 804, user interface 803, memory 805, and at least one communication bus 802.
[0102] The communication bus 802 is used to enable communication between these components.
[0103] The user interface 803 may include a display screen and a camera. Optionally, the user interface 803 may also include a standard wired interface and a wireless interface.
[0104] The network interface 804 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0105] The terminal processor 801 may include one or more processing cores. The terminal processor 801 connects to various parts within the terminal 800 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 805, and by calling data stored in the memory 805. Optionally, the terminal processor 801 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The terminal processor 801 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the terminal processor 801 and may be implemented as a separate chip.
[0106] The memory 805 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 805 may include a non-transitory computer-readable storage medium. The memory 805 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 805 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 805 may also be at least one storage device located remotely from the aforementioned terminal processor 801. Figure 8 As shown, the memory 805, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an instruction recognition program.
[0107] exist Figure 8 In the terminal 800 shown, the user interface 803 is mainly used to provide an input interface for the user and to obtain the user's input data; while the terminal processor 801 can be used to call the instruction recognition program stored in the memory 805 and specifically perform the following operations: Obtain the target command for the target device, and input the target command into the preset intent recognition model. The intent recognition model is obtained by adjusting the parameters of the preset base language model. The control intent recognition model outputs initial intent analysis results for the target instruction; The initial intent analysis results are verified and / or updated to obtain the intent analysis results of the target instruction for the target device.
[0108] In some possible embodiments, when the terminal processor 801 performs the verification and / or update of the initial intent analysis result to obtain the intent analysis result of the target instruction for the target device, it specifically performs the following steps: determining the confidence level of the initial intent analysis result, verifying and / or updating the initial intent analysis result based on the confidence level, and obtaining the intent analysis result of the target instruction for the target device based on the verification and / or update result.
[0109] In some possible embodiments, when the terminal processor 801 performs verification and / or updating of the initial intent analysis result based on confidence level, and obtains the intent analysis result of the target instruction for the target device based on the verification and / or update result, it specifically performs the following steps: when the confidence level meets the preset reliability requirement, the initial intent analysis result is used as the intent analysis result of the target instruction for the target device; when the confidence level does not meet the preset reliability requirement, the type of the initial intent analysis result is determined, the initial intent analysis result is updated based on the type, and the updated initial intent analysis result is used as the intent analysis result of the target instruction for the target device.
[0110] In some possible embodiments, the terminal processor 801 further performs the following steps: constructing an initial intent recognition model for the intent recognition scenario based on the base language model; acquiring a sample instruction dataset, in which each sample instruction corresponds to device type information and a sample intent for the device type information; inputting each sample instruction and the corresponding device type information in the sample instruction dataset into the initial intent recognition model to train the initial intent recognition model; during the training process of the initial intent recognition model, controlling the initial intent recognition model to output initial intents for each sample instruction based on each device type information, and updating the parameters of the initial intent recognition model according to each initial intent and the corresponding sample intents until the initial intent recognition model converges, thereby obtaining the trained intent recognition model.
[0111] In some possible embodiments, before executing the trained intent recognition model, the terminal processor 801 further performs the following steps: compressing the converged initial intent recognition model, the compression process including at least one of pruning and quantization.
[0112] In some possible embodiments, the terminal processor 801 further performs the following steps: acquiring multiple first sample instructions and determining the sample intent of each first sample instruction for each device type information; constructing a first sample instruction dataset based on each first sample instruction, each device type information, and the sample intent for each device type information, wherein each first sample instruction is an instruction with different sample intents for different device type information; acquiring multiple second sample instructions and the sample intent of each second sample instruction, and determining the multiple device type information corresponding to each second sample instruction; constructing a second sample instruction dataset based on each second sample instruction, the sample intent of each second sample instruction, and the multiple device type information corresponding to each second sample instruction, wherein each second sample instruction is an instruction with the same sample intent for different device type information; and constructing a sample instruction dataset based on the first sample instruction dataset and the second sample instruction dataset.
[0113] In some possible embodiments, before executing the intent analysis result of the target instruction for the target device, the terminal processor 801 further performs the following steps: querying a reference instruction that meets a first similarity threshold with the target instruction from a preset knowledge base, and determining reference device type information that meets a second similarity threshold with the target device from the device type information corresponding to the reference instruction, and determining the reference intent of the reference instruction under the reference device type information; when executing the intent analysis result of the target instruction for the target device, the terminal processor 801 further performs the following steps: based on the verification and / or update results, combining the reference intent to obtain the intent analysis result of the target instruction for the target device.
[0114] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0115] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0116] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this specification are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The aforementioned available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).
[0117] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0118] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0119] The above is a description of an instruction recognition method, apparatus, storage medium, and terminal provided in this application. For those skilled in the art, based on the ideas of the embodiments of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for recognizing instructions, characterized in that, The method includes: Obtain the target instruction for the target device, and input the target instruction into a preset intent recognition model, which is obtained by adjusting the parameters of a preset base language model; The intent recognition model is controlled to output initial intent analysis results for the target instruction; The initial intent analysis results are verified and / or updated to obtain the intent analysis results of the target instruction for the target device.
2. The method according to claim 1, characterized in that, The step of verifying and / or updating the initial intent analysis result to obtain the intent analysis result of the target instruction for the target device includes: Determine the confidence level of the initial intent analysis result, verify and / or update the initial intent analysis result based on the confidence level, and obtain the intent analysis result of the target instruction for the target device based on the verification and / or update result.
3. The method according to claim 2, characterized in that, The step of verifying and / or updating the initial intent analysis result based on the confidence level, and obtaining the intent analysis result of the target instruction for the target device based on the verification and / or update result, includes: When the confidence level meets the preset reliability requirements, the initial intent analysis result is used as the intent analysis result of the target instruction for the target device; When the confidence level does not meet the preset reliability requirements, the type of the initial intent analysis result is determined, the initial intent analysis result is updated based on the type, and the updated initial intent analysis result is used as the intent analysis result of the target instruction for the target device.
4. The method according to claim 1, characterized in that, The method further includes: An initial intent recognition model for intent recognition scenarios is constructed based on the base language model; Obtain a sample instruction dataset, in which each sample instruction corresponds to device type information and a sample intent for the device type information; Input each sample instruction and its corresponding device type information from the sample instruction dataset into the initial intent recognition model to train the initial intent recognition model; During the training process of the initial intent recognition model, the initial intent recognition model is controlled to output initial intents for each sample instruction based on the device type information, and the parameters of the initial intent recognition model are updated according to each initial intent and the corresponding sample intents until the initial intent recognition model converges, thus obtaining the trained intent recognition model.
5. The method according to claim 4, characterized in that, Before obtaining the trained intent recognition model, the method further includes: The initial intent recognition model that has converged is compressed, and the compression process includes at least one of pruning and quantization.
6. The method according to claim 4, characterized in that, The method further includes: Multiple first sample instructions are obtained, and the sample intent of each first sample instruction for each device type information is determined. Based on each first sample instruction, each device type information, and the sample intent for each device type information, a first sample instruction dataset is constructed. Each first sample instruction is an instruction with different sample intents for different device type information. Obtain multiple second sample instructions and the sample intent of each second sample instruction, and determine the various device type information corresponding to each second sample instruction. Based on each second sample instruction, the sample intent of each second sample instruction, and the various device type information corresponding to each second sample instruction, construct a second sample instruction dataset. Each second sample instruction is an instruction that has the same sample intent for different device type information. A sample instruction dataset is constructed based on the first sample instruction dataset and the second sample instruction dataset.
7. The method according to claim 1, characterized in that, Before obtaining the intent analysis result of the target instruction for the target device, the method further includes: The reference instruction is queried from the preset knowledge base and matches the target instruction with a first similarity threshold. The reference device type information that matches the target device with a second similarity threshold is determined from the device type information corresponding to the reference instruction. The reference intent of the reference instruction under the reference device type information is then determined. The process of obtaining the intent analysis result of the target instruction for the target device includes: Based on the verification and / or update results, and in conjunction with the reference intent, the intent analysis result of the target instruction for the target device is obtained.
8. An instruction recognition device, characterized in that, The device includes: The instruction acquisition module is used to acquire the target instruction for the target device and input the target instruction into a preset intent recognition model, which is obtained by adjusting the parameters of a preset base language model. The model output module is used to control the intent recognition model to output the initial intent analysis results for the target instruction; The result determination module is used to verify and / or update the initial intent analysis result to obtain the intent analysis result of the target instruction for the target device.
9. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions adapted for loading by a processor and executing the steps of the method as described in any one of claims 1 to 7.
10. A computer program product, characterized in that, Includes a computer program that, when executed, implements the steps of the method as described in any one of claims 1 to 7.
11. A terminal, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method as described in any one of claims 1 to 7.
Citation Information
Cited By
Industrial intelligent question-answering method and system based on context perception and knowledge retrieval
CN122334525A