Large language model-based explicit and implicit mixed reasoning hierarchical multi-label text classification method and system

CN123030757APending Publication Date: 2026-11-03HARBIN INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611271301.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-20
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

Existing HMTC methods suffer from a cold start problem in specialized fields due to the scarcity of labeled data, making it difficult to dynamically adapt to new concepts. Furthermore, large language models lack hierarchical consistency constraints and semantic accuracy, making it difficult to meet the interpretability requirements of highly sensitive business scenarios.

Method used

The hierarchical label tree is split into explicit and implicit label libraries. Entity extraction and top-down recursive semantic scoring are used for classification. Knowledge injection into the model is enhanced by a noun definition knowledge base, a feature sample database, and a multimodal knowledge graph to ensure the hierarchical consistency and traceability of the classification results.

Benefits of technology

It achieves high-precision multi-label classification in the absence of large-scale labeled data, avoids errors in the recognition of technical terms and illusion paths, and meets the interpretability requirements of highly sensitive business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123030757A_ABST
    Figure CN123030757A_ABST
Patent Text Reader

Abstract

The application discloses a kind of explicit and implicit mixed inference hierarchical multi-label text classification method and system based on large language model, belong to natural language processing and text classification technical field. Original hierarchical label tree is split into explicit and implicit label library according to semantic attribute;Explicit label library is outputted explicit path by entity extraction and fuzzy matching;Implicit label library is scored by calling large language model from top to bottom layer by layer, and implicit path is outputted by truncation screening;For the end node of explicit path, if there is sub-label in implicit label library, then the path is prefixed to start implicit recursive reasoning to generate hybrid label path;After three kinds of path fusion and deduplication, the multi-label set satisfying hierarchical consistency constraint is outputted.The application unifies the classification processing of entity type and abstract type label without relying on large-scale labeled data, alleviates the problem of professional field term blind area and semantic illusion, and the classification result path is complete and traceable, and cross-domain migration can be realized without modifying code.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language processing and text classification technology, specifically relating to a hierarchical multi-label text classification method based on explicit and implicit hybrid reasoning using a large language model. Background Technology

[0002] The volume of text in professional fields such as financial research reports, industry news, policy documents, and book publishing is exploding, and its content often involves multi-dimensional and multi-layered semantic classification needs. For example, in the field of commodity information, a news article about "iron ore imports" may simultaneously involve multiple tag paths such as "commodity > ferrous metals > iron ore", "import and export > import", and "price > market price". In the field of book classification, a book of "Harry Potter" may be classified under "Fiction > Fantasy > Epic Fantasy" and "Children's Books > Step Into Reading". The tag system is represented by one or more hierarchical trees, and each path can be subdivided into several fine-grained levels. The same text can be assigned to multiple paths at the same time, constituting the Hierarchical Multi-label Text Classification (HMTC) task. These application areas have very different business content, but only the corresponding hierarchical tag trees need to be provided to reuse the same classification framework.

[0003] Existing HMTC methods have the following limitations:

[0004] The first category is structured supervised learning methods, represented by graph neural networks and tree-based perceptual models. These methods rely on large-scale manually labeled corpora and fixed label tree structures for training, performing well in scenarios with sufficient labeled data and stable label systems. However, in specialized fields, label distribution generally exhibits long-tail characteristics, with a large number of fine-grained leaf nodes (especially for deep or emerging concepts) having extremely scarce or even zero labeled samples, leading to a severe cold-start problem for the model. Furthermore, static label trees struggle to dynamically adapt to the continuous emergence of new concepts and categories; once the label system changes, the model often needs retraining or significant adjustments, resulting in significant accuracy degradation and high maintenance costs.

[0005] The second category is generative methods based on pure Large Language Models (LLM). These methods leverage the powerful general semantic understanding capabilities of LLM to directly generate classification results from the input text, allowing for rapid deployment without the need for large-scale labeled data. However, LLM exhibits inherent limitations in specialized domain applications: First, the lack of hierarchical consistency constraints can lead to logical errors, such as predicting child labels without confirming the parent label. Second, it often produces semantic illusions with specialized terms and domain-specific concepts like "plastics" (commodities) and "Dewey Decimal Classification" (book classification), resulting in outputting non-existent labels or incorrect paths. Third, the classification process lacks a traceable reasoning chain, making it difficult to meet interpretability and auditability requirements in highly sensitive business scenarios (such as compliance audits and forensic identification).

[0006] The third category is Retrieval Enhancement Generation (RAG) methods. These methods retrieve external knowledge bases using vector similarity, injecting domain knowledge into the LLM to alleviate knowledge blind spots. However, existing RAG schemes typically rely only on text fragment-level similarity matching, failing to effectively model hierarchical constraints between tags; their retrieval granularity is coarse, lacking the ability to differentiate knowledge of different natures (such as concept definitions, historical precedents, and structured facts); furthermore, their multimodal information fusion capabilities are insufficient, making it difficult to fully utilize structured knowledge resources beyond text, such as encyclopedic graphs and industry databases, resulting in limited support for classification decisions from the retrieval results. Summary of the Invention

[0007] To address the challenges of uniformly processing differentiated classification needs for entity-type and pre-abstracted labels without relying on large-scale labeled data, mitigating the terminological blind spots and semantic illusions inherent in large language models, and ensuring that classification results meet path consistency constraints and have traceable reasoning basis, this paper proposes a hierarchical multi-label text classification method and system based on explicit and implicit hybrid reasoning using large language models. The method includes:

[0008] S1. The original hierarchical tag tree is automatically split into an explicit tag library and an implicit tag library according to the semantic attributes of the tags. Explicit tags are entity tags that can be directly identified from the text, while implicit tags correspond to abstract tags that need to be judged through semantic reasoning.

[0009] S2. For the text to be classified, perform entity extraction and matching based on the explicit tag library to generate the corresponding explicit tag path;

[0010] S3. Starting from the root node of the implicit tag library, semantic relevance is scored using a top-down, recursive scoring method, and implicit tag paths are generated after filtering.

[0011] S4. Identify the corresponding node in the implicit tag library of the end node of the explicit tag path. If the node contains sub-tags, start implicit recursive reasoning with the explicit tag path as the prefix starting point to generate a hybrid tag path.

[0012] S5. Merge and deduplicate the explicit label paths, implicit label paths, and hybrid label paths to output a set of multi-label paths that satisfy the hierarchical consistency constraint.

[0013] Furthermore, the process of automatically splitting the original hierarchical label tree includes:

[0014] S101. Output explicit and implicit scores for each label path and perform initial classification according to a preset classification threshold; at the same time, introduce a prefix propagation mechanism to scan the label tree in descending order of path length. When a deep path is determined to be explicit, all its prefix paths are automatically marked as explicit.

[0015] S102. For the label path in the boundary state, use the historical annotation corpus to perform entity verification, calculate the classification hit rate when only the explicit path is extracted, and complete the upgrade or downgrade of the label state based on the comparison result of the hit rate and the preset accuracy threshold.

[0016] S103. Generate a classification report for the tag paths whose status has changed, for the labelers to review and confirm, and finally output the explicit tag library, the implicit tag library and the path metadata file.

[0017] Furthermore, the entity extraction and matching process based on the explicit tag library described in S2 specifically includes:

[0018] The large language model is used to output multi-dimensional relevance scores for each main category of the explicit tag library. The scores are then fused into a comprehensive score using weight vectors, and the main categories with a comprehensive score greater than 0 are retained.

[0019] For the main category to be retained, the corresponding entity name is extracted from the text to be classified. All tag nodes under the corresponding main category are recursively traversed. The composite fuzzy matching score consisting of partial matching, word order matching and word set matching is calculated. The highest global score is taken as the candidate path. At the same time, an abbreviation overwrite mechanism is configured to check the character overlap of Chinese tags and recognize the first letter abbreviation of English tags.

[0020] Verification is performed based on composite fuzzy matching scores. Scores higher than the first preset verification threshold are directly adopted, scores lower than the second preset verification threshold are directly rejected, and scores between the two are subject to semantic equivalence verification. If the verification passes, the candidate is adopted. When multiple candidate tags pass the verification, they are sorted from highest to lowest matching scores, and the first tag path that passes the verification is selected as the final explicit tag path result.

[0021] Furthermore, the implicit label path in S3 adopts a top-down, layer-by-layer recursive scoring method, specifically including:

[0022] Combine the current tag path with a structured list of candidate sub-tags for the next level to form contextual information; assemble the hierarchical context with the text to be classified into inference prompts, and output a relevance score between 0 and 1 for each candidate sub-tag;

[0023] Perform heuristic truncation filtering: remove candidates whose relevance scores are lower than the minimum confidence threshold, sort the remaining candidates in descending order of scores, compare the score difference of adjacent candidates one by one, retain the candidate if the score difference does not exceed the preset truncation threshold, and discard all subsequent candidates with lower scores if the score difference exceeds the threshold; for sub-labels that pass the truncation filter, enter their subtree and repeat the above steps until a leaf node is reached or no candidate passes the filter.

[0024] Furthermore, the large language model is configured with three independent and pluggable knowledge enhancement mechanisms: a terminology definition knowledge base provides standardized semantic definitions of tags to determine the semantic boundaries of classification decisions; a feature sample database provides similar labeled sample references to constrain the decision paradigm of classification output; and a multimodal knowledge graph provides structured domain factual information to supplement knowledge blind spots in the professional field. The three knowledge enhancement mechanisms are controlled by independent switches and can be used in combination or turned off as needed.

[0025] Furthermore, the terminology knowledge base adopts a top-down, depth-first incremental construction method, generating classification task-oriented definition text for each implicit label node, and introducing a depth threshold parameter to control the contextual granularity of definition generation. Shallow labels are accompanied by their sub-label structure information, while deep labels only convey path context. Before scoring at each level of implicit recursive reasoning, the standardized definition of the corresponding candidate label is retrieved and injected into the reasoning prompt.

[0026] Furthermore, the feature sample database supports two offline construction methods: clustering mode and label mode. In clustering mode, representative samples are selected through semantic dimensionality reduction and density clustering, while in label mode, typical samples are selected by stratified sampling based on labels. During online retrieval, a three-level fallback is set up, namely feature sample database retrieval, default example mapping, and general example. The sample label information of the retrieved and matched samples is used as a constraint reference to inject prompt words.

[0027] Furthermore, the multimodal knowledge graph includes a tag encyclopedia graph and an external knowledge graph. The tag encyclopedia graph is constructed by extracting data from encyclopedia-type data sources with a tag library as its skeleton, while the external knowledge graph is constructed by extracting data from industry documents.

[0028] A hierarchical multi-label text classification method based on explicit and implicit hybrid reasoning using a large language model also performs cross-domain adaptive prompt processing before the classification task begins.

[0029] Extract core concepts from business scenario descriptions to generate scenario tags. Based on a preset set of replacement rules, replace general prompt word templates with domain-specific expressions. Select hierarchical tags from the current tag tree as example anchors to generate reference examples that fit the target tag system. Cross-domain migration can be achieved without modifying the code.

[0030] A hierarchical multi-label text classification device based on explicit and implicit hybrid reasoning using a large language model is disclosed. The device includes a processor and a memory. The memory stores at least one instruction, which is loaded and executed by the processor to implement the hierarchical multi-label text classification method based on explicit and implicit hybrid reasoning using a large language model as described in any one of claims 1 to 9.

[0031] The beneficial effects of this invention are:

[0032] 1. The original hierarchical tag tree is automatically split into an explicit tag library and an implicit tag library based on semantic attributes. For entity tags, a zero-shot alignment method based on string composite fuzzy matching and entity extraction is adopted, which can be directly identified without labeled samples. For abstract tags, a zero-shot inference method with top-down layer-by-layer semantic scoring using a large language model is adopted. The two work together through a unified fusion and deduplication framework, which not only avoids the dependence on large-scale manually labeled corpora, but also accurately adapts to the fundamental differences between the two types of tags, fundamentally solving the long-tail distribution and cold start dilemma in professional domains.

[0033] 2. This invention employs three independent and pluggable "three-in-one" knowledge enhancement mechanisms (a terminology definition knowledge base, a feature sample database, and a multimodal knowledge graph), injecting precise prior knowledge into the prompts of the large language model from three dimensions: concept definition boundaries, historical annotation precedents, and structured domain facts. Before scoring at each level of reasoning, standardized definitions are forcibly injected to anchor semantic boundaries, supplemented by similar sample constraints and structured fact support. This ensures that the model makes decisions strictly based on the precise semantics of the established classification system, rather than relying on generalized reasoning based on common sense, thereby effectively curbing errors in the identification of specialized terms and the generation of illusionary paths.

[0034] 3. This invention employs a top-down, layer-by-layer recursive scoring forced decoding strategy. The prediction of each sub-label is strictly initiated only after the parent label has been confirmed, eliminating logical errors such as sub-labels appearing across layers or lacking a parent label. This ensures that all output paths meet strict hierarchical consistency constraints (a complete path from the root node to the leaf node). Simultaneously, explicit paths rely on entity matching records, while implicit paths retain the relevance scores, truncation and filtering records, and scoring criteria for each candidate label. The entire decision-making chain is completely transparent and auditable, making the classification results not only accurate but also possessing the traceability and auditability necessary for highly sensitive business scenarios. Attached Figure Description

[0035] Figure 1 This is a diagram of the overall system architecture of the present invention. Detailed Implementation

[0036] This invention proposes a hierarchical multi-label text classification method and system based on explicit and implicit hybrid reasoning using a large language model.

[0037] 1. The original hierarchical tag tree is automatically divided into an explicit tag library (entity type, suitable for alignment through entity extraction and fuzzy matching) and an implicit tag library (abstract type, suitable for reasoning through top-down recursive semantic scoring) based on the semantic attributes of the tags.

[0038] 2. For any text to be classified, classify it independently along the explicit label path and the implicit label path respectively, and perform hybrid reasoning on nodes that can be extended across libraries. Finally, merge the results of the two paths to remove duplicates and output a complete set of label paths that meet the hierarchical consistency constraints.

[0039] 3. Furthermore, domain-specific prior knowledge is injected into the prompts of the large language model through a knowledge base of terminology definitions, a feature sample database, and a multimodal knowledge graph. These three elements alleviate the conceptual blind spots and semantic illusions of the large model in the professional domain from three dimensions: concept definition, historical precedents, and structured facts, respectively.

[0040] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0041] (a) Automatic binary search processing of hierarchical labeling system:

[0042] The original hierarchical tag tree is stored in JSON format, with leaf nodes identified by empty objects. Taking the commodities sector as an example, the tag tree contains four root nodes: variety, macroeconomics, region, and enterprise. Each root node is further subdivided into leaf tags of corresponding granularity. The hierarchical tag tree organizes tags using a tree-like hierarchical structure, with each tag corresponding to a node in the tree. Child tags are the next-level subordinate tag nodes extending downwards from the current tag node, corresponding to the subdivided category items within the semantic scope of the parent tag. Nodes without subordinate tags are leaf nodes.

[0043] The original hierarchical tag tree is automatically divided into an explicit tag library and an implicit tag library based on the semantic attributes of the tags. The explicit tag library stores entity-type tags, which can be directly identified in the text through string features; the implicit tag library stores abstract tags, which require semantic reasoning for determination. The splitting of the explicit and implicit tag libraries is accomplished through a three-step pipeline:

[0044] (1) Traverse all the tag paths of the original tag tree. The system calls the large language model to output the explicit score and implicit score in the range of 0 to 1 for each tag path from the two dimensions of "direct text recognizability" and "necessity of semantic reasoning". The path is initially divided into four categories according to the preset threshold: explicit, implicit, both, and neither.

[0045] To improve consistency and reduce the number of calls, a prefix propagation mechanism is introduced: the tag tree is scanned in descending order of path length. When a deep path is determined to be explicit, all its parent prefix paths are automatically marked as explicit. In simplified mode, main category prediction and batch inference optimizations are introduced: for main categories determined to be highly likely to contain explicit tags, several sub-paths are randomly selected for batch scoring and verification. If all pass the threshold, all sub-paths under that main category are marked as explicit at once.

[0046] (2) For label paths in the boundary state, retrieve historical annotation corpora for empirical verification: retrieve annotated samples containing the label path, enable only the explicit extraction logic for reclassification and calculate the hit accuracy. If the accuracy is higher than the preset precision threshold, upgrade the label path to explicit; otherwise, downgrade it to implicit.

[0047] (3) Generate a classification report for the label paths whose status has changed, including the explicit and implicit scores output by the system calling the large language model for each label path, the status before and after the change, and the basis for the change, for the labelers to make final confirmation. The system synchronously records the source, status, and confidence metadata of each label.

[0048] After the three-step pipeline is completed, the system will solidify the final tag attributes and output an explicit tag library file, an implicit tag library file, and a path metadata file containing the source, status, and confidence level of each tag.

[0049] (ii) Display tag path extraction:

[0050] Explicit tag path extraction targets entity tags and proceeds through three stages: weighted identification of the main category, entity extraction and global recursive fuzzy matching, and three levels of semantic verification.

[0051] (1) Weighted identification of main categories: Read the text to be classified and all main categories in the explicit tag library, and output a multi-dimensional relevance score for each main category through a large language model. A three-dimensional score is adopted, including text topic relevance, domain term density, and classification certainty. The comprehensive score of each main category is obtained by fusing through a preset weight vector, and the weighted average is calculated multiple times to reduce randomness. Main categories with a comprehensive score greater than 0 are retained.

[0052] (2) Entity extraction and global recursive fuzzy matching: For each retained main category, entity names of the corresponding domain are extracted from the text to be classified using a large language model, and fuzzy matching is performed after deduplication. The matching adopts a global recursive search strategy: each tag node under the main category in the explicit tag library is recursively traversed, and the composite fuzzy matching score between the entity and the node tag is calculated. The composite fuzzy matching score is obtained by taking the arithmetic mean of three types of string similarity: partial matching ratio: the edit distance similarity of the best substring alignment is calculated; word order matching ratio: after the extracted entity and tag text are segmented and sorted by character, the sequence overlap is calculated to obtain the similarity score; word set matching ratio: the similarity is calculated based on the overlap of the word set.

[0053] After traversing all tag nodes under the main category, the tag with the highest global score is taken as the candidate path. The process does not terminate at the first match exceeding the threshold, thus avoiding missing the correct match due to local high scores.

[0054] To accommodate abbreviation and shorthand scenarios in business operations, an abbreviation overriding mechanism is configured in this phase. For Chinese tags, the extracted words and candidate tags are decomposed into character sets, and after filtering out disabled characters, the character overlap rate is calculated. If the character overlap rate exceeds a preset threshold, the matching score of the candidate tag is forcibly increased to above the lower limit of the boundary area. For English tags, the matching form of initial letter abbreviations is additionally detected.

[0055] (3) Three-level semantic verification: Set two threshold levels, high and low, and process according to the composite fuzzy matching score:

[0056] When a candidate tag's matching score is higher than the high threshold, the candidate tag path is directly adopted; when the score is lower than the low threshold, the candidate is directly rejected; when the score is between the two thresholds, a semantic equivalence check is performed using a large language model to determine whether the extracted word and the candidate tag point to the same conceptual entity. The check rules include whether the candidate tag is the official standard full name of the extracted word, whether the extracted word is a qualifying modifier of the candidate tag, whether there is a recognized abbreviation correspondence between the two, and whether the two are different commonly used names of the same entity. If any rule is met, the check passes and the candidate tag is adopted; otherwise, it is rejected. When multiple candidate tags pass the check, they are sorted by matching score from high to low, and the first tag path that passes the check is selected as the final explicit tag path result.

[0057] (III) Implicitly Labeled Path Recursive Reasoning:

[0058] Implicit tag path reasoning targets abstract and conceptual tags, employing a top-down, recursive scoring approach. The initial reasoning starting point is either the root node of the implicit tag library or an expandable node at the end of the explicit tag path. For each current reasoning node, the following process is iteratively executed until a leaf node is reached or no valid candidates remain:

[0059] A hierarchical context is constructed by combining the currently determined label path with a structured list of candidate sub-labels for the next level. This hierarchical context is then assembled with the text content to be classified into prompt words. A large language model is then invoked to output a relevance score for each candidate sub-label, with the score ranging from 0 to 1. To improve scoring stability, multiple independent calls can be set, adjustable according to accuracy requirements. The arithmetic mean of all results from multiple calls is used as the final score, resulting in a smooth linear scoring system.

[0060] After scoring is completed, heuristic truncation filtering is performed: After obtaining the scores of all candidates, candidates with relevance scores lower than the minimum confidence threshold are first removed; the remaining candidates are sorted in descending order of scores, and the candidate with the highest score is retained; the score difference between adjacent candidates is compared one by one to make a truncation judgment. If the score difference between adjacent candidates exceeds the preset truncation threshold, all subsequent candidates with lower scores are truncated and discarded; if the score difference between adjacent candidates does not exceed the preset truncation threshold, the candidate is retained.

[0061] For each sub-tag that passes the truncation filter, add it to the current full path, enter its child node tree, and repeat the above steps of building context, scoring, and truncation filtering until a leaf node is reached or no candidate passes the filter in the next level, at which point the recursion of that branch is terminated.

[0062] (iv) Hybrid path expansion and result fusion:

[0063] When the terminal node of an explicit tag path has a corresponding node in the implicit tag library, and that node contains sub-tags, the system automatically uses that explicit tag path as the prefix starting point to initiate implicit recursive reasoning and complete the determination of the next level of sub-tags. If it does not contain sub-tags, then hybrid expansion is not initiated, and the explicit path is directly retained as a pure explicit path. For example, in the commodity field, the explicit tag path is extracted as "Macro > Policy". This node has richer sub-tags in the implicit tag library, so the system starts implicit reasoning from this terminal node to determine the sub-path.

[0064] Through the above process, the system ultimately generates three types of path formats: purely explicit label paths, purely implicit label paths, and hybrid label paths. All paths satisfy the hierarchical consistency constraint from the root node to the leaf node, and there are no cases where a child label has no corresponding parent label. The three types of path results are merged and deduplicated. After removing duplicate label paths, a complete set of multi-label paths is output.

[0065] (V) A three-in-one knowledge enhancement mechanism:

[0066] To alleviate the conceptual blind spots and semantic illusions inherent in large language models within specialized domains, this invention configures three independent and pluggable knowledge enhancement mechanisms, injecting domain-specific prior knowledge into prompt words from three dimensions: concept definition, historical precedents, and structured facts.

[0067] (1) Terminology Knowledge Base (LDKB):

[0068] LDKB constructs a standardized definition for each implicit label node, which is oriented towards classification tasks, enabling large language models to score based on precise semantic boundaries rather than general common sense.

[0069] LDKB employs offline incremental construction, using a top-down depth-first traversal order to ensure that parent node definitions are generated before child node definitions. For each tag node, a large language model is invoked to generate the corresponding definition text. During generation, the context granularity is controlled according to the node depth: for shallow tags with a depth less than or equal to a depth threshold, the structural information of all its child tags is provided synchronously during definition generation, so that the definition can reflect the semantic scope jointly constituted by the child tags; for deep tags with a depth greater than the depth threshold, only the context information of its parent path is passed to avoid definition redundancy.

[0070] The build process is incremental, automatically skipping already defined nodes and only processing paths with missing definitions; after each node is processed, the definition is immediately persisted to disk, and the build can be resumed from the breakpoint after an interruption.

[0071] During online inference, before scoring at each level of implicit recursive inference, the system searches for the definition of the corresponding candidate label in LDKB, inserts the definition text into the corresponding position of the prompt word, and enables the model to make decisions based on the precise semantic boundaries under the classification system.

[0072] (2) Feature Sample Database (FSD):

[0073] FSD is a library of few-shot samples built offline and retrieved online, providing constraints for classification through similar labeled samples. FSD supports two offline build modes:

[0074] Clustering mode: Historical labeled text is converted into vector representation through a semantic vector model. After dimensionality reduction by UMAP, density clustering is performed using HDBSCAN. Representative samples with the highest degree of belonging are selected from each cluster to ensure uniform coverage of samples in the semantic space. Label mode: Stratified sampling is performed according to the label path. The semantic vector centroid of all samples of each label is calculated. Typical samples closest to the centroid are selected to ensure that long-tail labels also have corresponding representative samples.

[0075] During online retrieval, the text to be classified is converted into a semantic vector, and the nearest neighbor sample is retrieved from the FSD sample vector library using cosine similarity. When the highest similarity exceeds a preset threshold, the text and corresponding label information of similar samples are used as reference examples and injected into the prompt words. If no sample matching the threshold is found, the system executes a three-level fallback strategy: sequentially trying FSD retrieval, default example mapping, and general examples to ensure the integrity of the prompt word structure.

[0076] (3) Multimodal Knowledge Graph (MMKG):

[0077] MMKG injects structured, cross-corpus, and cross-modal domain factual knowledge into large language models, including the construction of two types of graphs:

[0078] Tag-based encyclopedia graph: Using a tag library as its framework, it obtains corresponding tag encyclopedia pages from publicly available encyclopedia data sources. After layout parsing, entity recognition, and relationship extraction, it is organized into a graph structure. Each node stores the tag's definition, attributes, and relationships. External knowledge graph: Sourced from industry research reports, policy documents, and professional materials, it is constructed through document parsing, entity recognition, and relationship extraction, supplementing the tag library with domain entities and relationships from outside the tag library. After both types of graphs are built, a corresponding semantic vector is generated for each node and cached to improve retrieval efficiency.

[0079] Online retrieval supports three modes: external retrieval queries only the external knowledge graph, tag retrieval queries only the tag encyclopedia graph, and hybrid retrieval merges the results from both, sorts them by similarity, and then truncates the Top-K results. The descriptive text and relational text of the retrieved entity nodes and their one-hop neighbors are serialized and then infused with prompt words to provide structured factual support for the model.

[0080] The three knowledge enhancement modules complement each other: the terminology knowledge base provides task-oriented concept definition boundaries, the feature sample database provides annotation and judgment references for similar texts, and the multimodal knowledge graph provides structured domain fact support. The three are controlled by independent switches and can be used in any combination. When all are turned off, the system can still operate normally based on the core hybrid classification process without affecting the basic classification function.

[0081] (vi) Prompt cross-domain adaptive mechanism:

[0082] This mechanism enables code-free migration of the system across different business domains, allowing for domain adaptation solely through configuration. The system configuration file provides a descriptive text of the business scenario. The system then uses a large language model to extract core conceptual terms from the text and compress them into concise scenario tag strings. For example, inputting "bulk commodity information text classification" will result in the scenario tag "bulk commodities" after normalization; inputting "children's book classification" will result in the scenario tag "children's books".

[0083] The system pre-configures a set of replacement rules, covering all key Prompt nodes such as tag system construction, terminology generation, and classification scoring. Each rule defines a mapping relationship of "general expression → domain-specific expression," where the domain-specific expression includes scene tag placeholder variables. For example, the general expression "professional classification system expert" is replaced with "{scene tag} domain professional classification system expert," and is automatically replaced with the current scene tag during actual invocation. The replacement rule set is maintained in both Chinese and English versions. The system automatically selects the corresponding language rule set to perform the replacement based on the prompt word language parameter in the configuration file.

[0084] The adaptive module selects tags with sub-tag structures from the user-submitted tag tree as example anchors. Based on the actual sub-tag list, it generates reference examples that conform to the characteristics of the domain and inserts them into the corresponding prompts. For example, in the terminology definition generation stage, example definitions are generated based on anchor tags, enabling the large language model to generate content with semantic granularity that matches the actual tag system, thus improving domain adaptability.

[0085] Example:

[0086] This system is developed using Python and is recommended to be deployed and run in a Conda environment with Python 3.10 or later. Basic dependencies include libraries for text processing, vector computation, and large model API calls. To enable the multimodal knowledge graph module, additional dependencies for web page parsing and document processing must be installed.

[0087] System parameters are configured in two layers: business level and system level. Business level configuration is stored in the settings.py file, which includes scene description, prompt language, input and output paths, model interface configuration, and switches for each module. System level configuration is stored in the src / settings_sys.py file, which includes core parameters such as thresholds, number of calls, and weights for each stage.

[0088] In actual operation, the user prepares the CSV file to be classified, and after running the main program, the system automatically executes the following process:

[0089] 1. Load configuration parameters, execute Prompt adaptive replacement, and generate all prompt word templates for the current domain;

[0090] 2. Load the tag library. If a missing tag library file is detected, the tag binary search process will be automatically triggered to generate explicit and implicit tag libraries.

[0091] 3. Read the text to be classified line by line and execute the classification loop: first extract the explicit label path, and then start implicit recursive reasoning and hybrid expansion based on the explicit results;

[0092] 4. Merge and deduplicate all generated label paths, sort them by confidence level, and output the final result;

[0093] 5. The results are written to the output CSV file in append mode, and processed rows are automatically skipped. Resuming from breakpoints is supported.

[0094] The output includes fields such as line number, predicted tag path set, and original text. The tag path is represented by the ">" symbol to indicate the hierarchical relationship, and multiple paths are separated by commas to meet the calling requirements of subsequent business processes.

Claims

1. A hierarchical multi-label text classification method based on explicit-implicit hybrid reasoning using a large language model, characterized in that, include: S1. The original hierarchical tag tree is automatically split into an explicit tag library and an implicit tag library according to the semantic attributes of the tags. Explicit tags are entity tags that can be directly identified from the text, while implicit tags correspond to abstract tags that need to be judged through semantic reasoning. S2. For the text to be classified, perform entity extraction and matching based on the explicit tag library to generate the corresponding explicit tag path; S3. Starting from the root node of the implicit tag library, semantic relevance is scored by recursively scoring from top to bottom, and implicit tag paths are generated after filtering. S4. Identify the corresponding node in the implicit tag library of the end node of the explicit tag path. If the node contains sub-tags, start implicit recursive reasoning with the explicit tag path as the prefix starting point to generate a hybrid tag path. S5. Merge and deduplicate the explicit label paths, implicit label paths, and hybrid label paths to output a set of multi-label paths that satisfy the hierarchical consistency constraint.

2. The hierarchical multi-label text classification method based on explicit and implicit hybrid reasoning according to claim 1, characterized in that, The automatic splitting process of the original hierarchical label tree includes: S101. Output explicit and implicit scores for each label path and perform initial classification according to a preset classification threshold; at the same time, introduce a prefix propagation mechanism to scan the label tree in descending order of path length. When a deep path is determined to be explicit, all its prefix paths are automatically marked as explicit. S102. For the label path in the boundary state, use the historical annotation corpus to perform entity verification, calculate the classification hit rate when only the explicit path is extracted, and complete the upgrade or downgrade of the label state based on the comparison result of the hit rate and the preset accuracy threshold. S103. Generate a classification report for the tag paths whose status has changed, for the labelers to review and confirm, and finally output the explicit tag library, the implicit tag library and the path metadata file.

3. The hierarchical multi-label text classification method based on explicit and implicit hybrid reasoning according to claim 1, characterized in that, The entity extraction and matching process based on the explicit tag library described in S2 specifically includes: The large language model is used to output multi-dimensional relevance scores for each main category of the explicit tag library. The scores are then fused into a comprehensive score using weight vectors, and the main categories with a comprehensive score greater than 0 are retained. For the main category to be retained, the corresponding entity name is extracted from the text to be classified. All tag nodes under the corresponding main category are recursively traversed. The composite fuzzy matching score consisting of partial matching, word order matching and word set matching is calculated. The highest global score is taken as the candidate path. At the same time, an abbreviation overwrite mechanism is configured to check the character overlap of Chinese tags and recognize the first letter abbreviation of English tags. Verification is performed based on composite fuzzy matching scores. Scores higher than the first preset verification threshold are directly adopted, scores lower than the second preset verification threshold are directly rejected, and scores between the two are subject to semantic equivalence verification. If the verification passes, the candidate is adopted. When multiple candidate tags pass the verification, they are sorted from highest to lowest matching scores, and the first tag path that passes the verification is selected as the final explicit tag path result.

4. The hierarchical multi-label text classification method based on explicit and implicit hybrid reasoning according to claim 1, characterized in that, The implicitly labeled path in S3 uses a top-down, recursive scoring method, specifically including: Combine the current tag path with a structured list of candidate sub-tags for the next level to form contextual information; assemble the hierarchical context with the text to be classified into inference prompts, and output a relevance score between 0 and 1 for each candidate sub-tag; Perform heuristic truncation filtering: remove candidates whose relevance scores are lower than the minimum confidence threshold, sort the remaining candidates in descending order of scores, compare the score difference of adjacent candidates one by one, retain the candidate if the score difference does not exceed the preset truncation threshold, and discard all subsequent candidates with lower scores if the score difference exceeds the threshold; for sub-labels that pass the truncation filter, enter their subtree and repeat the above steps until a leaf node is reached or no candidate passes the filter.

5. The hierarchical multi-label text classification method based on explicit and implicit hybrid reasoning according to claim 1, characterized in that, The large language model is configured with three independent and pluggable knowledge enhancement mechanisms: providing standardized semantic definitions of tags through a noun definition knowledge base to determine the semantic boundaries of classification decisions; The feature sample database provides similar labeled sample references to constrain the judgment paradigm of classification output; the multimodal knowledge graph provides structured domain factual information to supplement the knowledge blind spots in the professional field; the three types of knowledge enhancement mechanisms are controlled by independent switches and can be used in combination or turned off as needed.

6. The hierarchical multi-label text classification method based on explicit and implicit hybrid reasoning according to claim 5, characterized in that, The terminology knowledge base is constructed using a top-down, depth-first incremental approach. It generates classification task-oriented definition text for each implicit label node and introduces a depth threshold parameter to control the contextual granularity of definition generation. Shallow labels include their sub-label structure information, while deep labels only convey path context. Before scoring at each level of implicit recursive reasoning, the standardized definition of the corresponding candidate label is retrieved and injected into the reasoning hints.

7. The hierarchical multi-label text classification method based on explicit-implicit hybrid reasoning according to claim 5, characterized in that, The feature sample database supports two offline construction methods: clustering mode and label mode. In clustering mode, representative samples are selected through semantic dimensionality reduction and density clustering, while in label mode, typical samples are selected by stratified sampling based on labels. During online retrieval, a three-level fallback is set up, which is: feature sample database retrieval, default example mapping, and general example. The sample label information of the retrieved and matched samples is used as a constraint reference to inject prompt words.

8. The hierarchical multi-label text classification method based on explicit and implicit hybrid reasoning according to claim 5, characterized in that, The multimodal knowledge graph includes a tag encyclopedia graph and an external knowledge graph. The tag encyclopedia graph is constructed by extracting data from encyclopedia-type data sources with a tag library as its skeleton, while the external knowledge graph is constructed by extracting data from industry documents.

9. A hierarchical multi-label text classification method based on explicit-implicit hybrid reasoning using a large language model, characterized in that... Before the classification task starts, a Prompt cross-domain adaptive processing is also performed: Extract core concepts from business scenario descriptions to generate scenario tags. Based on a preset set of replacement rules, replace general prompt word templates with domain-specific expressions. Select hierarchical tags from the current tag tree as example anchors to generate reference examples that fit the target tag system. Cross-domain migration can be achieved without modifying the code.

10. A hierarchical multi-label text classification device based on a large language model with explicit and implicit hybrid reasoning, characterized in that, The device includes a processor and a memory, the memory storing at least one instruction, which is loaded and executed by the processor to implement the hierarchical multi-label text classification method based on explicit and implicit hybrid reasoning according to any one of claims 1 to 9.