Order note field information extraction method, system, device and storage medium
Patent Information
- Application Number
- CN202610882214.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-18
- Publication Date
- 2026-08-18
- Estimated Expiration
- 2046-06-18
AI Technical Summary
这类方案的主要问题包括:首先,知识库的构建和维护成本极其高昂,物流业务涉及的地名、快递公司、异常类型等知识频繁变化,需要投入大量人力进行持续更新
[0019]本发明的目的在于提供订单备注的字段信息抽取方法、系统、设备及存储介质,能够通过“多提示模板并行联合训练”,可在不改动原有字段模板与训练数据的前提下,独立增加新字段及其数据,从根本上避免传统微调的灾难性遗忘,实现零遗忘的增量扩展。同时,采用“语义筛选→大模型自动标注→规则后处理修正”三阶段弱监督方法,仅需筛选少量相关样本,即可高效构建新字段训练数据,使数据获取成本降至传统人工标注成本的5%以下。此外,通过提示模板动态切换机制,使一个训练完成的模型能够根据输入的任务识别码灵活选择不同粒度的输出字段集合,在不增加模型数量和推理成本的前提下满足多样化的业务需求,具有极高的工业实用价值。
Smart Images

Figure CN122414417B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing and information extraction technology, and more specifically, to a method, system, device, and storage medium for extracting field information from order remarks. Background Technology
[0002] With the rapid development of e-commerce and modern logistics, logistics order systems need to process massive amounts of order data every day. Order remarks, as a crucial communication medium between users and logistics service providers, contain a large amount of unstructured key information, such as special delivery requirements, address changes, recipient preferences, and explanations of any anomalies. Efficiently and accurately extracting structured field information from these free-text remarks is of significant business value for achieving automated order routing, intelligent anomaly detection, accurate customer profiling, and optimized last-mile delivery routes.
[0003] Existing logistics order information extraction technologies can be divided into two main categories: the first category is information extraction schemes that combine knowledge base retrieval with large models, and the second category is structured information extraction schemes that are based on single-task models.
[0004] For the first type of solution, the typical approach is to pre-build a logistics knowledge base containing domain knowledge, entity relationships, and synonym mappings. When information needs to be extracted from order notes, the retrieval module first searches for relevant content in the knowledge base, and then leverages the understanding and generation capabilities of a large language model to complete the final information extraction. The main problems with this type of solution include: First, the construction and maintenance costs of the knowledge base are extremely high. Knowledge related to logistics operations, such as place names, courier companies, and anomaly types, changes frequently, requiring significant manpower for continuous updates. Second, the completeness of the knowledge base's coverage is difficult to guarantee. For new words not included in the database, obscure expressions, or common expressions used in specific regions, the retrieval module often fails to retrieve valid information, leading to extraction failure. Third, the cost of large model inference is high, especially in logistics scenarios with daily processing volumes reaching millions or even tens of millions. The API fees for calling large models or the computational overhead of building a large model in-house are enormous burdens. Finally, the solution has poor scalability. When the business needs to add a new extraction field (such as "whether ice packs are needed" or "whether there are fragile items"), it often requires rebuilding the knowledge base or retraining the retrieval model, with a response cycle of several weeks or even months.
[0005] The second approach is based on a single-task, single-model paradigm. This involves collecting labeled data and training a dedicated structured information extraction model for all fields that need to be extracted. This approach does not rely on external knowledge bases, has fast inference speed, and the number of parameters in the model is much smaller than that of general-purpose large models. However, its main problems are equally prominent: First, the model's generalization ability is limited; when the text style or expression of order notes shifts, the extraction performance drops significantly. Second, the problem of catastrophic forgetting is extremely serious, which is the core bottleneck restricting the practical application of this approach. In logistics operations, the addition of new fields occurs frequently (e.g., when a platform launches a new "door-to-door installation" service, it needs to extract information such as installation time and address from the notes). When adding new fields to an old model using traditional fine-tuning methods, the model learns new knowledge while simultaneously suffering catastrophic forgetting of its ability to extract existing fields, leading to a significant decline in the performance of existing business processes. For example, a model that could originally extract the "recipient's mobile phone number" with 98% accuracy may see its accuracy plummet to below 85% after a minor adjustment that adds the "expected delivery time" field.
[0006] In summary, existing technical solutions suffer from fatal flaws in incremental field expansion scenarios for logistics order remarks, such as catastrophic forgetting, high cost of annotating new fields, and poor model scalability, making it difficult to adapt to the actual needs of high-frequency changes and rapid iterations in logistics operations.
[0007] In view of this, the present invention provides a method, system, device and storage medium for extracting field information of order remarks. Summary of the Invention
[0008] In view of the problems in the prior art, the purpose of this invention is to provide a method, system, device and storage medium for extracting field information of order remarks, which overcomes the defects of the prior art, can overcome the forgetting problem of the prior art, realize incremental field expansion with zero forgetting, significantly reduce the cold start threshold of new field expansion, and can flexibly adapt to multi-granularity business output needs.
[0009] An embodiment of the present invention provides a method for extracting field information from order remarks, comprising the following steps: S110. Construct a basic extraction model, which is based on a pre-trained language model and obtained by multi-task joint training using training data from an annotated initial field set and a first prompt template. S120. When a new field needs to be added, execute the weakly supervised data construction process for the new field: based on the unlabeled order remarks corpus, perform semantic filtering, automatic labeling of the large model and rule post-processing correction for each new field in sequence to generate a training dataset with the new field label. S130. Design a second prompt template independently for the newly added field. The second prompt template includes natural language descriptions and output format constraints for the original field and the newly added field, and does not modify the first prompt template. S140. Perform parallel joint training of multiple prompt templates. Use the basic extraction model as the initial model. In each training iteration, mix and sample from the original field training data and the newly added field training data to construct a joint loss function containing the first prompt template and the second prompt template. Update the parameters through the gradient coordination strategy to obtain the extended extraction model. S150. During the inference phase, the prompt template is dynamically switched according to the input task identification code: if the task identification code corresponds to the first prompt template, the extraction result of the initial field set is output; if the task identification code corresponds to the second prompt template, the extraction result of the complete field set including the initial field and the newly added field is output.
[0010] Preferably, step S120 includes: S121. Keyword screening: Construct a domain dictionary or keyword set for each new field, and quickly recall candidate samples from the full unlabeled corpus through keyword matching; S122, Semantic Similarity Screening: A lightweight semantic encoder is used to calculate the cosine similarity between the remark text of each order and the description of the new field definition. A similarity threshold is set to filter out semantically irrelevant noise samples and obtain a candidate sample set. S123, Automatic annotation of large models: Construct prompt words containing new field definitions, value types and output format constraints, call the general large language model to automatically annotate the candidate sample set, and obtain the initial annotation results; S124. Rule post-processing correction: A rule engine combining regular expressions and dictionary matching is used to correct missing or incorrect labels in the initial labeling results and generate a training dataset with new field labels.
[0011] Preferably, in step S140, the sampling ratio of the mixed sampling is dynamically adjusted according to the validation set performance of the original field task and the newly added field task, and the total loss function is the weighted sum of the loss of the original field task and the loss of the newly added field task, wherein the loss of the original field task is calculated based on the first prompt template, and the loss of the newly added field task is calculated based on the second prompt template.
[0012] Preferably, the gradient coordination strategy in step S140 includes: in the layer with shared parameters, calculating the cosine similarity between the original field task gradient and the new field task gradient; when the cosine similarity is negative, projecting the new field task gradient onto the hyperplane orthogonal to the original field task gradient to obtain the corrected gradient for parameter update.
[0013] Preferably, step S140 further includes a training termination condition: simultaneously monitoring the F1 value of the original field task and the F1 value of the new field task on the validation set; when the F1 value of the original field task drops below a preset threshold compared to before training, training is stopped or the learning rate is reduced and rolled back to the previous round of parameters.
[0014] Preferably, the method further includes an iterative closed loop of continuous expansion: when more fields need to be added, steps S120 to S140 are repeated, and each expansion keeps all previous prompt templates and their corresponding training data unchanged, only adding new prompt templates containing more fields, and constructing weakly supervised data for the new fields.
[0015] Preferably, the method further includes output verification and fallback steps: after the model output, field integrity verification and rule consistency verification are performed. For fields with confidence scores below the threshold, the model results are not adopted and are transferred to manual review or downgraded to a traditional rule extraction module based on regular expressions or dictionary matching.
[0016] Embodiments of the present invention also provide a system for extracting field information from order remarks, used to implement the above-described method for extracting field information from order remarks, the system comprising: The basic model building module is used to build a basic extraction model. The basic extraction model is based on a pre-trained language model and is obtained by multi-task joint training using training data from a labeled initial field set and a first prompt template. The weakly supervised data construction module is used to execute the weakly supervised data construction process for new fields when new fields need to be added: based on the unlabeled order remarks corpus, semantic filtering, automatic labeling of large models and rule post-processing correction are performed sequentially for each new field to generate a training dataset with new field labels; The prompt template management module is used to independently design a second prompt template for the newly added field. The second prompt template contains natural language descriptions and output format constraints for the original field and the newly added field, and does not modify the first prompt template. The parallel joint training module is used to perform parallel joint training of multiple prompt templates. It takes the basic extraction model as the initial model, and in each training iteration, it mixes and samples from the original field training data and the newly added field training data to construct a joint loss function containing the first prompt template and the second prompt template. The parameters are updated through a gradient coordination strategy to obtain the extended extraction model. The dynamic template reasoning module is used to dynamically switch the prompt template based on the input task identification code during the reasoning phase: if the task identification code corresponds to the first prompt template, the extraction result of the initial field set is output; if the task identification code corresponds to the second prompt template, the extraction result of the complete field set including the initial field and the newly added field is output.
[0017] Embodiments of the present invention also provide a device for extracting field information of order remarks, comprising: processor; A memory in which executable instructions of the processor are stored; The processor is configured to perform the steps of the above-mentioned order remarks field information extraction method by executing the executable instructions.
[0018] Embodiments of the present invention also provide a computer-readable storage medium for storing a program, which, when executed, implements the steps of the above-described method for extracting field information of order remarks.
[0019] The purpose of this invention is to provide a method, system, device, and storage medium for extracting field information from order remarks. Through "parallel joint training with multiple prompt templates," new fields and their data can be added independently without modifying existing field templates and training data, fundamentally avoiding the catastrophic forgetting of traditional fine-tuning and achieving incremental expansion with zero forgetting. Simultaneously, a three-stage weakly supervised method of "semantic filtering → automatic annotation of large models → rule post-processing correction" is employed, requiring only a small number of relevant samples to efficiently construct training data for new fields, reducing data acquisition costs to less than 5% of traditional manual annotation costs. Furthermore, through a dynamic prompt template switching mechanism, a trained model can flexibly select different granularity sets of output fields based on the input task identification code, meeting diverse business needs without increasing the number of models or inference costs, thus possessing extremely high industrial practical value. Attached Figure Description
[0020] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings.
[0021] Figure 1 This is a flowchart of the method for extracting field information from order remarks according to the present invention.
[0022] Figure 2 This is a schematic diagram of the process steps for implementing the order remarks field information extraction method of the present invention.
[0023] Figure 3 This is a system architecture diagram of the order remarks field information extraction system of the present invention.
[0024] Figure 4 This is a schematic diagram of the device for extracting field information of order remarks according to the present invention.
[0025] Figure 5 This is a schematic diagram of the structure of a computer-readable storage medium according to an embodiment of the present invention. Detailed Implementation
[0026] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that the invention will be thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar structures, and therefore repeated descriptions of them will be omitted.
[0027] The use of terms such as "first," "second," and similar terms in the specific description does not indicate any order, quantity, or importance, but is merely used to distinguish different components. Furthermore, in the description of this invention, terms such as "upper," "lower," etc., indicate orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings. These are merely for ease of description and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation; therefore, they should not be construed as limitations on the invention.
[0028] It should be noted that, unless otherwise specified, the embodiments of the present invention and the features in different embodiments can be combined with each other.
[0029] Figure 1 This is a flowchart of the method for extracting field information from order remarks according to the present invention. For example... Figure 1As shown, this invention provides a method for extracting field information from incremental order remarks, which mainly includes steps S110 to S150. Step S110: Constructing a basic extraction model. Specifically, the development team first selects a pre-trained language model as the backbone network, such as Qwen3-4B or BERT. Then, based on historically labeled logistics order remarks corpus, initial N extraction fields are determined, such as recipient name, contact number, province, city, detailed address, and tracking number. Next, a first prompt template T1 is designed, which includes natural language descriptions of all N fields, value range descriptions, and the expected output format. Finally, the pre-trained model is fine-tuned using labeled N-field training data to obtain the basic extraction model M0. Step S120: When a new field needs to be added, a weakly supervised data construction process for the new field is executed. Assume the business needs to add two fields: "Is it fragile?" and "Expected delivery time". The system is based on a massive unlabeled order note corpus accumulated by enterprises. It recalls a small number of samples containing semantics such as "glass," "handle with care," "tomorrow morning," and "delivery on weekdays" through semantic filtering. Then, it calls a large model for automatic labeling. Finally, a rule engine corrects time expressions such as "morning" and "afternoon," generating labeled training data. Step S130: A second prompt template T2 is independently designed for the newly added fields. T2 contains a complete description of the original N fields and the newly added M fields, without modifying the original T1. Step S140: Parallel joint training of multiple prompt templates is performed. The basic extraction model M0 is used as the initial model. In each training iteration's mini-batch, a portion of the data from the original N-field task is sampled, and another portion is sampled from the newly constructed M-field training data. A joint loss function containing T1 and T2 is constructed, and parameters are updated through a gradient coordination strategy, ultimately obtaining the extended extraction model M1. Step S150: During the inference phase, the prompt template is dynamically switched based on the input task identification code. If the business system only needs the original N fields (e.g., for routing and sorting), then call T1, and the model outputs N field results; if the business system needs N+M complete fields (e.g., for customer profiling analysis), then call T2, and the model outputs complete field results. The technical advantages of this embodiment are: by using a multi-cue template parallel joint training mechanism, catastrophic forgetting is fundamentally avoided, achieving incremental field expansion with zero forgetting; by constructing weakly supervised data, the cold start cost of new fields is significantly reduced; and by using a dynamic switching mechanism, a single model can meet multi-granularity output requirements, significantly improving the model's practicality and scalability.
[0030] In a preferred embodiment, step S120 is further defined. Step S121, initial keyword screening. For example, for the newly added field "whether it is fragile", a keyword set {"fragile", "handle with care", "glass", "ceramic", "careful"} is constructed. All candidate samples containing these keywords are quickly recalled from tens of millions of unlabeled corpora using search engines such as Elasticsearch (an open-source distributed search and analytics engine), with a recall target of over 90%. Step S122, semantic similarity fine screening. Using a lightweight semantic encoder such as BGE-base-zh, each candidate comment text and the field definition description of "whether it is fragile" (e.g., "whether the item is fragile, such as glass, ceramic, electronic products, etc.") are encoded into vectors, and cosine similarity is calculated. A similarity threshold of 0.7 is set to filter out semantically irrelevant noise, ultimately obtaining a set of thousands of high-quality candidate samples. Step S123, automatic large-scale model annotation. A dedicated prompt term is constructed, including the definition of "fragile" ("If the note mentions that the item is easily broken and needs to be handled with care, extract 'Yes'; otherwise, extract 'No'") and the output format ("{"is_fragile": "Yes / No"}"). The candidate sample set is automatically labeled using a general large-scale model API to obtain initial labeling results. Step S124: Rule post-processing correction. A rule engine is designed; for example, the regular expression "cannot be inverted|fragile|handle with care" is uniformly mapped to "Yes," while when the dictionary contains common non-fragile terms such as "books|clothes|toys," if there is no explicit description of fragility, it is corrected to "No." After rule correction, the label quality can cover more than 95% of common boundary cases. The technical effect of this embodiment is that it reduces the data acquisition cost of new fields from tens of thousands of yuan in traditional manual labeling to hundreds of yuan in API call fees, significantly lowering the cold start threshold for new field expansion, while ensuring the quality of training data.
[0031] In a preferred embodiment, the mixed sampling and loss function in step S140 are defined. Specifically, the sampling ratio of the mixed sampling is dynamically adjusted based on the validation set performance of the original field task and the new field task. For example, during training, the F1 scores of the original task (N field) and the new task (N+M field) are evaluated on the validation set after every 500 iterations. If the F1 score of the original task is found to be decreasing, the sampling ratio of the original field task data, `bold`, is dynamically increased, so that `bold:bnew` is adjusted from 1:1 to 2:1. The total loss function is the weighted sum of the original field task loss and the new field task loss: `Ltotal = λold·Lold + λnew·Lnew`. Where `Lold` is the cross-entropy prediction loss of the original N field calculated using the first cue template T1, and `Lnew` is the cross-entropy prediction loss of the N+M field calculated using the second cue template T2. The weight λ can be dynamically adjusted according to the performance changes of the old task on the validation set. For example, when the F1 score of the old task decreases by 0.3%, `λold` is increased from 0.5 to 0.7. The technical effect of this embodiment is that by dynamically adjusting the sampling ratio and loss weight, a balanced learning between the new and old tasks is achieved, which not only ensures the learning effect of the new field, but also further strengthens the protection of the knowledge of the old field, effectively preventing catastrophic forgetting.
[0032] In a preferred embodiment, the gradient coordination strategy in step S140 is defined. In the multi-layer Transformer shared parameters of the model, the cosine similarity between the original task gradient `gold` and the new task gradient `gnew` in each layer is calculated. When the cosine similarity is negative, indicating a conflict in the parameter update directions of the two tasks, a gradient projection method is used. The corrected `gnew` replaces the original `gnew` for parameter updates. For example, in the 12th attention layer of the model, the calculated cosine similarity between `gold` and `gnew` is -0.3, indicating a conflict. After projection, the new update direction is orthogonal to `gold`, avoiding mutual cancellation. When the cosine similarity is non-negative, the original gradient remains unchanged. The technical effect of this embodiment is that it coordinates the learning process of multiple tasks at the optimization algorithm level, completely solves the problem of direction conflict during parameter updates, and provides a solid mathematical guarantee for learning new capabilities without forgetting old capabilities.
[0033] In a preferred embodiment, the training termination condition in step S140 is defined. During joint training, after each epoch, two core metrics are monitored simultaneously on an independent validation set: the F1 score of the original N-field task and the F1 score of the new (N+M)-field task. The preset threshold is 0.5%. When the F1 score of the original field task is detected to have decreased by more than 0.5% compared to the baseline value before the start of this training round, the system triggers the termination condition: immediately stops the current training, reduces the learning rate, and rolls back to the model parameters at the end of the previous epoch, then restarts training with a smaller learning rate. If rollback is triggered twice consecutively, training is completely terminated, and a manual warning is issued. Training only ends normally when the F1 score of the original field task stabilizes (decreases <0.2%) and the F1 score of the new field task converges. The technical effect of this embodiment is that by setting a strict security monitoring and rollback mechanism, the safety of the model during the expansion process is ensured, serious accidents caused by training out of control leading to a significant drop in online business performance are prevented, and industrial-grade protection is provided for the reliable iteration of the model.
[0034] In a preferred embodiment, field requirements are continuously generated in logistics operations. Assume the current model already supports the initial N fields and the first expansion of M1 fields (e.g., "Is it fragile?"). Now, it is necessary to add K more fields, such as "Does it require a return receipt?" and "Does it contain batteries?". This method supports repeating steps S120 to S140 for multiple independent expansions. During the second expansion, the system keeps all previous prompt templates (T1, T2) and their corresponding historical training data completely unchanged. Then, a third prompt template T3 is independently designed for the newly added K fields, containing descriptions of the N+M1+K complete fields. During training, a prompt template routing strategy is adopted, randomly selecting 2-3 prompt templates (e.g., T1 and T3, or T2 and T3) in each iteration for forward computation and optimization, rather than all templates. This effectively controls the linear increase in training overhead as the number of templates increases. The technical advantage of this embodiment is that it constructs a continuous learning closed loop that supports unlimited incremental field expansion with zero forgetting, enabling the information extraction model to grow together with the logistics business without any one-time "rebuild", which greatly extends the model's life cycle and reduces long-term maintenance costs.
[0035] In a preferred embodiment, after the model inference outputs structured results, the system initiates a verification and fallback module. First, a field integrity check is performed to verify that the output JSON contains all fields required by the task identifier. For example, if call T2 requires 10 fields, but the model only outputs 9, default value filling (e.g., "fragile" defaults to "no") is triggered for the missing fields, or a follow-up process is initiated with the business system. Second, a rule consistency check is performed, for example, using domain logic rules: if the extracted result for "expected delivery time" is "February 30th," the date rule check fails, and the field is considered invalid. Simultaneously, the model assigns a confidence score to each output field. A global threshold of 0.8 is set. For fields with a confidence score below 0.8, the system does not accept the model result but downgrades it to a traditional rule extraction module based on regular expressions and dictionary matching for secondary processing. If the rule module also cannot extract the field, it is ultimately marked as "unknown" and manual review is requested. All failed cases are recorded in the audit log for subsequent model iteration and optimization. The technical effect of this embodiment is that it effectively balances the efficiency and robustness of the model. Through a multi-level protection system of "model as the main component, rules as the auxiliary component, and human intervention as a backup", it minimizes the business risks caused by model misjudgment and ensures the reliability of the invention in high-risk business scenarios.
[0036] The specific implementation of this invention is as follows: Taking a large logistics company, "Express Logistics," as an example, and combining... Figure 1 , Figure 2 This document describes in detail a complete implementation process of the present invention, which includes as many technical features as possible.
[0037] Step 1: Building the basic extraction model The express logistics company handles an average of 5 million orders per day. Its order notes are highly unstructured, such as "Zhang San, phone number 13800000000, address: XX City, XX District, XX Building, please leave the package at the front desk, fragile item." First, based on its historical corpus of 100,000 manually annotated order notes, the company identified seven core extraction fields: recipient name, phone number, province, city, district, detailed address, and tracking number. The development team used the open-source Qwen3-4B pre-trained model as the backbone network and carefully designed the first prompt template T1: "You are a logistics information extraction expert. Please extract the following from the order remarks: recipient's name (string), contact number (11 digits), province (standard name), city (standard name), district / county (standard name), detailed address (string), and tracking number (string). The output format is JSON: {"name": "", "phone": "", "province": "", "city": "", "district": "", "address": "", "tracking_number": ""}. Remark text: [Remark content]". Subsequently, the Qwen3-4B model was supervisedly fine-tuned using 100,000 labeled data points. After 10 epochs, the model achieved an average F1 score of 97.5% on the validation set. This model became the basic extraction model M0 and was officially launched to handle daily order routing business. Since the extraction of each field can be regarded as an independent subtask, the simultaneous learning of N fields constitutes multi-task joint training.
[0038] Step 2: New Field Requirements Analysis and Semantic Filtering Three months later, the company launched a new value-added service called "Yosuda," which required identifying from the user's notes whether they requested "door-to-door delivery" and their "desired delivery time slot" (e.g., morning, afternoon, evening). To expand these two new fields, the system invoked the weakly supervised data construction module. First, for the "door-to-door delivery" field, a keyword set was constructed: {"delivered to door," "upstairs," "no one home," "leave at the door"}; for the "desired delivery time slot" field, a keyword set was constructed: {"morning," "noon," "afternoon," "evening," "before 8 am," "after 5 pm"}. The system retrieved 120,000 and 180,000 candidate samples respectively from the company's 300 million unlabeled historical notes corpus using Elasticsearch for keyword matching. Then, using the BGE semantic encoder, the cosine similarity of each candidate note to the definitions of the "door-to-door delivery" field ("whether the user requests the package to be delivered to their door or home, rather than a delivery station or locker") and the "desired delivery time slot" field ("the user's preferred delivery time range"). With a similarity threshold of 0.75, we obtained 3000 and 4500 high-quality candidate sample sets Dcand by filtering.
[0039] Step 3: Weakly supervised automatic labeling and rule correction For the candidate sample sets of the two new fields, the system calls the DeepSeek-V2 large model API (no fine-tuning required) for automatic labeling. The constructed prompt word template is: "Task: Determine whether 'door-to-door delivery' is requested in the given order remarks. Definition: The user explicitly requests the courier to deliver the package to the door or home. Remarks: [Remark content]. Please output: {"require_home_delivery": "Yes / No"}". After the large model returns the initial labeling results, the rule engine intervenes to correct them. For example, for the "door-to-door delivery" field, the rule engine sets: if the remarks contain "place at the station" or "place in the express locker", it will be corrected to "No" regardless of the large model result; if it contains "delivered to the door" or "climb the stairs", it will be corrected to "Yes". For "expected delivery time period", the rule engine standardizes "morning", "early", "9-12 o'clock" etc. to "morning"; and standardizes "afternoon" and "1-5 o'clock" to "afternoon". After this correction, two high-quality training datasets Dnew with accurate labels were finally obtained, totaling 7,500 samples. The entire process only took a few hours of API calls and rule writing time, costing about 500 yuan, which is far lower than the 100,000 yuan cost of traditional manual annotation.
[0040] Step 4: Constructing independent prompt templates and parallel joint training Without modifying any content of the original first prompt template T1, the system independently designs a second prompt template T2 for the two newly added fields. The content of T2 is: "You are a logistics information extraction expert. Please extract the following from the order remarks: recipient's name, contact number, province, city, district / county, detailed address, tracking number, whether door-to-door delivery is available (yes / no), and desired delivery time (morning / afternoon / evening). The output format is JSON: {"name": "", "phone": "", "province": "", "city": "", "district": "", "address": "", "tracking_number": "", "home_delivery": "", "delivery_time_slot": ""}. Remarks text: [Remarks content]". Then, the basic extraction model M0 is used as the initial model for incremental joint training. In each mini-batch, 32 data points are sampled from the original 100,000 7-field data points, and 32 data points are sampled from the newly constructed 7,500 9-field data points, with a mixing ratio of 1:1. Although the sampling ratio is 1:1, to further strengthen the protection of old field knowledge, a higher weight (0.6) is assigned to the old task in the loss function. The total loss function is Ltotal = 0.6*Lold(T1) + 0.4*Lnew(T2), where Lold has a higher weight to protect the old task. In the 8th Transformer layer of the model training, the gradient coordination module detects that the cosine similarity between gold and gnew is -0.2, and immediately performs gradient projection, projecting gnew onto a hyperplane orthogonal to gold, generating a conflict-free update direction. During training, the system monitors the F1 score after each epoch. When the third epoch was reached, the F1 score for the original seven fields dropped from 97.5% to 97.1%, a decrease of 0.4%, which did not exceed the preset threshold of 0.5%, so training continued. By the fifth epoch, the F1 score for the original seven fields stabilized at 97.3%, and the F1 score for the two newly added fields reached 96.8%, at which point training terminated, resulting in the extended extraction model M1.
[0041] Step 5: Dynamic Task Switching Reasoning and Output Verification After model M1 went live, it supported dynamic task switching. During peak daytime order periods, the routing system only needed the original 7 fields to sort packages. It sent the task identifier "task_v1" and the note "Li Si, 188xxxx, No. 18, XX Road, XX District, XX City, please deliver after 3 PM" to the model. After recognizing the task identifier, the model called T1, outputting JSON containing only 7 fields, omitting "home_delivery" and "delivery_time_slot". However, in the evening customer profiling analysis task, the data analysis platform sent the task identifier "task_v2" and the same note. The model called T2, outputting a complete JSON containing all 9 fields. All outputs were validated by the validation module. For example, in one extraction, the confidence score of the model's output "expected delivery time period" was only 0.6, below the threshold of 0.8. The system handed this field over to the rules module for processing. The rules module successfully extracted "after 3 PM" as "afternoon" using regular expressions, ultimately outputting the correct result. In one extreme case, the "detailed address" field was empty, triggering an integrity check. Based on the confidence level and other field information, the system determined it to be high-risk and transferred the note to manual review for final processing.
[0042] Step 6: Continuously expand the iterative closed loop Six months later, the company's business required the addition of two new fields: "whether it contains batteries" and "whether it requires cold chain logistics." The system perfectly executed the second expansion: keeping T1 and T2 unchanged, a new dataset T3 containing all 11 fields was designed for the two newly added fields. Steps two, three, and four were repeated to construct the weakly supervised data corresponding to T3, and a second incremental joint training was performed. Since the historical data corresponding to T1 and T2 and the data from the first expansion were not modified, and the gradient coordination strategy remained effective, the model did not suffer any substantial forgetting in its ability to extract the original seven fields and the two fields from the first expansion throughout the entire process of learning "whether it contains batteries" and "whether it requires cold chain logistics." The F1 score fluctuation remained within 0.3%, achieving continuous incremental learning with zero forgetting in incremental field expansion.
[0043] Through the complete implementation of the above six steps, this invention successfully built an intelligent information extraction system for express logistics companies. This system can adapt to frequent business changes, achieve zero-cost forgetting, expand new fields at low cost, and flexibly adapt to multi-task output, completely solving all the shortcomings of existing technical solutions and generating significant economic and technical benefits. Through core technological innovations such as parallel joint training of multiple prompt templates, three-stage weakly supervised data construction, and dynamic prompt template switching, this invention achieves for the first time industrial-grade, zero-forgetting incremental field expansion in the field of logistics order remarks information extraction, possessing extremely high practical value and broad prospects for promotion.
[0044] This invention constructs a complete, industrial-grade, and productizable incremental field expansion information extraction system for logistics order notes. Through the synergistic effects of mechanisms such as parallel joint training with multiple prompt templates, three-stage weakly supervised data construction, dynamic task switching, gradient coordination, fallback mechanisms, and continuous expansion loop, this system achieves incremental learning with zero forgetting in incremental field expansion, cold start of new fields at 5% lower cost than traditional manual annotation, flexibility in supporting multi-granularity output with a single model, and sustainable evolution capabilities that can accompany the long-term evolution of logistics operations. This product form fundamentally solves the expansion bottleneck of existing technologies in dynamic business scenarios, possessing extremely high technological advancement and commercial promotion value.
[0045] Figure 3 This is a diagram illustrating the overall system architecture of the browser connector service in the order remarks field information extraction system of this invention. Figure 3 As shown, the incremental order remarks field information extraction system 5 of the present invention includes: The basic model building module 51 is used to build a basic extraction model. The basic extraction model is based on a pre-trained language model and is obtained by multi-task joint training using training data from an annotated initial field set and a first prompt template (the basic model output by the basic model building module 51 can be used as the initial model of the parallel joint training module).
[0046] The weakly supervised data construction module 52 is used to execute the weakly supervised data construction process for new fields when new fields need to be added: based on the unlabeled order remarks corpus, semantic filtering, automatic labeling of large models and rule post-processing correction are performed sequentially for each new field to generate a training dataset with new field labels.
[0047] The prompt template management module 53 is used to independently design a second prompt template for the newly added field. The second prompt template contains natural language descriptions and output format constraints for the original field and the newly added field, and does not modify the first prompt template.
[0048] The parallel joint training module 54 is used to perform parallel joint training of multiple prompt templates. It takes the basic extraction model as the initial model, and in each training iteration, it mixes and samples from the original field training data and the newly added field training data to construct a joint loss function containing the first prompt template and the second prompt template. The parameters are updated through a gradient coordination strategy to obtain the extended extraction model.
[0049] The dynamic template inference module 55 is used to dynamically switch the prompt template based on the input task identification code during the inference phase: if the task identification code corresponds to the first prompt template, the extraction result of the initial field set is output. If the task identification code corresponds to the second prompt template, the extraction result of the complete field set including the initial field and the newly added field is output.
[0050] In summary, the incremental order remarks field information extraction system of this invention can independently add new fields and their data without modifying the original field templates and training data through "parallel joint training of multiple prompt templates," fundamentally avoiding the catastrophic forgetting of traditional fine-tuning and achieving zero-forgetting incremental field expansion. Simultaneously, by employing a three-stage weakly supervised method of "semantic filtering → automatic annotation of large models → rule post-processing correction," only a small number of relevant samples need to be selected to efficiently construct training data for new fields, reducing data acquisition costs to less than 5% of traditional manual annotation.
[0051] This invention also provides a device for extracting field information from order remarks, including a processor and a memory storing executable instructions for the processor. The processor is configured to execute steps of a method for extracting field information from order remarks by executing the executable instructions.
[0052] As shown above, the order remarks field information extraction device of this invention in this embodiment can independently add new fields and their data without modifying the original field templates and training data through "parallel joint training of multiple prompt templates". This fundamentally avoids the catastrophic forgetting of traditional fine-tuning and achieves incremental field expansion with zero forgetting. At the same time, by adopting a three-stage weakly supervised method of "semantic screening → automatic annotation of large models → rule post-processing correction", only a small number of relevant samples need to be screened to efficiently construct training data for new fields, reducing the data acquisition cost to less than 5% of that of traditional manual annotation.
[0053] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "platform."
[0054] Figure 4 This is a structural schematic diagram of the order remarks field information extraction device of the present invention. See below for reference. Figure 4 To describe an electronic device 600 according to this embodiment of the present invention. Figure 4 The electronic device 600 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0055] like Figure 4 As shown, the electronic device 600 is presented in the form of a general-purpose computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including storage unit 620 and processing unit 610), a display unit 640, etc.
[0056] The storage unit stores program code, which can be executed by the processing unit 610 to perform the steps described in the method section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 610 can perform actions such as... Figure 1 The steps are shown in the figure.
[0057] Storage unit 620 may include readable media in the form of volatile storage units, such as random access memory (RAM) 6201 and / or cache memory 6202, and may further include read-only memory (ROM) 6203.
[0058] Storage unit 620 may also include a program / utility 6204 having a set (at least one) program module 6205, such program module 6205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0059] Bus 630 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the multiple bus structures.
[0060] Electronic device 600 can also communicate with one or more external devices 700 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 600, and / or with any device that enables electronic device 600 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 650. Furthermore, electronic device 600 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 660. Network adapter 660 can communicate with other modules of electronic device 600 via bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.
[0061] This invention also provides a computer-readable storage medium for storing a program, which, when executed, implements the steps of a method for extracting field information of order remarks. In some possible implementations, various aspects of this invention can also be implemented as a program product comprising program code that, when run on a terminal device, causes the terminal device to perform the steps described in the above-described method section of this specification according to various exemplary embodiments of the invention.
[0062] As shown above, the order remarks field information extraction system of this invention in this embodiment can independently add new fields and their data without modifying the original field templates and training data through "parallel joint training of multiple prompt templates". This fundamentally avoids the catastrophic forgetting of traditional fine-tuning and achieves incremental field expansion with zero forgetting. At the same time, by adopting a three-stage weakly supervised method of "semantic screening → automatic annotation of large models → rule post-processing correction", only a small number of relevant samples need to be screened to efficiently construct training data for new fields, reducing the data acquisition cost to less than 5% of that of traditional manual annotation.
[0063] Figure 5 This is a schematic diagram of the structure of the computer-readable storage medium of the present invention. (Reference) Figure 5 As shown, a program product 800 for implementing the above-described method according to an embodiment of the present invention is described. It may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0064] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0065] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0066] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0067] In summary, the purpose of this invention is to provide a method, system, device, and storage medium for incremental order note field information extraction. Through a "multi-hint template parallel joint training" mechanism, it can independently add hint templates and newly constructed training data for new fields while keeping the original field hint templates and training data completely unchanged. This fundamentally avoids the catastrophic forgetting problem caused by traditional fine-tuning, achieving zero-forgetting incremental field expansion. Simultaneously, through a three-stage weakly supervised data construction method of "semantic filtering → automatic large-model annotation → rule post-processing correction," it only needs to filter a small number of samples related to the new field from massive unlabeled order notes to automatically construct the training data for the new field at low cost and high efficiency, reducing the data acquisition cost for the new field to less than 5% of traditional manual annotation. Furthermore, through a dynamic hint template switching mechanism, a trained model can flexibly select different granularity sets of output fields based on the input task identification code, meeting diverse business needs without increasing the number of models or inference costs, and possessing extremely high industrial practical value.
[0068] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.
Claims
1. A method for extracting field information from order remarks, characterized in that, Includes the following steps: S110. Construct a basic extraction model, which is based on a pre-trained language model and obtained by multi-task joint training using training data from an annotated initial field set and a first prompt template. S120. When a new field needs to be added, execute the weakly supervised data construction process for the new field: Based on the unlabeled order remarks corpus, perform semantic filtering, automatic large-scale model annotation, and rule post-processing correction for each new field in sequence to generate a training dataset with new field labels. Step S120 includes: S121. Keyword initial screening: Construct a domain dictionary or keyword set for each new field, and quickly recall candidate samples from the full unlabeled corpus through keyword matching; S122. Semantic similarity fine screening: Use a lightweight semantic encoder to calculate the cosine similarity between each order remarks text and the definition description of the new field, set a similarity threshold to filter semantically irrelevant noise samples, and obtain a candidate sample set; S123. Automatic large-scale model annotation: Construct prompt words containing the definition, value type, and output format constraints of the new field, and call a general large-scale language model to automatically annotate the candidate sample set to obtain the initial annotation results; S124. Rule post-processing correction: Use a rule engine that combines regular expressions and dictionary matching to correct the missing or incorrect annotations in the initial annotation results and generate a training dataset with new field labels; S130. Design a second prompt template independently for the newly added field. The second prompt template includes natural language descriptions and output format constraints for the original field and the newly added field, and does not modify the first prompt template. S140. Perform parallel joint training of multiple prompt templates. Use the basic extraction model as the initial model. In each training iteration, sample from the original field training data and the new field training data to construct a joint loss function containing the first prompt template and the second prompt template. Update the parameters through a gradient coordination strategy to obtain the extended extraction model. The gradient coordination strategy includes: in the layer with shared parameters, calculate the cosine similarity between the gradient of the original field task and the gradient of the new field task. When the cosine similarity is negative, project the gradient of the new field task onto the hyperplane orthogonal to the gradient of the original field task to obtain the corrected gradient for parameter update. Step S140 also includes a training termination condition: monitor the F1 value of the original field task and the F1 value of the new field task on the validation set. When the F1 value of the original field task drops more than a preset threshold compared to before training, stop training or reduce the learning rate and roll back to the previous round of parameters. S150. During the inference phase, the prompt template is dynamically switched based on the input task identification code: if the task identification code corresponds to the first prompt template, the extraction result of the initial field set is output; if the task identification code corresponds to the second prompt template, the extraction result of the complete field set including the initial field and the newly added field is output. After the model output, field integrity verification and rule consistency verification are performed. For fields with confidence scores below the threshold, the model results are not adopted and are transferred to manual review or downgraded to the traditional rule extraction module based on regular expressions or dictionary matching.
2. The method for extracting field information from order remarks as described in claim 1, characterized in that, In step S140, the sampling ratio of the mixed sampling is dynamically adjusted according to the validation set performance of the original field task and the new field task. The total loss function is the weighted sum of the loss of the original field task and the loss of the new field task, wherein the loss of the original field task is calculated based on the first prompt template and the loss of the new field task is calculated based on the second prompt template.
3. The method for extracting field information from order remarks as described in claim 1, characterized in that, The method also includes a continuously expanding iterative closed loop: when more fields need to be added, steps S120 to S140 are repeated. Each time the expansion is performed, all previous prompt templates and their corresponding training data are kept unchanged, only new prompt templates containing more fields are added, and weakly supervised data for the new fields are constructed.
4. A system for extracting field information from order remarks, used to implement the method according to any one of claims 1 to 3, characterized in that, include: The basic model building module is used to build a basic extraction model. The basic extraction model is based on a pre-trained language model and is obtained by multi-task joint training using training data from a labeled initial field set and a first prompt template. The weakly supervised data construction module is used to execute the weakly supervised data construction process for new fields when they need to be added. Based on an unlabeled order remarks corpus, semantic filtering, automatic large-scale model annotation, and rule post-processing correction are performed sequentially for each new field to generate a training dataset with labels for the new field. This includes: Keyword initial screening: Constructing a domain dictionary or keyword set for each new field and quickly recalling candidate samples from the full unlabeled corpus through keyword matching; Semantic similarity fine screening: Using a lightweight semantic encoder, calculating the cosine similarity between each order remarks text and the definition description of the new field, setting a similarity threshold to filter semantically irrelevant noise samples, and obtaining a candidate sample set; Automatic large-scale model annotation: Constructing prompt words containing the definition, value type, and output format constraints of the new field, and calling a general large-scale language model to automatically annotate the candidate sample set to obtain the initial annotation results; Rule post-processing correction: Using a rule engine that combines regular expressions and dictionary matching, correcting missing or incorrect annotations in the initial annotation results, and generating a training dataset with labels for the new field. The prompt template management module is used to independently design a second prompt template for the newly added field. The second prompt template contains natural language descriptions and output format constraints for the original field and the newly added field, and does not modify the first prompt template. The parallel joint training module is used to perform parallel joint training of multiple prompt templates. The basic extraction model is used as the initial model. In each training iteration, the original field training data and the newly added field training data are mixed and sampled to construct a joint loss function containing the first prompt template and the second prompt template. The parameters are updated through a gradient coordination strategy to obtain an extended extraction model. The gradient coordination strategy includes: in the layer with shared parameters, the cosine similarity between the gradient of the original field task and the gradient of the newly added field task is calculated. When the cosine similarity is negative, the gradient of the newly added field task is projected onto the hyperplane orthogonal to the gradient of the original field task to obtain the corrected gradient for parameter update. The module also includes a training termination condition: on the validation set, the F1 value of the original field task and the F1 value of the new field task are monitored simultaneously. When the F1 value of the original field task decreases by more than a preset threshold compared with the time before training, training is stopped or the learning rate is reduced and the parameters are rolled back to the previous round. The dynamic template inference module is used to dynamically switch the prompt template based on the input task identification code during the inference phase: if the task identification code corresponds to the first prompt template, the extraction result of the initial field set is output; if the task identification code corresponds to the second prompt template, the extraction result of the complete field set including the initial field and the newly added field is output. After the model output, field integrity verification and rule consistency verification are performed. For fields with confidence scores below the threshold, the model results are not adopted and are transferred to manual review or downgraded to the traditional rule extraction module based on regular expressions or dictionary matching.
5. A device for extracting field information from order remarks, characterized in that, include: processor; A memory in which executable instructions of the processor are stored; The processor is configured to perform the steps of the order remarks field information extraction method according to any one of claims 1 to 3 by executing the executable instructions.
6. A computer-readable storage medium for storing a program, characterized in that, When the program is executed by the processor, it implements the steps of the method for extracting field information of order remarks as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Document element self-adaptive configuration and tuning method based on AI large model technology
CN121902773A