An edge intelligent device tool distribution method and system based on three-level matching and digital alignment
Patent Information
- Application Number
- CN202611217631.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-12
- Publication Date
- 2026-10-27
AI Technical Summary
传统方案依赖云端大模型进行意图理解和函数调用(Function Calling),但边缘端部署的小参数量语言模型(如Qwen-2.5 1.7B/4B)直接生成JSON格式指令时,极易出现格式错误或输出不存在的工具名称(即“指令幻觉”),且端到端延迟可达数秒,无法满足实时控制需求
[0012]高安全:数字对齐锁从物理层面杜绝通道编号混淆,即使语义高度相似,数字不同则绝不分发。
Smart Images

Figure CN122986285A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of edge computing, natural language processing and industrial automation control, and specifically relates to a highly reliable, low-latency device tool parameter distribution method implemented on offline edge devices through a hybrid matching strategy. Background Art
[0002] In scenarios such as industrial central control, intelligent exhibition halls, and multimedia classrooms, it is often necessary to control multiple devices through voice commands (such as switching video sources, turning on / off large screens, and adjusting volume). Traditional solutions rely on cloud large models for intent understanding and Function Calling, but when small-parameter language models deployed on the edge side (such as Qwen-2.5 1.7B / 4B) directly generate JSON format commands, format errors or output of non-existent tool names (i.e., "command hallucinations") are extremely prone to occur, and the end-to-end latency can reach several seconds, which cannot meet the real-time control requirements.
[0003] At the same time, a large number of device names and channel numbers are highly similar (such as "video stream 1", "video stream 2", "large screen 1", "large screen 2"). When conventional semantic vector models (Embedding) calculate similarity, they cannot distinguish the difference of numerical numbers, and are extremely prone to incorrectly match "large screen 1" to "large screen 2", resulting in serious misoperation. In the prior art, although there are solutions based on text similarity matching, they lack a hard alignment mechanism for numerical numbers, and have a single matching strategy, which cannot take into account both recall rate and precision rate. Summary of the Invention
[0004] The present invention aims to solve the above pain points, and provides a tool distribution method that does not rely on large model generation and runs completely offline on the edge side. It ensures high recall through three-level cascade matching, ensures absolute precision through a numerical safety alignment lock, and realizes zero-hallucination control command distribution within 50ms. Technical Solution
[0005] To achieve the above objectives, the present invention adopts the following technical architecture (as Figure 1 shown): Business anchor Chinese numeral normalization: Define a set of business noun anchors, and use regular expressions to only convert the Chinese numerals immediately following the anchors, so as to avoid mistakenly converting daily words such as "yixia" (a while) and "yihui" (a moment) into numbers, and ensure the accuracy of the input text.
[0006] Three-level cascade matching engine: First level (forward substring matching) — If the user input completely contains the tool keyword, it is directly matched with the highest priority, which is used for precise commands.
[0007] Second level (reverse substring ratio matching) — For ASR character loss scenarios, if the proportion of valid characters in the user input that appear in the candidate keyword is ≥70%, it is regarded as a match, to improve fault tolerance.
[0008] Third level (local Embedding matching) — When the first two levels fail, ONNX Runtime is used to load the bge-small-zh-v1.5 model to calculate semantic similarity, and a hit is determined when the similarity is ≥0.70.
[0009] Digital security alignment lock: Before executing the third-level matching, extract all digital sequences from the user input and the candidate tools, and forcibly compare whether the two are completely consistent (in the same order). If they are inconsistent, a fuse is directly triggered to prevent false matches; if they are consistent, the similarity calculation is allowed to proceed.
[0010] Conflict prevention and difference filtering: Perform clustering and deduplication on multiple actions of the same device group (such as "turn on the light" and "turn off the light"), and only retain the highest score; if the difference between the highest score and the second highest score is greater than 0.05, the second highest score is ignored to prevent cascading triggering. Beneficial Effects
[0011] Zero hallucination: No reliance on large model generation, completely avoiding JSON format errors and false tool name issues.
[0012] High security: The digital alignment lock physically eliminates channel number confusion, and even if the semantics are highly similar, distribution will never be performed if the numbers are different.
[0013] Low latency: All calculations are performed locally offline, with an average distribution latency of <50ms, which is 98% shorter than two-round large model inference.
[0014] High fault tolerance: Reverse substring matching compensates for ASR character loss, and Embedding provides fallback for semantic generalization. Brief Description of the Drawings
[0015] Figure 1 is an overall system flow block diagram provided by the embodiment of the present invention, showing the complete data flow from user input to tool execution, including the steps of normalization, three-level matching, digital alignment lock and conflict prevention filtering.
[0016] Figure 2 is an example diagram of Chinese numeral normalization for business anchors provided by the embodiment of the present invention, illustrating the process in which the original speech text "da ping yi tui shi pin liu er" is converted to "da ping 1 tui shi pin liu 2" after anchor matching.
[0017] Figure 3 is a schematic diagram of the working logic of the digital security alignment lock provided by the embodiment of the present invention, comparing the decision path of triggering a fuse when the digital sets of the user input "large screen 1" and the candidate tool "large screen 2" are inconsistent. DETAILED DESCRIPTION
[0018] The present invention will be described in further detail below with reference to the accompanying drawings.
[0019] This embodiment runs on an embedded edge mainboard (RK3588 platform), the operating system is Linux, and the main control program is written in Python. The tool configuration library is stored as JSON files, and each tool includes keywords, intent examples, affiliated device groups and action types.
[0020] When the system starts, the anchor set _DIGIT_NORM_ANCHORS = ['large screen', 'screen', 'video stream', 'device', 'channel', 'camera', 'scene'] is loaded. For the user input string output by ASR, the regular expression (?<=anchor)([one two three four five six seven eight nine zero]|\d+) is used to match numbers, mapping "one" to "1", "two" to "2", and so on. The normalized string is stored in the cache.
[0021] First level: Traverse the tool keywords, if the keyword is in the normalized input, a direct hit is made, and the subsequent steps are skipped.
[0022] Second level: If no hit is made, for each candidate tool, check whether all valid Chinese characters in the normalized input appear in the keyword, and len(valid input characters) / len(keyword) >= 0.7, a hit is made if the condition is satisfied.
[0023] Third level: If no hit is made in the first two levels, vectorize the normalized input and the first intent example of each tool. The vector model is bge-small-zh-v1.5, which is quantized to ONNX format, and inference is performed on the CPU, taking about 20ms. The cosine similarity is calculated with a threshold of 0.70.
[0024] Before entering the third level, extract the number sequences (using the regular expression \d+) from the normalized input and the candidate tool keywords respectively. For example, extract ['1'] from the input "large screen 1", extract ['2'] from the candidate "large screen 2", and if the comparison finds inconsistency, the candidate is skipped directly, and the log "number fusing" is recorded. The similarity calculation is allowed only when the sequences are completely identical (for example, both the input "large screen 1" and the candidate "large screen 1" are ['1']).
[0025] For the successfully matched tools, group them by prefix (for example, "turn on light" and "turn off light" belong to the same "light" group), and only retain the action with the highest similarity in the same group. At the same time, all candidates are sorted by score. If the difference between the highest score and the second highest score is greater than 0.05, only the candidate with the highest score is retained to avoid concurrent multiple actions.
[0026] The parameters of the successfully matched tool are sent to the corresponding device driver (such as serial port, GPIO, HDMI control) via the local API interface, while logging is recorded and the execution result is fed back to the upper-layer interface. The entire process is completed within 50ms.
Claims
1. A method for distributing edge-end smart device tools based on three-level matching and digital alignment, characterized in that, Includes the following steps: Step 1, Normalization of Chinese Numerals in Business Anchors: Establish a set of business term anchors, use regular expressions to extract only the Chinese numerals immediately following the anchor words and convert them into Arabic numerals to form normalized user input; Step two, three-level cascading matching: First-level positive substring matching: Traverse the tool keywords in the configuration. If a tool keyword is completely contained in the normalized user input, it is directly determined to be a match and tool distribution is executed. 1) If the first level does not match, the second level reverse substring ratio matching is performed: it is determined whether the valid characters entered by the user are contained in the candidate tool keywords, and the ratio of the length of the user input to the length of the candidate keywords reaches the preset threshold (≥70%). If so, it is determined to be a match. 2) If the second level still fails to match, perform the third level of local embedding semantic similarity matching: run a lightweight vector model on the edge CPU to calculate the cosine similarity between the normalized user input and each tool intent example; Step 3, Number Security Alignment Lock: Before performing the third-level matching, extract all number sequences from the normalized user input and the candidate tool keywords respectively. Similarity calculation is only allowed if the number sets of the two are completely consistent; if the numbers are inconsistent, the circuit is forcibly broken and the tool is refused to be executed. Step 4, Action Anti-collision and Difference Filtering: Perform prefix deduplication on the hit results within the same group. If multiple candidate actions belong to the same device group, only the one with the highest score is retained. If the difference between the highest score and the second highest score is greater than the set threshold (0.05), the second highest candidate is discarded, and the final distribution is performed.
2. The method according to claim 1, characterized in that: The set of business terminology anchors includes at least "large screen, screen, video stream, device, channel, camera, scene".
3. The method according to claim 1, characterized in that: The preset threshold in the reverse substring ratio matching is 0.7 by default, and this threshold can be configured to adapt to different speech recognition accuracies.
4. The method according to claim 1, characterized in that: The lightweight vector model is bge-small-zh-v1.5, deployed in ONNX format, and inference is performed via the CPU's ONNX Runtime.
5. The method according to claim 1, characterized in that: The default security similarity threshold for the third-level matching is 0.70; only those exceeding this threshold are considered semantically similar.
6. The method according to claim 1, characterized in that: The complete consistency of the number set means that the extracted number list elements are the same and in the same order; for cases where there are no numbers, it is considered as an empty set alignment.
7. The method according to claim 1, characterized in that: The deduplication of prefix conflicts within the same group is based on clustering the common prefixes of the tool's keywords. Within the same cluster, only the action with the highest score is executed to avoid hardware short circuits.
8. The method according to claim 1, characterized in that: The method is deployed entirely locally on the embedded edge device, without relying on any cloud services, and all computations are performed offline.
9. An edge-end smart device tool distribution system employing the method described in any one of claims 1 to 8, characterized in that, include: The input normalization module is used to perform Chinese numeral normalization of business anchor points; The cascaded matching engine is used to sequentially perform forward substring matching, reverse substring ratio matching, and local embedding semantic similarity matching. The number alignment lock module is used to verify the consistency of the number set before the third-level matching; Anti-collision filters are used to perform deduplication within the same group and differential filtering; The tool execution interface is used to issue final control commands to physical devices.
10. The system according to claim 9, characterized in that: The system runs on an edge control motherboard based on RK3588 or equivalent computing power, and the tool configuration library is stored in JSON format on local storage media.