Multi-agent collaborative and structured output-based large model medical consultation decision method

CN123017442APending Publication Date: 2026-10-30ZHONGBAO HEALTH TECH SERVICE (JINAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611202257.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-10
Publication Date
2026-10-30

AI Technical Summary

Benefits of technology

该基于多智能体协同与结构化输出的大模型医疗问诊决策方法中,步骤S1通过训练共享编码模型,将模糊的自由主诉文本编码为统一的语义嵌入向量,使后续所有智能体在同一语义基础上进行解析,避免多个独立编码器之间因编码不一致产生的信息偏差,同时共享编码机制使各智能体无需各自训练独立的编码器,降低整体计算资源的开销;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123017442A_ABST
    Figure CN123017442A_ABST
Patent Text Reader

Abstract

The present application relates to the field of intelligent medical treatment and artificial intelligence technology, and more particularly to a large model medical inquiry decision method based on multi-agent cooperation and structured output. It includes the following steps: step S1 trains a shared encoding model to encode free chief complaint text into semantic embedding vectors; step S2 constructs a chief complaint semantic analysis body, a high-risk factor mining body and an atypical symptom detection body, all of which share the encoding model, and converts the semantic embedding vectors into feature vectors through a structured prompt template and assigns a confidence score; step S3 uses low-confidence high-risk clues to generate a risk enhancement vector to inject into the attention mechanism of the atypical symptom detection body, and feeds back the detection results to adjust the high-risk preliminary evaluation value, and gathers the structured features and uncertainty annotations of the three agents to construct a global uncertainty graph; and step S4 generates natural language text that can be asked to the patient based on the graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of smart healthcare and artificial intelligence technology, specifically to a large-scale medical consultation and decision-making method based on multi-agent collaboration and structured output. Background Technology

[0002] In internet hospitals and pre-hospital emergency care scenarios, rapid triage and accurate consultation for patients with acute chest pain are crucial aspects of clinical emergency care. Acute chest pain may indicate fatal conditions such as acute myocardial infarction, aortic dissection, and pulmonary embolism; the accuracy and timeliness of triage directly impact patient survival. In this scenario, the medical consultation decision-making system plays a vital role in extracting key clinical information from the patient's chief complaint, identifying high-risk clues, and assisting in triage decisions.

[0003] Currently, the mainstream methods for implementing medical consultation and decision-making mainly include three categories, among which: The first type is the pre-diagnosis and triage system based on structured questionnaires. These systems guide patients through pre-set standardized questionnaires, asking them to answer questions about pain location, nature, duration, and accompanying symptoms. The system then generates a structured medical record by filling in the patient's answers into fixed fields. For example, the AI ​​pre-diagnosis function launched by West China Hospital asks questions to patients through a dialogue interface, collects symptom information, and automatically generates a structured medical record. However, patients with acute chest pain are often in a state of pain or anxiety, making it difficult for them to complete structured questionnaires item by item. They tend to use everyday language such as "chest discomfort," "a feeling of tightness in the chest," and "difficulty breathing" to describe their symptoms. Such systems struggle to effectively handle these unstructured, free-flowing expressions.

[0004] The second type is rule-based expert decision-making systems. These systems encode triage rules from clinical guidelines into a large number of if-then rules, and output triage suggestions by matching the patient's input symptom information with conditions in the rule base. For example, the TeleMedQuick system integrates more than 70,000 clinical rules for emergency triage based on vital signs, symptoms, demographic information, and medical history. The limitations of this type of system are that the coverage of the rule base is limited by the completeness of manual coding, it lacks the ability to handle symptom combinations or atypical presentations not explicitly covered by clinical guidelines, and it cannot autonomously extract structured information from free text.

[0005] The third category is intelligent triage systems based on a single large-scale model: With the development of large language model technology, some solutions attempt to use a single large-scale model for end-to-end semantic understanding and triage decisions based on the patient's natural language description. For example, the TriageMaster-70B model uses only patient narratives and vital signs for triage of acute coronary syndrome; the large-scale model for acute chest pain released by Qilu Hospital integrates natural language processing and multimodal data fusion technology to achieve parsing of chest pain patients' medical records and imaging data. However, single-model parsing has inherent defects: different categories of clinical information, such as pain location, pain nature, high-risk disease clues, and atypical manifestations, involved in the free subjective complaint text are mixed and encoded in the same semantic representation, and the model is not explicitly required to decouple and separately label information of different dimensions; a single model cannot quantify the credibility of the parsing results of each dimension, and downstream modules have no way of knowing whether the model has a high or low grasp of a certain parsing result; in addition, a single model lacks a multi-perspective cross-validation mechanism, which is prone to missing or misjudging key symptoms in the initial stage.

[0006] In recent years, multi-agent systems have begun to attract attention in the medical field. Some solutions simulate the collaborative process of a multidisciplinary clinical team by constructing a diagnostic network in which multiple professional agents collaborate. For example, some studies have built a dialogue framework involving multiple physician agents to improve diagnostic accuracy through interactive discussions between agents. However, existing medical multi-agent solutions mostly focus on collaborative reasoning in the diagnostic process and have not yet solved the problem of reliable conversion from unstructured free-form patient complaints to structured clinical features. They also lack explicit quantification of the uncertainty of the analysis results and cross-agent information sharing mechanisms.

[0007] In summary, existing medical consultation decision-making systems face significant challenges when processing unstructured natural language complaints, including incomplete information extraction, inability to decouple multi-dimensional clinical information, inability to quantify the reliability of parsing results, and a lack of effective collaboration among agents. Therefore, there is an urgent need for a medical consultation decision-making method capable of securely extracting multi-dimensional clinical features from uncertain, unstructured natural language and explicitly quantifying the uncertainty of the parsing results for each dimension, as well as verifying them through collaborative verification among agents.

[0008] In view of this, we propose a large-scale medical consultation decision-making method based on multi-agent collaboration and structured output. Summary of the Invention

[0009] The purpose of this invention is to solve the problems mentioned in the background art.

[0010] To achieve the above objectives, this invention provides a large-scale medical consultation decision-making method based on multi-agent collaboration and structured output, comprising: Step S1: Train a shared encoding model to encode the acquired free-narrative text into corresponding semantic embedding vectors; Step S2: Construct the chief complaint semantic parsing body, the high-risk factor mining body, and the atypical symptom detection body; Each agent shares an encoding model and uses its own pre-set structured prompt template to transform the semantic embedding vector corresponding to the same free claim text into feature vectors for cross-agent collaborative reasoning and risk quantification assessment. The feature vectors are then assigned corresponding confidence scores as uncertainty labels. Step S3: Use the low-confidence high-risk clues output by the high-risk factor mining body to generate a risk enhancement vector, and inject the risk enhancement vector into the attention mechanism of the atypical symptom detector to improve the detection sensitivity of associated atypical symptoms. The detection results of the atypical symptom detector are used as feedback correction signals to jointly adjust the preliminary high-risk assessment value of the high-risk factor mining body. After completing the bidirectional linkage correction, the structured features and uncertainty annotations of the chief complaint semantic parsing body, the high-risk factor mining body, and the atypical symptom detection body after cross-correction are aggregated to construct a global uncertainty map; Step S4: Based on the global uncertainty graph, generate natural language text that can be used to directly ask questions to patients.

[0011] Compared with the prior art, the beneficial effects of the present invention are as follows: In this large-scale medical consultation decision-making method based on multi-agent collaboration and structured output, step S1 encodes the ambiguous free complaint text into a unified semantic embedding vector by training a shared encoding model, so that all agents can parse it on the same semantic basis, avoiding information deviation caused by inconsistent encoding between multiple independent encoders. At the same time, the shared encoding mechanism eliminates the need for each agent to train an independent encoder, reducing the overall computational resource overhead. Based on step S1, step S2 constructs three specialized intelligent agents: a chief complaint semantic parsing agent, a high-risk factor mining agent, and an atypical symptom detection agent. Each agent shares the same semantic embedding vector and performs symptom attribute parsing, high-risk clue screening, and atypical symptom detection respectively through differentiated structured prompt templates. The chief complaint semantic parser extracts local semantic representations of each symptom attribute from the semantic embedding vector through a symptom query probe, anchoring vague colloquial expressions to standard clinical terminology. Simultaneously, it assigns symptom confidence to each parsing result by calculating the information concentration of the local semantic representation, enabling downstream processing to distinguish between high-confidence and low-confidence parsing results. Guided by the first feature vector output by the chief complaint semantic parser, the high-risk factor mining body integrates the parsed explicit symptom information and its confidence level into the risk clue matching process using conditional symptom vectors, avoiding computational waste and false alarms caused by broad-spectrum risk searches without guidance. The atypical symptom detector further receives the first feature vector from the chief complaint semantic parser and the preliminary high-risk assessment value from the high-risk factor mining body, constructing a joint conditional vector that integrates confirmed symptom information and high-risk hypotheses to be verified, precisely focusing limited attention resources on the hidden atypical symptom dimensions associated with the current high-risk hypothesis. Step S3 establishes a two-way closed-loop linkage between agents. On the one hand, the low-confidence high-risk clues output by the high-risk factor mining agent are transformed into risk enhancement vectors and injected into the attention mechanism of the atypical symptom detector, enabling the atypical symptom detector to improve its detection sensitivity of associated atypical symptoms under the guidance of the high-risk hypothesis. On the other hand, the detection results of the atypical symptom detector are used as feedback correction signals to be sent back to the high-risk factor mining agent to confirm and enhance or reduce the confidence of the initial high-risk assessment results. Thus, based on the structured symptom information output by the chief complaint semantic parser, the targeted exploration of hidden clues driven by the high-risk hypothesis and the verification and correction of the initial hypothesis by the exploration results are realized. Finally, step S4 is based on the global uncertainty constructed in step S3. The sex graph uses the confidence gap missing values ​​of each clinical semantic dimension explicitly labeled in the global uncertainty graph as the basis for prioritizing follow-up questions. It retrieves pre-set knowledge entries related to the target dimension from the corresponding domain knowledge graph as follow-up question material, fills the follow-up question material into a preset natural language question template, and generates natural language text that can be directly asked to the patient through a slot filling operation. This ensures that each round of follow-up questions targets the clinical semantic dimension with the largest current information gap and the highest contribution to reducing the patient's overall clinical risk. This avoids the low consultation efficiency caused by blind follow-up questions and can terminate the consultation in time when the marginal safety benefit of the information gap is insufficient to offset the cost of delay. Thus, it maximizes information gain and minimizes clinical risk within a limited number of consultation rounds.

[0012] In addition to the objectives, features, and advantages described above, the present invention has other objectives, features, and advantages. The invention will now be described in further detail with reference to the figures. Attached Figure Description

[0013] Figure 1 This is a schematic diagram of the workflow of the present invention. Detailed Implementation

[0014] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0015] In the acute chest pain triage scenario of internet hospitals or pre-hospital emergency care, patients with acute chest pain are often in a state of pain or anxiety, making it difficult for them to complete structured questionnaires item by item. Therefore, patients can actively describe their most prominent discomfort through natural language. The system collects the patient's natural language description based on speech recognition or text input interface and analyzes it to obtain the corresponding free subjective complaint text. Furthermore, since patients usually lack professional medical knowledge, they can only rely on personal feelings when describing chest pain symptoms, using everyday terms such as "chest discomfort," "a feeling of tightness in the chest," and "difficulty breathing," and cannot spontaneously establish a correspondence between subjective feelings and standard clinical terms such as "squeezing pain," "retrosternal squeezing sensation," and "radiating pain."

[0016] Based on the above reasons, refer to Figure 1 As shown, this embodiment proposes a large-scale medical consultation decision-making method based on multi-agent collaboration and structured output. This method addresses how to safely extract reliable features for multi-dimensional clinical reasoning from uncertain, unstructured natural language. If only a single model is used for analysis, key symptoms are easily missed or misjudged in the initial stage, and the reliability of the analysis results cannot be explicitly quantified.

[0017] In emergency chest pain triage scenarios, patients' chief complaints are highly uncertain and non-standardized. Patients often use everyday language such as "chest discomfort," "a feeling of tightness in the chest," and "difficulty breathing" to describe their feelings. There is a significant semantic gap between these everyday expressions and standard clinical terms such as "squeezing pain behind the sternum" and "dyspnea." Furthermore, acute chest pain can indicate fatal conditions such as acute myocardial infarction, aortic dissection, and pulmonary embolism. The clinical characteristics of different fatal diseases overlap in their symptom presentations, requiring triage decisions to extract reliable information for subsequent reasoning from ambiguous chief complaints within a very short timeframe. If a single model is used to directly encode the free complaint text into a semantic representation, due to the lack of explicit distinction between different clinical information categories in a medical context, the semantic embedding vector output by the model will have multiple dimensions of clinical information, such as pain location, pain nature, high-risk clues, and atypical manifestations, mixed and encoded in the same distributed representation. Downstream modules will be unable to distinguish from the above distributed representation which dimensions contain valid information, which dimensions lack information, which dimensions have reliable parsing results, and which dimensions have unreliable parsing results. Therefore, in order to transform the ambiguous free complaint text into a computer-processable semantic representation, step S1 in this embodiment is used to train a shared encoding model, which is used to encode the free complaint text into the corresponding semantic embedding vector, as follows: The study collected relevant terms from medical literature, clinical guidelines, doctor-patient dialogue records, and drug instructions. The medical literature included peer-reviewed academic journal articles, clinical trial reports, new drug patent documents, and medical textbooks. The clinical guidelines included disease diagnosis and treatment guidelines and expert consensus published by professional societies such as the Chinese Medical Association, as well as clinical practice guidelines published by authoritative organizations such as the World Health Organization. The doctor-patient dialogue records included anonymized transcripts of doctor-patient communication recordings and online consultation dialogues collected from internet hospital platforms and pre-hospital emergency scenarios. The drug instructions included official instructions for various drugs approved by the National Medical Products Administration. These multi-source medical texts collectively constitute a dedicated medical corpus, covering multiple dimensions of medical knowledge, including disease knowledge, symptoms and signs, treatment pathways, and drug information. After collecting the multi-source medical texts, each text underwent text cleaning, including removing duplicate content, removing headers, footers, and navigation bar information unrelated to the main text, and standardizing the text encoding to UTF-8. After cleaning, each medical text undergoes subsequent word segmentation to obtain its corresponding lexical units. All occurring lexical units and their frequencies are statistically analyzed. Based on a preset vocabulary size, high-frequency lexical units are retained, while low-frequency noise lexical units with extremely low occurrences are filtered out. Simultaneously, special functional markers are added to the vocabulary to assign a unique integer index starting from 0 to each retained lexical unit, forming a medical lexical unit vocabulary that maps lexical units to their indices.

[0018] The vocabulary size mentioned above is as follows: A comprehensive word segmentation and frequency analysis were performed on the medical corpus. For the segmented medical corpus, the frequency of each word element in the entire text word sequence was counted. All word elements were then sorted in descending order of frequency to obtain the sorted word sequence. ,in The most frequent word motif, This represents the total number of different lexical units in the medical corpus. For the sorted lexical sequence, the calculation is performed before... Cumulative frequency of each word ,in For the first The frequency of each word element. Calculate the total frequency of all words elements in the medical corpus. Then the previous The cumulative coverage of each word element is Sort by word group number The horizontal axis represents cumulative coverage. Plot a curve on the vertical axis to obtain the cumulative coverage curve; After sorting the words by frequency from high to low, the cumulative coverage curve is calculated. The number of words corresponding to a coverage rate of 99.5% is selected as the baseline value for the vocabulary size. Then, combined with the video memory or memory budget of the target deployment environment, the size of the vocabulary is adjusted appropriately while ensuring that the coverage rate is not lower than 99%. The final determination of the vocabulary size follows these quantitative criteria: If the target deployment environment has sufficient video memory budget, meaning the video memory capacity is sufficient to accommodate the complete model consisting of a vocabulary size corresponding to 99.5% coverage, then the vocabulary size is directly taken as the number of tokens corresponding to 99.5% coverage. If the video memory budget is insufficient, then the maximum number of tokens that satisfy the vocabulary size requirement without exceeding the available video memory budget is found on the cumulative coverage curve, while also requiring that the cumulative coverage corresponding to this number of tokens is not less than 99%. If the cumulative coverage cannot reach 99% within the available video memory budget, then adjustments at the vocabulary level are abandoned, and other video memory optimization methods are adopted instead. The specific shared coding model adopts the Transformer encoder architecture: the total number of semantic coding layers... The layer count is set to 12. The selection of this layer number is based on the following: In medical consultation tasks, the length of free-form patient complaints typically ranges from tens to hundreds of terms. A 12-layer coding structure provides sufficient depth of contextual interaction for each term, enabling the model to fully capture long-distance semantic dependencies between different clinical information such as pain location, pain nature, time information, and accompanying symptoms. The number of attention heads in the multi-head self-attention mechanism of each semantic coding layer is also considered. The system is configured with 12 attention heads. These 12 attention heads can focus on different dimensions of clinical information in the text from different semantic subspaces. For example, some heads focus on symptom descriptors, some on body parts, some on time expressions, and some on degree adverbs, thus achieving multi-faceted semantic understanding of the free-narrative text. Each semantic encoding layer's feedforward fully connected network contains two linear transformation layers, with the intermediate hidden layer dimension set as the hidden dimension. 4 times, that is The current input dimension of the feedforward network is... At that time, the first linear transformation will change the input from Dimension mapping to Dimension, the second linear transformation will Dimension Mapping Back The aforementioned 4x ratio is a widely adopted configuration in the Transformer architecture, which maintains computational efficiency while introducing an appropriate amount of nonlinear transformation parameters. The number of layers, heads, and intermediate dimensions of the feedforward network are fixed before training begins and are not used as trainable parameters in gradient updates.

[0019] To define the hidden dimensions of the shared coding model: Based on the semantic complexity of the medical consultation task, a set of candidate values ​​raised to powers of 2 (e.g., 512, 768, 1024) are selected as the candidate range for the hidden dimensions. While keeping other hyperparameters constant, the shared coding model is trained separately. The prediction accuracy of the masked language mechanism or the performance metrics of downstream symptom entity recognition tasks are evaluated on the same validation set. The performance gap between each candidate dimension on the training and validation sets is observed to determine overfitting or underfitting trends. Finally, the candidate value with the best performance on the validation set and acceptable computational efficiency is selected as the hidden dimension. A lexical embedding matrix is ​​constructed using the size of the medical lexical vocabulary and the hidden dimensions of the shared coding model. The number of rows in the lexical embedding matrix is ​​the size of the vocabulary, and the number of columns is the hidden dimension. Before training begins, each element in the lexical embedding matrix is ​​randomly initialized. During subsequent training of the shared coding model, the lexical embedding matrix is ​​used as a trainable parameter, and its initial value is continuously optimized through gradient backpropagation until a fully trained lexical embedding matrix is ​​obtained.

[0020] To determine the maximum sequence length for the shared coding model: Statistical analysis was performed on the segmented lengths of all texts in the medical corpus, and a length distribution histogram or cumulative distribution function was plotted. The quantile value covering 95% of the text length was calculated as the maximum sequence length. Based on the maximum sequence length and the hidden dimension of the shared coding model, a positional embedding matrix was constructed. The number of rows in the positional embedding matrix represents the maximum sequence length, and the number of columns represents the hidden dimension.

[0021] Based on the above architectural parameters, the total number of parameters in the shared coding model consists of the following parts. The number of parameters in the lexical embedding matrix is... ,in For vocabulary size, This is the hidden dimension. The position embedding matrix has Lmax×d parameters, where Lmax is the maximum sequence length. The multi-head self-attention part of each semantic coding layer contains four projection matrices, namely the query projection matrix. Key projection matrix Value projection matrix and output projection matrix The number of parameters for each projection matrix is ​​1. The four matrices combined Each semantic coding layer's multi-head self-attention part also includes a bias vector with a parameter count of . Each semantic coding layer's feedforward fully connected network contains two linear transformation layers. The first linear transformation layer has the following parameter count: The number of parameters in the second linear transformation layer is The two linear transformation layers combined The feedforward fully connected network also includes two bias vectors, with the following parameter numbers: and ,total Therefore, the number of parameters for each semantic coding layer is approximately [number missing]. (Ignore bias terms and layer normalization parameters). The total number of parameters in the semantic coding layer is approximately .when , At that time, the number of parameters in the semantic coding layer is approximately That is, approximately 84.9 million parameters. Adding the number of parameters in the lexical embedding matrix and the positional embedding matrix (in... The estimated value of Lmax=512 is approximately... The model has approximately 108 million parameters. This parameter size strikes a balance between semantic understanding accuracy and computational resource consumption for medical diagnosis tasks, enabling training and inference deployment on consumer-grade GPUs (approximately 12GB of VRAM). When hidden dimensions... When the value is 512, the total number of model parameters is approximately 48 million; when When the value is 1024, the total number of parameters in the model is approximately 192 million. The specific hidden dimension selected is determined by the GPU memory budget of the target deployment environment according to the aforementioned quantization criteria.

[0022] Before training begins, each element in the position embedding matrix is ​​assigned an initial value using random initialization. During subsequent training of the shared encoding model, the position embedding matrix, as a trainable parameter, is optimized synchronously with the word embedding matrix through gradient backpropagation, ultimately resulting in a fully trained position embedding matrix.

[0023] When the fully trained shared encoding model is put into use, it receives a free-narrative text and uses the medical lexicon constructed above to segment the free-narrative text, obtaining a text lexicon sequence. Specifically, the input free-narrative text is scanned from left to right, employing a greedy longest matching strategy: starting from the current character, the longest substring consisting of consecutive characters in the lexicon is searched, segmented, and recorded. If no substring from the current character matches the lexicon, the current single character is segmented as a lexicon, the pointer moves forward, and this process is repeated until the entire text is traversed. After segmentation, a start marker for semantic aggregation and a stop marker for indicating the end are inserted at the beginning and end of the sequence, respectively. Finally, each lexicon in the sequence is searched for its corresponding unique integer index in the medical lexicon, transforming the lexicon sequence into an index sequence, which is the final output of the segmentation process. The semantic embedding vector of each word in the text word sequence is obtained through the word embedding matrix, and the positional embedding vector of each word is obtained through the positional embedding matrix. The semantic embedding vector and the positional embedding vector are added element by element to obtain the initial input corresponding to the text word sequence. The initial input is fed into multiple semantic coding layers of a shared coding model, and the initial input is encoded layer by layer. Each semantic coding layer contains multi-head self-attention computation, feedforward fully connected network transformation, residual connections, and layer normalization operations. In each semantic coding layer, each lexical representation in the initial input interacts with the remaining lexical representations in the text lexical sequence through a self-attention mechanism, fusing contextual semantic information to generate the corresponding semantic coding layer's lexical context representation. Specifically, this is achieved through the... The output lexical context representation after layer encoding is as follows: ; in: This is the layer number of the semantic coding layer, and its value range is... To the total number of semantic coding layers .

[0024] For the first The word element in the first The word context representation vector output by the layer, i.e., the first layer... Input to the semantic coding layer.

[0025] For the first The word element in the first The semantic encoding layer outputs a lexical context representation vector after encoding.

[0026] For the first The semantic encoding layer executes the following operational functions, which sequentially include: mapping the input vector to query vector, key vector, and value vector through query projection matrix, key projection matrix, and value projection matrix; calculating the inner product of the query vector and all key vectors as the semantic association score, which is then adjusted by a scaling factor and normalized by softmax to become attention weights; performing weighted aggregation on the value vectors using the attention weights; adding the aggregation result element-wise to the input vector through a residual connection and then normalizing it; and finally, performing a nonlinear transformation on the normalized output through a feedforward fully connected network. The transformation result is also added element-wise to the sub-layer input through a residual connection and then normalized to obtain the final output. .

[0027] when hour, The initial input representation of a lexical is obtained by adding the semantic embedding vector and the positional embedding vector of the lexical element by element.

[0028] The output of the previous semantic coding layer serves as the input of the next semantic coding layer. After being encoded layer by layer by all semantic coding layers, each word in the text word sequence obtains the final word representation that integrates the semantics of the entire context of the free-narrative text.

[0029] The arithmetic mean of all final word representations is calculated element-wise along the length of the text word sequence. This is done by summing the values ​​of all final word representations along their respective dimensions and dividing by the length of the text word sequence. The result is a single vector with the same dimensions as the final word representations, which is the semantic embedding vector corresponding to the free-speech text. The shared encoding model is trained as follows: We acquired multi-source medical texts from medical literature, clinical guidelines, doctor-patient dialogue records, and drug instructions. Each text was segmented to obtain a text lexical sequence. The specific scale of these multi-source medical texts is as follows: Medical literature was collected from full-text academic papers related to emergency medicine, cardiovascular disease, and respiratory diseases published in the past decade in databases such as PubMed and CNKI, totaling approximately 500,000 articles, yielding approximately 250 million Chinese characters after text extraction. Clinical guidelines were collected from clinical diagnosis and treatment guidelines and expert consensus documents for diseases such as acute chest pain, acute coronary syndrome, aortic dissection, and pulmonary embolism published by institutions such as the Chinese Medical Association, the American Heart Association, and the European Society of Cardiology, totaling approximately 200 documents, yielding approximately 8 million Chinese characters after text extraction. Doctor-patient dialogue records were collected from online consultation records on internet hospital platforms with informed consent and anonymized, totaling approximately 100,000 dialogues. Each dialogue includes the patient's chief complaint and the doctor's follow-up questions and responses, yielding approximately 30 million Chinese characters after text integration. The drug instruction manuals were collected from the database of the National Medical Products Administration, containing approximately 500 official drug instruction manuals related to cardiovascular system medications. After text extraction, approximately 2 million Chinese characters were obtained. These multi-source medical texts, totaling approximately 290 million Chinese characters, constitute a dedicated medical corpus. Before performing word segmentation on these multi-source medical texts, each text underwent preprocessing, including converting all full-width characters to half-width characters, compressing consecutive spaces and line breaks into single spaces, removing non-textual markers, and converting all uppercase English letters to lowercase to ensure consistent text formatting. Finally, the training dataset was composed of all text word sequences.

[0030] The training dataset is input into the shared encoding model to be trained, and a masked language mechanism is used as a self-supervised learning task for training. The masked language mechanism randomly masks some words in the input text, forcing the shared encoding model to predict the original identity of the masked words based on the unmasked context words, thereby learning a deep semantic representation of the text. For each text word sequence in the training dataset, a portion of word positions in the text word sequence are randomly selected according to a preset masking ratio (usually set to 15%) to form a set of positions to be masked.

[0031] For each selected location in the set of masked locations, a corrupted word sequence is generated according to the following replacement strategy: With a first probability (usually set to 80%), the original word at that location is replaced with a special mask marker; with a second probability (usually set to 10%), the original word at that location is replaced with another word randomly selected uniformly from the medical word vocabulary; and with a third probability (usually set to 10%), the original word at that location remains unchanged. The sum of the three probabilities is 1. Unselected locations in the text word sequence retain their original words, thus obtaining the corrupted word sequence.

[0032] The corrupted lexical sequence is input into a shared coding model. After word segmentation, element-wise addition of semantic embedding vectors and positional embedding vectors, and layer-wise encoding by multiple semantic coding layers, the final lexical representation of each lexical in the corrupted lexical sequence is obtained.

[0033] For each masked position in the set of positions to be masked, the final lexical representation of the masked position is mapped to the vocabulary space through the output projection matrix and bias vector, and then normalized by softmax to obtain the predicted probability distribution. ,in, To share the current set of trainable parameters of the encoding model; Medical lexicon Any candidate word element in; To output the projection matrix Candidate word elements The corresponding weight row vector; For bias vector Candidate word elements The corresponding bias value; the denominator is the medical lexicon. The scores of all candidate word elements are summed after calculating their natural exponents, and then used for probability normalization. A loss function is constructed based on the predicted probabilities. The loss function is the mean of the negative logarithmic predicted probabilities of the true original words at all masked positions. Specifically, ;in Set of locations to be covered The total number of positional indices in the middle; For the concealed location The true original word units; For true original word elements The corresponding predicted probability.

[0034] The trainable parameters of the shared encoding model are iteratively updated using stochastic gradient descent across the entire training dataset. The optimizer used during training is an adaptive moment estimator (Adam optimizer). The learner rate of the optimizer... Set as The first-order moment decay coefficient of the optimizer Set to 0.9, second-order moment attenuation coefficient Set to 0.999, the numerical stability constant. Set as During training, a linear warm-up learning rate scheduling strategy is used. In the first 10% of training steps during the warm-up phase, the learning rate increases linearly from 0 to... After the warm-up period, the learning rate gradually decays according to the cosine annealing strategy. Each iteration samples 64 text word sequences from the training dataset. For text word sequences exceeding the maximum sequence length, they are truncated to the maximum sequence length; for text word sequences shorter than the maximum sequence length, special padding markers are added to the end of the sequence to make it the maximum sequence length. Furthermore, in each iteration, a mini-batch of samples is sampled from the training dataset, the gradient of the loss function with respect to the trainable parameters is calculated, and the trainable parameters are updated along the gradient descent direction according to the preset learning rate. ,in The set of trainable parameters before the update; The preset learning rate; The loss function value for mini-batch samples is relative to the set of trainable parameters. The gradient; This means assigning the result of the calculation on the right to the result on the left.

[0035] Repeat the above iterative process until the loss function converges or the preset number of training rounds is reached, resulting in a fully trained shared coding model. After training, the set of trainable parameters of the shared coding model is fixed, and the shared coding model then possesses the ability to perform unified semantic encoding on any free-speaking text.

[0036] The convergence of the loss function value and reaching the preset number of training epochs are two independent conditions for terminating the training of a shared-encoding model. These are determined by comparing the maximum patience value and the maximum number of training epochs, respectively. The maximum patience value is used to determine if the loss function value has converged. When the loss function value on the validation set does not reach a new low for several consecutive evaluation periods, and the patience counter accumulates to the maximum patience value, the loss function value is considered converged, and training terminates. The maximum number of training epochs is used to determine the upper limit of the training epochs. When the number of completed training epochs reaches the preset maximum number of training epochs, training is forcibly terminated regardless of whether the loss function value has converged. Since the maximum patience value determines the allowed waiting time when the model's performance stagnates, and the maximum number of training epochs determines the upper limit of the total number of iterations in model training, the maximum patience value corresponds to the convergence threshold, and the maximum number of training epochs corresponds to the upper limit threshold for the number of training epochs. In this scheme, the maximum patience value is set to 5 to effectively filter out accidental fluctuations in the validation loss value caused by the randomness of small batches of samples, preventing the model from being misjudged as convergent due to a single rebound in the loss value. Simultaneously, training is terminated promptly once the model performance truly reaches a plateau to conserve computational resources. The maximum number of training epochs is set to 20. This value ensures the model has sufficient iterations to fully learn the semantic knowledge in the medical corpus and serves as a safety upper limit to prevent indefinitely prolonged training in the extreme case where the loss value consistently decreases slowly by a very small margin, thus achieving a balance between training sufficiency and computational efficiency.

[0037] The maximum patience value of 5 and the maximum number of training rounds of 20 are based on a medical corpus of approximately 290 million Chinese characters and a shared encoding model with hidden dimensions. Number of semantic coding layers The specific values ​​are set under the condition that the total number of parameters is approximately 108 million. When the scale of the training data or the number of model parameters changes, the maximum patience value and the maximum number of training epochs need to be re-determined according to the following general principles. The principle for determining the maximum patience value is as follows: The maximum patience value is used to determine whether the validation set loss function value has entered a plateau period, and its value should be related to the normal fluctuation range of the validation set loss value during the training process. Specifically, in the first few training epochs after training starts, the standard deviation of the validation set loss value is recorded. The maximum patience value should be set to ,in The preset threshold for judging the decrease in loss value (usually taken as...) to (magnitude) The symbol represents the floor function. The above formula means that when the validation set loss value is continuously... The decline did not exceed [a certain percentage] within any assessment period. At this point, it is determined that the loss function value has converged. When the size of the training data or the number of model parameters increases, the fluctuation range of the validation set loss value... It usually increases, therefore the maximum patience value This needs to be increased accordingly to filter out normal fluctuations. The maximum tolerance value should be increased when the training data size or the number of model parameters decreases. This can be reduced accordingly to minimize unnecessary waiting rounds. The principle for determining the maximum number of training rounds is as follows: The maximum number of training rounds is used to set the upper limit of the total number of training iterations, and its value should be related to the expected number of iterations required for the model to converge. Before training starts, an initial upper bound of the maximum number of training rounds, Emax(0), is set and estimated based on the following empirical formula: Emax(0) = min(100, ⌈Nsamples×d108×20⌉), where To determine the total number of text word sequences in the training dataset, This is the hidden dimension. In the formula above... The normalization factor is 20, and the baseline training epochs are 20. This applies when the training data size... As the number of parameters increases, the model requires more iterations to fully learn the semantic knowledge in the data, and the maximum number of training epochs should be increased accordingly. When the number of model parameters increases, the convergence speed usually slows down, and the maximum number of training epochs should also be increased accordingly. In actual training, if the convergence condition of the maximum patience value is triggered before reaching the preset maximum number of training epochs, training is terminated early; if the convergence condition is not triggered when the maximum number of training epochs is reached, training is forcibly terminated. In this case, the trend of the validation set loss value should be recorded. If the loss value continues to decrease, the maximum number of training epochs should be appropriately increased in the next training iteration. The above general principles enable the large-scale medical consultation decision-making method based on multi-agent collaboration and structured output to reasonably set training termination conditions in application scenarios with different data scales and different model parameter numbers, ensuring sufficient model training while avoiding unnecessary consumption of computational resources.

[0038] Furthermore, although step S1 above has encoded the free complaint text into a semantic embedding vector through a shared encoding model, achieving the transformation from unstructured natural language to a continuous semantic space, the semantic embedding vector is essentially a distributed encoding of the overall semantics of the free complaint text. During the encoding process, the shared encoding model is not explicitly required to distinguish between different categories of clinical information contained in the free complaint text. Regardless of whether the free complaint text involves pain location, pain nature, high-risk disease clues, or hidden atypical manifestations, this information is all encoded in the same semantic embedding vector. Each hidden dimension in the semantic embedding vector does not independently correspond to a certain type of clinical information, but rather collectively carries the semantic features of the entire free complaint text in a distributed manner.

[0039] In emergency chest pain triage scenarios, clinical decision-making requires simultaneous attention to three dimensions: symptom attributes, high-risk factors, and atypical symptoms. The symptom attributes dimension clarifies the patient's specific clinical presentation, such as the location, nature, and duration of pain. The high-risk factors dimension screens for key clues pointing to life-threatening diseases, such as tearing pain suggesting aortic dissection. The atypical symptoms dimension explores easily overlooked, hidden manifestations, such as syncope and lower limb weakness—atypical accompanying symptoms of aortic dissection. These three dimensions play different decision-making roles in clinical reasoning; all three are indispensable, and the reliability of the analysis results for each dimension must be independently quantified to provide a reliable basis for subsequent cross-dimensional risk reasoning and consultation strategies.

[0040] However, the semantic embedding vector output in step S1 is a holistic representation. It neither decouples and explicitly labels the information from the symptom attribute dimension, the high-risk factor dimension, and the atypical symptom dimension, nor quantifies the certainty of the parsing results for each dimension. The semantic embedding vector cannot inform downstream modules which symptom attributes, high-risk clues, or atypical symptoms are included in the free-complaint text, nor can it distinguish whether the shared coding model has a high degree of certainty about the parsing results for one dimension or a low degree of certainty about the parsing results for another dimension. Therefore, although the output of step S1 provides a unified coding foundation for semantic understanding, the information granularity and structuring level of the semantic embedding vector are insufficient to directly support subsequent cross-dimensional risk reasoning and uncertainty quantification.

[0041] In the clinical practice of emergency chest pain triage, doctors do not process the patient's chief complaint information in one go, but rather follow three progressive stages: symptom collection, high-risk screening, and hidden clue investigation. The symptom collection stage is used to clarify the specific manifestations of the patient's chief complaint, including multiple symptom attributes such as pain location, nature, and duration. The high-risk screening stage is used to quickly identify key clues pointing to life-threatening diseases, such as tearing pain suggesting aortic dissection. The hidden clue investigation stage focuses on atypical manifestations that are easily overlooked by patients or doctors; for example, elderly patients with acute myocardial infarction may only present with toothache, neck pain, or abdominal pain. The clinical tasks in these three stages differ fundamentally in terms of information type, inference goals, and credibility requirements. The symptom collection task requires anchoring spoken language to standard clinical terminology. The high-risk screening task requires risk matching based on known symptoms. The hidden clue investigation task requires targeted searching guided by high-risk assumptions. If a single model simultaneously undertakes all three tasks, the model lacks an explicit mechanism to distinguish between different task types, leading to interference between the inference processes of different dimensions, and making it impossible to independently quantify the credibility of the analysis results for each dimension. To overcome the above limitations, step S2 is used to construct multiple intelligent agents, namely, the chief complaint semantic parsing agent, the high-risk factor mining agent, and the atypical symptom detection agent; The shared coding model in step S1, which is shared by all the agents mentioned above, transforms the same free-narrative text into feature vectors for cross-agent collaborative reasoning and risk quantification assessment through differentiated structured prompt templates, and assigns corresponding confidence scores to the feature vectors as their corresponding uncertainty labels. Specifically, in this example, after the shared encoding model performs semantic encoding on the free-narrative text to obtain a semantic embedding vector, it does not determine the subsequent reasoning direction on its own. Instead, it is controlled by the prompt template loading layers (symptom template layer, risk template layer, and atypical template layer) within each agent through task vectors. Each agent sends its own role instruction vector and query probe to the prompt template loading layer, which then activates the reasoning path in the parameter space that matches the specified behavioral paradigm based on the received role instructions.

[0042] Different role commands activate different reasoning pathways, allowing the same semantic embedding vector to serve reasoning tasks such as symptom attribute parsing, high-risk factor screening, and atypical symptom detection under the invocation of different agents. This enables the shared encoding model to support differentiated collaborative work of multiple specialized agents, balancing semantic consistency and task diversity. The aforementioned chief complaint semantic parsing agent, high-risk factor mining agent, and atypical symptom detection agent are respectively subjected to structured parsing, outputting the feature vectors of each agent and the corresponding uncertainty labels. The input-output logic of each agent is as follows: The chief complaint semantic parsing body includes a symptom template layer, an attribute decoding layer, and a symptom confidence layer, among which: Symptom Template Layer: Contains pre-built symptom prompt templates. These templates are organized in a three-part structure: field definition area, role definition area, and output protocol area. They store the symptom field set, symptom role instructions, and symptom output protocol respectively. Specifically: The symptom field set is defined as follows: In the acute chest pain triage scenario, the symptom field set is defined by the definition of individual symptom attributes and the valid value space for each symptom attribute. The symptom attributes specifically include the following eight attributes: location attribute, nature attribute, duration attribute, radiating pain attribute, accompanying symptom attribute, relieving factor attribute, aggravating factor attribute, and time rhythm attribute.

[0043] The valid value space for the body part attribute includes the area behind the sternum, the precordial region, the upper abdomen, the neck, the mandible, the left shoulder, the right shoulder, the back, the left upper limb, and the right upper limb.

[0044] The legal value space for a property includes squeezing, needle-piercing, tearing, burning, knife-cutting, stuffiness, pressure, and tightness.

[0045] The valid value range for the duration attribute includes several seconds, several minutes, more than ten minutes, half an hour, several hours, and duration.

[0046] The valid value space for the radiating pain attribute includes no radiating pain, radiating to the left upper limb, radiating to the right upper limb, radiating to the back, radiating to the upper abdomen, radiating to the neck, and radiating to the lower jaw.

[0047] The valid value space for the accompanying symptom attribute includes nausea, vomiting, sweating, difficulty breathing, palpitations, dizziness, loss of consciousness, and fatigue.

[0048] The valid value space for the relief factor attribute includes relief after rest, relief after taking nitroglycerin, relief after changing body position, and no obvious relief factor.

[0049] The valid value space for the aggravating factor attribute includes aggravation after activity, aggravation after deep breathing, aggravation after changing body position, and no obvious aggravating factor.

[0050] The valid value space for the circadian rhythm attribute includes: more frequent occurrences in the morning, more frequent occurrences at night, more frequent occurrences after meals, and no obvious time pattern.

[0051] The symptom role instruction is used to limit the behavioral paradigm of the chief complaint semantic parser in this reasoning to symptom identification. Specifically, it guides the reasoning behavior in the following directions: identifying symptom-related descriptions in the patient's spoken language as clinical information to be parsed, and mapping non-standard expressions such as "feeling like a stone pressing down" and "a tightness in the chest" to standard clinical terms such as "squeezing" and "chest tightness"; classifying ambiguous chief complaint content into corresponding attributes such as location, nature, and accompanying symptoms according to the various symptom parsing attributes defined in the symptom field set; when encountering ambiguous expressions, prioritizing the semantic understanding direction related to symptom features, and suppressing sentiment analysis or casual responses unrelated to symptom identification; The symptom output protocol is a set of pre-defined format constraint rules in the output protocol area corresponding to the symptom prompt template. These rules constrain the data format of the initial decoded values ​​output by the attribute decoding layer, as well as the accompanying format of the symptom confidence level output by the symptom confidence layer. The set of format constraint rules includes data structure constraint rules and confidence level-related constraint rules. Each of these constraint rules has a corresponding control flag in the output protocol area. The data structure constraint rules stipulate that the initial decoded value of each symptom attribute must be a standard clinical term within the corresponding legal value space, output as a discrete term value. Terms outside the legal value space must not be output, and output must not be in the form of natural language phrases or sentences. The data structure constraint rules also store corresponding data structure constraint control flags. The confidence level constraint rules stipulate that each preliminary decoded value must be accompanied by a corresponding symptom confidence level, and the symptom confidence level is a continuous value between zero and one. The symptom confidence level and the preliminary decoded value are bound in a one-to-one key-value pair. There must be no situation where there is a preliminary decoded value but no corresponding confidence score or a confidence score but no corresponding preliminary decoded value. The confidence level constraint rules are stored with corresponding confidence level constraint control flags.

[0052] The symptom template layer performs segmented reading and data extraction on the symptom prompt template according to its three-segment structure: it accesses the field definition area, reads the field name and legal value space of each symptom attribute in the field definition area one by one in the storage order, and encapsulates them into a set of field entries; it accesses the role definition area, reads out the complete text block corresponding to the symptom identification role instruction, and uses it as the identification role description text; and it accesses the output protocol area, reads out the set of format constraint rules corresponding to the symptom output protocol, and uses it as the output format specification.

[0053] The field entry set, identification role description text, and output format specifications are encoded and converted separately, and then uniformly encapsulated according to the hierarchical structure of identification prefix vector, all symptom query probes, and symptom decoding parameters to form a symptom task vector corresponding to the semantic embedding vector. The specific generation method is as follows: Generation of symptom query probes: After the shared coding model's word embedding matrix is ​​fully trained, each row vector has been internalized as a distributed semantic representation of the corresponding word in the semantic space, and all standard clinical terms in the legal value space are legal words in the medical word vocabulary. The complete closed-loop relationship of the above data flow is as follows: The first step is to perform word segmentation and word frequency statistics on the medical corpus and construct a medical lexicon. The medical lexicon includes all lexicons in the medical corpus that meet the frequency coverage requirements, including all standard clinical terms.

[0054] The second step is to construct a word embedding matrix based on the medical word word list. The row index of the word embedding matrix corresponds one-to-one with the word words in the medical word word list. The word embedding matrix is ​​continuously optimized through gradient backpropagation during the training of the shared coding model. After training is complete, each row vector is the distributed semantic representation of the corresponding word word.

[0055] The third step is to construct the symptom prompt template. The standard clinical terms in the valid value space of each symptom attribute written in the field definition area must be selected from the medical lexicon to ensure that each standard clinical term has a corresponding row vector in the lexicon embedding matrix.

[0056] The fourth step involves generating the symptom query probe based on a medical lexicon and a lexicon embedding matrix. The symptom query probe is obtained by reading the row vectors corresponding to all standard clinical terms in the legal value space from the lexicon embedding matrix and calculating the arithmetic mean of each element.

[0057] The data flow described above constitutes a complete unidirectional dependency chain from the corpus to the vocabulary, from the vocabulary to the embedding matrix, and from the embedding matrix to the query probe. The medical lexicon is the foundation of all subsequent steps. It is suggested that the legal value space defined in the template must be strictly limited to the coverage of the medical lexicon to ensure that the query probe can successfully read the vector representation of all standard clinical terms from the lexicon embedding matrix when it is generated. Therefore, for a set of field entries, the legal value space of each symptom attribute is used as the aggregation basis. The vector representation of all standard clinical terms in the legal value space is obtained through the word embedding matrix of the shared coding model. The arithmetic mean of all vector representations is calculated element by element to obtain the symptom query probe of the corresponding symptom attribute.

[0058] Generation of identification prefix vector: The identification role description text is segmented using the medical lexicon from step S1 to obtain the role lexicon sequence. The vector representation of each lexicon in the role lexicon sequence is obtained through the lexicon embedding matrix of the shared coding model. The arithmetic mean of all vector representations is calculated element by element to obtain the identification prefix vector.

[0059] The generation of symptom decoding parameters: The data structure and confidence-related constraint control tags in the symptom output protocol are mapped to vector representations in the semantic space through the word embedding matrix of the shared coding model, respectively, to obtain the data structure constraint control tag vector and the confidence-related constraint control tag vector. The two are then concatenated to obtain the symptom decoding parameters.

[0060] Attribute decoding layer: Based on the symptom query probes specific to each symptom attribute in the symptom task vector, attention calculations are performed on the semantic embedding vectors in parallel, as follows: In this example, the symptom query probe is used as the query vector, and the semantic embedding vector is used as the key vector and value vector. The inner product of the symptom query probe and the semantic embedding vector is calculated as the similarity. The similarity is used as a weight coefficient to perform weighted aggregation on the semantic embedding vector to obtain the local semantic representation corresponding to each symptom attribute.

[0061] It is worth noting that semantic equivalence reasoning is performed on each local semantic representation, that is, semantic similarity is calculated between each local semantic representation and each candidate concept vector in the corresponding legal value space, and the candidate concept vector with the highest similarity is selected as the initial decoding value.

[0062] Since the symptom query probe is generated by aggregating the vector representations of all standard clinical terms within the legal value space, and the semantic embedding vector is uniformly encoded from the free complaint text by a shared coding model, both reside in the same semantic space and share the same dimensions and parameter base. Therefore, by using the symptom query probe as the query vector and the semantic embedding vector as the key and value vectors, and calculating attention weights through inner product and weighted aggregation, it is possible to use the semantic direction defined by the standard clinical terms as the probe to selectively extract local semantic representations corresponding to each symptom attribute from the distributed semantic representation of the text. Specifically, the symptom query probe is generated by aggregating the vector representations of all standard clinical terms within the legal value space, and the semantic embedding vector is generated by a shared coding model to uniformly encode the free complaint text. The local semantic representation corresponding to each symptom attribute is: ,in For the first Local semantic representations corresponding to each symptom attribute; For the first Symptom query probe with symptom attributes; It is a semantic embedding vector; To hide dimensions; This is a scaling factor used to prevent the inner product value from becoming too large; The normalization function converts similarity into weight coefficients and then performs weighted aggregation on the semantic embedding vectors.

[0063] It is worth noting that although the local semantic representation has focused on the semantic information of specific symptom attributes, it is still a continuous numerical vector and cannot be directly consumed by the downstream risk assessment module or inquiry decision module. Therefore, semantic equivalence reasoning is performed on each local semantic representation, that is, semantic similarity calculation is performed between it and each candidate concept vector in the corresponding legal value space, and the candidate concept vector with the highest similarity is selected as the initial decoding value. The candidate concept vector is also a vector table of standard clinical terms in the word embedding matrix in the legal value space, and is in the same semantic space as the local semantic representation. The vector dot product can reliably measure the semantic similarity between the two. The specific mapping operation anchors the vague colloquial expression to the most matching standard clinical terminology. On the one hand, it ensures the standardization and clinical usability of the parsing results, so that the information received by the downstream module is unified and interpretable at the terminology level. On the other hand, it establishes a reliable quantification basis. The information concentration retained by the local semantic representation in the attention calculation can be directly used to quantify the uncertainty of the decoding result, so that each initial decoding value is accompanied by a confidence score, providing a reliable data basis for subsequent multi-agent collaborative reasoning and inquiry decision-making. The initial decoded value of each symptom attribute is ,in For the first Preliminary decoded values ​​for each symptom attribute; For the first The valid value space for each symptom attribute; It is a standard clinical term within the legal value space; Standard clinical terminology The corresponding candidate concept vector is represented by the row vector corresponding to the term in the lexical embedding matrix of the shared coding model; The inner product of the local semantic representation and the candidate concept vector represents the semantic similarity between the two. This indicates that the candidate term that maximizes the inner product value is selected as the initial decoding value.

[0064] Symptom Confidence Layer: Receives preliminary decoded values ​​for each symptom attribute, as well as local semantic representations of each symptom attribute. Calculates the information concentration of each local semantic representation: Normalizes the values ​​of the local semantic representations across each feature dimension to transform them into probability distributions: Divide the value of the local semantic representation in each feature dimension by the sum of the values ​​across all feature dimensions, ensuring that the sum of the normalized values ​​across all feature dimensions equals one. The normalized value for each feature dimension is the probability value for that feature dimension. The specific mathematical expression of the above calculation process is as follows: For the Local semantic representation of each symptom attribute ,in As the hidden dimension, the numerical values ​​of the local semantic representation on each feature dimension are denoted as . , Normalization will Transform into probability distribution ,in , Probability distribution The entropy value is ; The maximum possible entropy is Hmax = logd, meaning that the information in the local semantic representation is completely and uniformly distributed throughout the whole. The upper limit of entropy that can be achieved with a single feature dimension. Information concentration is ck = 1 - H(pk)Hmax, calculated using the complement of 1 (subtracting the normalized entropy value from 1). When the information of a local semantic representation is completely concentrated in one feature dimension... , The information concentration reaches its maximum value of 1. When the information of the local semantic representation is completely and uniformly distributed across all feature dimensions, H(pk) = Hmax. The information concentration reaches its minimum value of 0. The aforementioned information concentration... The value ranges from 0 to 1. The larger the value, the more concentrated the information in the local semantic representation, and the more reliable the parsing result.

[0065] For each probability value in the probability distribution, calculate the product of the probability value and the logarithm of the probability value, then sum the products of all feature dimensions, and take the negative of the sum as the entropy value of the probability distribution. Take the complement of the entropy value relative to the maximum possible entropy value to obtain the information concentration.

[0066] The numerical values ​​of local semantic representations across each feature dimension are as follows: When the shared encoding model encodes free-narrative text, each hidden dimension captures a certain type of abstract semantic feature in the text (such as the semantic attributes of specific words, the syntactic roles of phrases, and the logical relationships of the context). When the local semantic representation extracts information components related to a specific symptom attribute dimension from the semantic embedding vector through an attention mechanism, the numerical value of each feature dimension of the local semantic representation represents the activation strength of that semantic feature in the current symptom attribute dimension. The maximum possible entropy is the upper limit of the entropy value that can be achieved when the information in the local semantic representation is completely dispersed and the semantic information is uniformly distributed across all feature dimensions. The maximum possible entropy is uniquely determined by the total number of feature dimensions in the local semantic representation, and the natural logarithm of the total number of feature dimensions is the maximum possible entropy. Assign a symptom confidence level to the corresponding preliminary decoded value based on each information concentration. ,in For the first Information concentration across symptom attribute dimensions; For the first Symptom analysis confidence score for each symptom attribute dimension; This is a preset scaling factor used to adjust the sensitivity of the impact of information concentration on the confidence score. This is a preset offset coefficient used to adjust the activation threshold of the mapping function. The higher the information concentration, the better. The closer the value is to 1, the more reliable the initial decoded value; the lower the information concentration. The closer the value is to 0, the less reliable the initial decoded value is.

[0067] Scaling factor in the above mapping function Set to 5.0, offset coefficient The value is set to 2.5. The basis for determining the above value is as follows: when the information concentration... When it is 0.5 (i.e., the center level), ,at this time That is, a moderate level of information concentration corresponds to a confidence score of 0.5. When the information concentration... When approaching 1 (high concentration of information), , In other words, high information concentration corresponds to a higher confidence score. When information concentration... When approaching 0 (information is completely dispersed), , In other words, low information concentration corresponds to a lower confidence score.

[0068] The above mapping relationship ensures that the confidence score and information concentration have a monotonically increasing relationship, and maps the information concentration range from 0 to 1 to the confidence score range from approximately 0.076 to approximately 0.924, so that the mapped confidence score has reasonable discriminative power across the entire range. Scaling factor Controlling the steepness of the mapping curve, The larger the value, the more sensitive the confidence score is to changes in information concentration; the offset coefficient Controlling the horizontal position of the mapping curve, The larger the value, the higher the concentration of information required to achieve the same confidence score. and The value of makes the mapping curve reflect the information concentration. The proximity factor exhibits moderate sensitivity, forming a consistent judgment logic with the confidence threshold of 0.6—when the information concentration is approximately 0.54, a confidence score of 0.6 is obtained, precisely corresponding to the boundary point for low confidence judgment. The aforementioned scaling and offset coefficients are used as preset adjustable hyperparameters in the large-scale medical consultation decision-making method based on multi-agent collaboration and structured output, and are uniformly configured in the symptom confidence layer, risk confidence layer, and atypical confidence layer.

[0069] In emergency chest pain triage scenarios, the ambiguity and colloquialism of patient complaints lead to inherent uncertainty in the analysis results of some symptom attributes. To prioritize identifying analytical items with insufficient reliability within a limited number of consultation rounds, a confidence threshold of 0.6 is pre-set. Symptom attributes with confidence levels below the confidence threshold are identified as low-confidence fields. All low-confidence fields are aggregated to generate a first uncertainty graph indexed by symptom attributes and measured by symptom confidence levels.

[0070] The confidence threshold of 0.6 is determined as follows: In emergency chest pain triage scenarios, the confidence threshold needs to be set in a balance between "risk of missed diagnosis" and "efficiency of follow-up questioning." If the confidence threshold is set too high (e.g., 0.8), a large number of moderately confident analysis results will be judged as low confidence, triggering excessive follow-up questions, prolonging the consultation time, increasing the patient's cognitive burden, and potentially delaying emergency treatment. If the confidence threshold is set too low (e.g., 0.4), some analysis results with insufficient confidence will be accepted as high confidence, and the system may make triage judgments based on unreliable information, increasing the risk of missed or misdiagnosis. The confidence threshold of 0.6 is a balance point between the above two, corresponding to the conservative judgment principle in clinical decision-making that "60% certainty is enough to raise awareness": when the confidence of the analysis result is below 60%, it indicates that the model's certainty about the analysis result has not yet reached a safe threshold, and information in this dimension needs to be followed up for confirmation. The aforementioned confidence threshold can be adjusted according to specific needs in different application scenarios. When the mortality rate of the target disease is high, the confidence threshold can be increased to reduce the risk of missed diagnosis; when the consultation time window is extremely tight, the confidence threshold can be decreased to reduce the number of follow-up questions. The confidence threshold is used as a preset adjustable hyperparameter in the large-scale medical consultation decision-making method based on multi-agent collaboration and structured output, and is uniformly used in the confidence layer configuration of each agent.

[0071] The initial decoded values ​​of each symptom attribute, the symptom confidence level of each initial decoded value, and the first uncertainty graph are integrated into a nested first feature vector, indexed by the symptom attributes. The specific integration process is as follows: Each symptom attribute defined in the symptom field set is used as an index item, and the initial decoded values ​​and symptom confidence levels are bound as key-value pair data entries under the index item. All key-value pair data entries are arranged in index order to form a data layer. The first uncertainty graph is attached to the data layer as a metadata layer. The first uncertainty graph summarizes all symptom attributes with symptom confidence levels below the confidence threshold and their symptom confidence levels, and establishes a relationship between the symptom attributes and the corresponding entries in the data layer. The data layer and the metadata layer together constitute the first feature vector.

[0072] High-risk factor mining body: includes risk template layer, risk matching layer, and risk confidence layer.

[0073] Risk Template Layer: Pre-set risk warning templates. The risk warning templates are organized in a three-part structure: field definition area, role definition area, and output protocol area, which respectively store high-risk clue maps, risk role instructions, and risk output protocols.

[0074] The high-risk clue map definition includes multiple high-risk factor dimensions and a set of standard disease clues corresponding to each high-risk factor dimension. In the acute chest pain triage scenario, the high-risk factor dimensions specifically include the following four dimensions: acute myocardial infarction, aortic dissection, pulmonary embolism, and tension pneumothorax. The standard disease clue set for the acute myocardial infarction dimension includes the following standard clinical clues: squeezing pain behind the sternum, pain radiating to the left upper limb, pain radiating to the neck, pain lasting more than 20 minutes, accompanied by sweating, accompanied by nausea, and symptoms not relieved by rest. The standard disease clue set for the aortic dissection dimension includes the following standard clinical clues: tearing pain behind the sternum, pain radiating to the back, pain radiating to the lower abdomen, significantly elevated blood pressure, asymmetrical blood pressure in both upper limbs, accompanied by syncope, and accompanied by lower limb weakness. The standard disease clue set for the pulmonary embolism dimension includes the following standard clinical clues: sudden onset of dyspnea, chest pain worsening with deep breathing, hemoptysis, increased heart rate, decreased blood oxygen saturation, and a history of deep vein thrombosis in the lower extremities. The standard set of disease clues for tension pneumothorax includes the following standard clinical clues: sudden onset of unilateral chest pain, progressive worsening of dyspnea, tracheal deviation to the opposite side, fullness of the chest on the affected side, and loss of breath sounds on the affected side; The high-risk factor dimension is categorized based on the types of life-threatening diseases that require urgent identification in emergency chest pain triage scenarios, including dimensions such as acute myocardial infarction, aortic dissection, and pulmonary embolism. Each high-risk factor dimension contains a set of standard clinical clues pointing to the corresponding high-risk disease. Each standard clinical clue consists of a combination of standard terminology values ​​for several symptom attributes. Furthermore, the structure and standard terminology values ​​of each standard clinical clue in the set of standard clinical clues are pre-defined according to emergency clinical guidelines during the risk alert template construction phase.

[0075] The risk role instruction is used to limit the behavior paradigm of the shared coding model in this inference to emergency risk screening.

[0076] The risk output protocol is a set of pre-defined format constraint rules in the risk warning template output protocol area. It is used to constrain the data format of the high-risk preliminary assessment value output by the risk matching layer, as well as the additional format of the risk confidence level output by the risk confidence layer.

[0077] The risk output protocol includes data structure constraint rules and confidence level-related constraint rules. Each constraint rule has a corresponding control flag stored in the output protocol area. The data structure constraint rules stipulate that the preliminary high-risk assessment value for each high-risk factor dimension must include a high-risk presence value and a risk weight. Both the high-risk presence value and risk weight are output as continuous numerical values. The data structure constraint rules correspondingly store data structure constraint control flags. The confidence level-related constraint rules stipulate that each preliminary high-risk assessment value must be accompanied by a corresponding risk confidence level. The risk confidence level must be a continuous numerical value between zero and one, and the risk confidence level and the preliminary high-risk assessment value are bound in a one-to-one key-value pair format. The confidence level-related constraint rules correspondingly store confidence level-related constraint control flags.

[0078] The risk template layer performs segmented reading and data extraction of the risk warning template based on its three-segment structure: Access the field definition area, read the dimension name and standard disease clue set of each high-risk factor dimension one by one according to the preset storage order, and encapsulate them into a clue dimension set; Access the role definition area and read out the entire stored text block as a risk role description; Access the output protocol area to read out the stored format constraint rules data as a whole as the risk output specification.

[0079] The clue dimension set, risk role description, and risk output specification are encoded and transformed separately, and then uniformly encapsulated according to the hierarchical structure of risk prefix instructions, all risk query probes, and risk decoding parameters to form a risk task vector corresponding to the semantic embedding vector. The specific generation method is as follows: Risk Query Probe: For the clue dimension set, aggregation is based on the standard disease clue set corresponding to each high-risk factor dimension. All standard terminology values ​​in each standard clinical clue are obtained as vector representations through the lexical embedding matrix of a shared encoding model, and then summed element-wise to obtain the standard clinical clue vector. The arithmetic mean of all standard clinical clue vectors within the standard disease clue set is then calculated element-wise to obtain the risk query probe for the corresponding high-risk factor dimension.

[0080] Risk prefix instruction: The risk role description is segmented to obtain a role word sequence. The vector representation of each word in the role word sequence is obtained through the word embedding matrix. The arithmetic mean of all vector representations is calculated element by element to obtain the risk prefix instruction.

[0081] Generation of risk decoding parameters: The data structure and confidence level with constraint control tags in the risk output protocol are mapped to vector representations in the semantic space through word embedding matrix to obtain data structure control tags and confidence level control tags. The data structure control tags and confidence level control tags are concatenated to obtain risk decoding parameters.

[0082] Risk Matching Layer: Receives semantic embedding vector, risk task vector, and first feature vector. Since the risk matching layer of the high-risk factor mining entity needs to semantically compare symptom clues in the free complaint text with pre-defined standard clinical clues in the high-risk clue map when performing risk clue matching, and the semantic embedding vector obtained after encoding the free complaint text by the shared coding model only provides a distributed semantic representation at the text level, without explicitly labeling the specific type and credibility of each symptom attribute, the preliminary decoding value of each symptom attribute is extracted from the first feature vector. This preliminary decoding value is then mapped to a vector representation through a lexical embedding matrix and multiplied element-wise with the corresponding symptom confidence to obtain the conditional symptom vector. Specifically, the first feature vector is the output product of the complaint semantic parser after performing structured parsing on the same free complaint text. The preliminary decoding value is the discrete symbolic result of mapping colloquial expressions to standard clinical terms through semantic equivalence reasoning, and the symptom confidence is a quantitative assessment of the credibility of the parsing results for each symptom attribute. After mapping the initial decoded values ​​to vector representations and weighting them with symptom confidence, the conditional symptom vectors carry both explicit semantic information ("which specific symptoms are included in the patient's complaint") and uncertain information ("the degree of certainty regarding the results of these symptom analysis"). This allows the risk matching layer to benefit from the accurate extraction of symptom information by the complaint semantic parsing body and to perform weighted fusion of information from different sources based on symptom confidence in subsequent joint representation construction and standard disease clue matching, thereby improving the accuracy and robustness of high-risk clue matching.

[0083] Based on the risk query probes specific to each high-risk factor dimension encapsulated in the risk task vector, attention calculation is performed on the semantic embedding vector in parallel: using the risk query probe as the query vector and the semantic embedding vector as the key vector and value vector, the inner product is calculated as the similarity, and the weighted aggregation is used to obtain the local semantic representation corresponding to the high-risk factor dimension.

[0084] For each local semantic representation, risk clue matching is performed: the local semantic representation is added element-wise to the conditional symptom vector to obtain a joint representation vector; the inner product of the joint representation vector and the vector representation of each standard clinical clue in the standard disease clue set is calculated as the semantic similarity; the standard clinical clue with the highest semantic similarity is determined as the matched standard clinical clue. The highest semantic similarity is normalized and taken as the high-risk presence value; based on the pre-defined risk level of the matched standard clinical clue in the high-risk clue map, risk weights are assigned to the high-risk preliminary assessment values ​​of the corresponding high-risk factor dimensions. Finally, the high-risk presence value and risk weight are paired and combined to obtain the high-risk preliminary assessment value. Specifically, the high-risk preliminary assessment value is a tuple composed of the high-risk presence value and the risk weight, where the first field of the tuple is the high-risk presence value and the second field is the risk weight. The risk weights are specifically: ,in For the first Risk weights for each high-risk factor dimension; For the first Standard clinical clues matched across the high-risk factor dimensions; This function maps risk levels to pre-defined risk levels in a high-risk clue map. It takes a matched standard clinical clue as input and outputs the risk level value corresponding to that standard clinical clue. The risk level value is pre-set according to emergency clinical guidelines during the risk warning template construction phase. The higher the risk level of the standard clinical clue, the greater the risk weight value output by the mapping function. In emergency chest pain triage, high-risk factor screening is not conducted independently but is based on established symptom information. When a patient's complaint includes "squeezing pain behind the sternum," the doctor will prioritize the possibility of acute myocardial infarction. When the complaint includes "tearing pain radiating to the back," the doctor will prioritize aortic dissection. Without clear symptom information as guidance, a broad-spectrum search in the high-risk clue map will face the combinatorial explosion problem. Each high-risk disease corresponds to multiple standard clinical clues, and each clue is composed of multiple symptom attributes. Unguided searches are not only computationally inefficient but also generate false positives due to a large number of weak matches. The risk matching layer receives the first feature vector output by the complaint semantic parser, extracts the preliminary decoded values ​​and confidence levels of each symptom attribute from the first feature vector, and constructs a conditional symptom vector, enabling the high-risk factor mining body to perform targeted searches based on confirmed symptom information when performing risk clue matching. The clinical motivation for this design is that doctors' high-risk screening is based on the acquired symptom information. Doctors don't blindly guess all possible fatal diseases without knowing the location and nature of a patient's pain. Instead, they first narrow down the possibilities based on known symptoms, and then perform precise matching within that narrowed range. Conditional symptom vectors fuse known symptoms with matching clues in the semantic space, making the risk matching process both directional and targeted. Risk Confidence Layer: This layer receives preliminary high-risk assessment values ​​for each high-risk factor dimension, along with their corresponding local semantic representations. The values ​​of these local semantic representations across each feature dimension are normalized and converted into probability distributions. The entropy of these probability distributions is calculated, and the information concentration is obtained by taking the complement of the entropy value relative to the maximum possible entropy value. A risk confidence level is assigned to the corresponding preliminary high-risk assessment value based on the information concentration; the higher the information concentration, the closer the risk confidence level is to one. A pre-set confidence threshold is used, and a second uncertainty graph is constructed using high-risk factor dimensions with risk confidence levels below the pre-set threshold as an index and their corresponding risk confidence levels as values.

[0085] The initial risk assessment values, risk confidence levels, and second uncertainty maps for each high-risk factor dimension are integrated into a nested second feature vector, indexed by the high-risk factor dimension. The integration process is as follows: each high-risk factor dimension defined in the high-risk clue map is used as an index item; the initial risk assessment values ​​and risk confidence levels are bound as key-value pairs under the index item; all key-value pairs are arranged in index order to form a data layer; the second uncertainty map is appended as a metadata layer to the data layer, and a connection is established between the high-risk factor dimension index and the data layer, together forming the second feature vector.

[0086] Atypical symptom detector: includes an atypical template layer, a directional detection layer, and an atypical confidence layer.

[0087] Atypical Template Layer: Pre-set atypical prompt templates. The atypical prompt templates are organized in a three-part structure: field definition area, role definition area, and output protocol area, which respectively store the atypical symptom association map, the directional detection role instructions, and the atypical detection output format protocol.

[0088] The atypical symptom association map defines multiple dimensions of atypical symptoms and the associations between each dimension and high-risk diseases. In the acute chest pain triage scenario, the atypical symptom dimensions specifically include the following six dimensions: syncope, lower limb weakness, Horner's syndrome, hemoptysis, nausea and vomiting, and upper abdominal pain. Each atypical symptom dimension is configured with a valid value space and a list of associated high-risk diseases. The valid value space for the syncope dimension includes syncope and no syncope, and its association strength for aortic dissection is 0.85 and for pulmonary embolism is 0.40 in the list of associated high-risk diseases. The valid value space for the lower limb weakness dimension includes lower limb weakness and no lower limb weakness, and its association strength for aortic dissection is 0.75 and for acute myocardial infarction is 0.30 in the list of associated high-risk diseases. The valid value space for the Horner's syndrome dimension includes Horner's syndrome and no Horner's syndrome, and its association strength for aortic dissection is 0.80 in the list of associated high-risk diseases. The legal value space for the hemoptysis dimension includes both hemoptysis and no hemoptysis. Its association strength with pulmonary embolism in the high-risk disease list is 0.90, and with aortic dissection, it is 0.35. The legal value space for the nausea and vomiting dimension includes both nausea and vomiting and no nausea and vomiting. Its association strength with acute myocardial infarction in the high-risk disease list is 0.55, and with aortic dissection, it is 0.30. The legal value space for the upper abdominal pain dimension includes both upper abdominal pain and no upper abdominal pain. Its association strength with acute myocardial infarction in the high-risk disease list is 0.50, and with aortic dissection, it is 0.25. The above association strength values ​​range from 0 to 1. A higher value indicates a stronger clinical association between the atypical symptom and the corresponding high-risk disease. These values ​​are pre-set based on emergency clinical guidelines and medical literature during the atypical symptom template construction phase. The atypical symptom dimensions are categorized based on the potential for concealed manifestations of fatal diseases in emergency chest pain triage scenarios, including dimensions such as syncope, lower limb weakness, Horner's syndrome, and hemoptysis. Each atypical symptom dimension is configured with a valid value space and a list of associated high-risk diseases. The list of associated high-risk diseases stores the name of the high-risk disease and the association strength value. The association strength value is pre-set based on emergency clinical guidelines and medical literature during the atypical prompt template construction phase.

[0089] The directional detection role instruction is used to limit the behavior paradigm of the shared encoding model in this inference to rare clue detection.

[0090] The atypical detection output format protocol is a set of pre-defined format constraint rules in the atypical prompt template output protocol area. These rules constrain the data format of the atypical preliminary detection values ​​output by the directional detection layer, as well as the accompanying format of the atypical detection confidence score output by the atypical confidence layer. The atypical detection output format protocol includes data structure constraint rules and confidence-related constraint rules. Each constraint rule has a corresponding control flag stored in the output protocol area. The data structure constraint rules stipulate that each atypical preliminary detection value for atypical symptom dimension must include two fields: an atypical presence value and a correlation degree. Both the atypical presence value and the correlation degree are output as continuous numerical values. The corresponding data structure constraint rule stores a data structure constraint control flag. The confidence-related constraint rules stipulate that each atypical preliminary detection value must be accompanied by a corresponding atypical detection confidence score. The atypical detection confidence score must be a continuous numerical value between zero and one, and the atypical detection confidence score and the atypical preliminary detection value are bound in a one-to-one key-value pair format. The corresponding confidence-related constraint rule stores a confidence-related constraint control flag.

[0091] The atypical template layer performs segmented reading and data extraction on the atypical prompt template according to its three-segment structure: It accesses the field definition area, reading the dimension name, legal value space, associated high-risk disease list, and association strength value of each atypical symptom dimension in a preset storage order, and encapsulating them into a set of detection dimension entries; it accesses the role definition area, reading out the entire stored text block as the targeted detection role description text; and it accesses the output protocol area, reading out the entire stored format constraint rule data as the atypical detection output format specification.

[0092] The set of probe dimension entries, the text describing the targeted probe roles, and the output format specifications for atypical probes are encoded and transformed separately. These are then uniformly encapsulated according to a hierarchical structure: the targeted probe prefix instruction vector (global constraint), the array of all atypical query probes (dimensional constraint), and the atypical probe decoding constraint parameters (format constraint), forming an atypical probe task vector corresponding to the semantic embedding vector. The specific generation method is as follows: Generation of atypical query probes: For the set of probe dimension entries, the legal value space of each atypical symptom dimension is used as the aggregation basis. The vector representation of all standard clinical terms in the legal value space is obtained through the word embedding matrix. The arithmetic mean is calculated element by element to obtain the atypical query probe for the corresponding atypical symptom dimension.

[0093] Generation of the directional detection prefix command vector: The directional detection character description text is segmented to obtain a character word sequence. The vector representation of each word in the character word sequence is obtained through the word embedding matrix. The arithmetic mean is calculated element by element to obtain the directional detection prefix command vector.

[0094] Generation of atypical probe decoding constraint parameters: The data structure constraint control marker and the confidence-related constraint control marker in the atypical probe output format protocol are mapped to vector representations in the semantic space through the lexical embedding matrix. The resulting data structure constraint control marker vector is concatenated with the confidence-related constraint control marker vector to obtain the atypical probe decoding constraint parameters.

[0095] Targeted Detection Layer: Since the atypical symptom detector aims to investigate hidden manifestations of potentially fatal diseases—those easily overlooked by conventional thinking—based on known chief symptoms and high-risk hypotheses, the semantic embedding vector of the free chief complaint only provides a distributed semantic representation at the text level. It neither explicitly labels the resolved symptom information nor carries directional clues for the current high-risk hypothesis. If relying solely on the semantic embedding vector for unguided broad-spectrum searching, the atypical symptom detector will struggle to focus its limited reasoning resources on the atypical symptom space related to the current high-risk hypothesis, easily missing crucial hidden clues. Therefore, this layer receives the semantic embedding vector, the atypical detection task vector, the first feature vector, and the high-risk factor mining entity's output preliminary high-risk assessment value. A joint condition vector is constructed by fusing this multi-source information: The preliminary decoded value is extracted from the first feature vector and multiplied element-wise with the corresponding symptom confidence to obtain the first condition vector. The high-risk presence value in the preliminary high-risk assessment value is multiplied element-wise with the risk weight to obtain the second condition vector. The first and second condition vectors are added element-wise to form the joint condition vector.

[0096] Specifically, the first condition vector is obtained by element-wise multiplying the preliminary decoded value extracted from the first feature vector with the corresponding symptom confidence. Its function is to introduce the explicit symptom information (such as "chest pain" or "crushing sensation") and its credibility, already parsed from the chief complaint semantic analysis, into the atypical symptom detection process, enabling the targeted detection layer to be aware of the confirmed symptom features in the current chief complaint. The second condition vector is obtained by element-wise multiplying the high-risk presence value from the high-risk preliminary assessment value with the risk weight. Its function is to introduce the high-risk hypotheses (such as "suspected aortic dissection"), their clue strength, and risk level, already identified by the high-risk factor mining body, into the detection process, providing clear hypothesis guidance for targeted detection. The first condition vector and the second condition vector are added element by element to form a joint condition vector. Its function is to integrate the "confirmed symptom information" and the "high-risk hypothesis to be verified" into a unified query condition in the semantic space. This allows the targeted detection layer to be guided by both explicit symptom clues and high-risk hypothesis clues when performing attention calculations on the semantic embedding vectors. This enables the limited attention resources to be precisely focused on atypical symptom dimensions that are clinically related to the current high-risk hypothesis (such as syncope and lower limb weakness related to aortic dissection). Based on the atypical query probes specific to each atypical symptom dimension encapsulated in the atypical detection task vector, attention calculation is performed in parallel on the semantic embedding vectors: using the atypical query probes as query vectors and the semantic embedding vectors as key and value vectors, the inner product is calculated as the similarity, and weighted aggregation is used to obtain the local semantic representation corresponding to the atypical symptom dimension. For the th Atypical symptom dimension, locally semantically represented as ,in For the first The atypical query probes corresponding to each atypical symptom dimension are generated by encoding the atypical template layer. The semantic embedding vector output by the shared encoding model; This refers to the hidden dimension, which is the dimension of the semantic embedding vector; This is a scaling factor used to prevent the gradient from vanishing due to excessively large inner product values; The inner product of the atypical query probe and the semantic embedding vector represents the similarity. The normalization function transforms similarity into weight coefficients; these weight coefficients are then compared with the semantic embedding vector. Multiplication yields a weighted aggregated local semantic representation. .

[0097] Targeted symptom detection is performed on each local semantic representation. The local semantic representation is element-wise added to the joint conditional vector to obtain a fused representation vector. The inner product of the fused representation vector and the vector representations of each standard clinical term within the corresponding legal value space is calculated as the semantic similarity. The standard clinical term with the highest semantic similarity is selected, and the highest semantic similarity is normalized and used as the atypical presence value, representing the strength of the atypical symptom's presence in the free complaint text. The list of associated high-risk diseases and their association strength values ​​for this dimension are queried from the atypical symptom association graph. Combined with the high-risk hypothesis information implicit in the joint conditional vector, the association strength value is obtained as the association degree, representing the closeness of the association between the detected atypical symptom and the current high-risk hypothesis. The atypical presence value and the association degree together constitute the preliminary atypical detection value.

[0098] Atypical Confidence Layer: This layer receives preliminary atypical detection values ​​for each atypical symptom dimension, along with corresponding local semantic representations. The values ​​of the local semantic representations on each feature dimension are normalized and converted into probability distributions. The entropy of these probability distributions is calculated, and the information concentration is obtained by taking the complement of the entropy value relative to the maximum possible entropy value. Based on the information concentration, an atypical detection confidence score is assigned to the corresponding preliminary atypical detection value; the higher the information concentration, the closer the atypical detection confidence score is to one. Atypical symptom dimensions with a confidence score below a preset confidence threshold are classified as low-confidence fields. This data is then aggregated to generate a third uncertainty graph, indexed by the atypical symptom dimension and measured by the atypical detection confidence score.

[0099] The atypical preliminary detection values, atypical detection confidence scores, and the third uncertainty map for each atypical symptom dimension are integrated into a nested third feature vector, indexed by the atypical symptom dimension. The integration process is as follows: each atypical symptom dimension defined in the atypical symptom association graph is used as an index item; the atypical preliminary detection values ​​and atypical detection confidence scores are bound as key-value pairs under the index item; all key-value pairs are arranged in index order to form a data layer; the third uncertainty map is added as a metadata layer on top of the data layer, and its association with the data layer is established through the atypical symptom dimension index, together forming the third feature vector.

[0100] To compensate for the lack of collaboration and information sharing among the three agents due to independent analysis in step S2, and to enable the low-confidence high-risk cues detected by the high-risk factor mining agent to actively guide the atypical symptom detector to conduct targeted verification, while allowing the detection results of the atypical symptom detector to provide feedback and correct the initial assessment results of the high-risk factor mining agent, thus forming a closed-loop collaboration of hypothesis, verification, and correction among the agents, step S3 uses the low-confidence high-risk cues output by the high-risk factor mining agent to generate a risk enhancement vector, which is injected into the attention mechanism of the atypical symptom detector to improve its sensitivity to the detection of associated atypical symptoms; at the same time, the detection results of the atypical symptom detector are used as feedback correction signals to jointly adjust the initial high-risk assessment value of the high-risk factor mining agent. After completing the two-way linkage, the structured features and uncertainty annotations of the three agents after cross-correction are aggregated to construct a global uncertainty map, explicitly marking the information gaps that urgently need to be filled in the current consultation state and the degree of deficiency of each gap, as follows: A significance threshold for high-risk presence values ​​is set. High-risk factor dimensions in the second feature vector with high-risk presence values ​​greater than or equal to this threshold are selected as high-risk suspicious clues. In this scheme, the significance threshold for high-risk presence values ​​is set to 0.5. The rationale for this value is that the range of high-risk presence values ​​is between 0 and 1, and 0.5 serves as the neutral dividing point for binary classification. High-risk presence values ​​above 0.5 indicate that the model tends to consider the probability of the high-risk factor's existence to be greater than 50%, making it worthy of further verification as a suspicious clue. This threshold can be adjusted according to the conservatism of the application scenario. When the mortality rate of the target disease is high, it can be appropriately lowered to improve recall; when the cost of false positives is high, it can be appropriately increased to improve precision. Based on the high-risk existence value of high-risk questionable clues and using uncertainty as an amplification factor, a risk enhancement vector is calculated and generated. The risk enhancement vectors of all high-risk questionable clues are then summed element-wise to obtain the comprehensive risk enhancement vector. For the first clue that meets the extraction conditions... The risk enhancement vectors for the high-risk and questionable clues are as follows: ; in, For the first The high-risk presence value of each high-risk factor dimension; For the first Risk confidence level of each high-risk factor dimension; The degree of uncertainty is used as a magnification factor; For the first Risk query probes corresponding to each high-risk factor dimension. Risk enhancement vectors generated from all high-risk factor dimensions that meet the extraction criteria form a risk enhancement vector set.

[0101] Each of the above risk enhancement vectors Risk query probe Having the same dimensions That is, with semantic embedding vector The dimensions are the same. Comprehensive risk enhancement vector. The result is the element-wise summation of the risk enhancement vectors for all high-risk, questionable clues that meet the extraction criteria. Also Dimensional vector.

[0102] The attention mechanism for injecting the comprehensive risk enhancement vector into the targeted detection layer of the atypical symptom probe is as follows: the comprehensive risk enhancement vector is used as an additional attention bias term and superimposed on the weight distribution during the attention calculation between the atypical query probe and the semantic embedding vector. The attention calculation process after injection is as follows: taking the first... Atypical query probes for atypical symptoms As a query vector, with semantic embedding vector As key and value vectors, the similarity after injection risk enhancement is calculated and weighted aggregation is performed to obtain the first... Local semantic representation of atypical symptom dimension after risk enhancement The calculation formula is: ; in, For the first Atypical query probes corresponding to atypical symptom dimensions; It is a semantic embedding vector; To hide dimensions; This is the scaling factor; Standard similarity; This refers to the comprehensive risk enhancement vector calculated in step S3; The risk enhancement bias term represents the inner product of the atypical query probe and the comprehensive risk enhancement vector. For the atypical symptom dimension, which is clinically associated with high-risk factors, the inner product of the atypical query probe and the comprehensive risk enhancement vector is positive. The addition of this bias term increases the weight coefficient, thereby obtaining a higher response weight in attention allocation and improving the detection sensitivity for atypical symptoms associated with high-risk factors.

[0103] In the above formula, The dot product of the atypical query probe vector and the comprehensive risk enhancement vector is represented, and the result of this operation is a scalar. Therefore, the input to the Softmax function is a scalar, namely the sum of the scaled similarity score and the risk enhancement bias term, and the output of Softmax is a scalar weight coefficient, which is used to adjust the semantic embedding vector. We perform weighted aggregation to obtain local semantic representations. ; The third feature vector output by the atypical symptom detector includes the atypical presence value of each atypical symptom dimension and the correlation between atypical symptoms and potential severe illness. Step S3 uses the atypical presence value and correlation as a feedback correction signal: For each atypical symptom dimension, the atypical presence value is multiplied by the correlation to obtain the feedback contribution value of the atypical symptom dimension. The feedback contribution value is used as a weighting coefficient and multiplied by the atypical query probe of that atypical symptom dimension generated by the atypical template layer to obtain the feedback component of that atypical symptom dimension; the feedback components of all atypical symptom dimensions are summed element-wise to obtain the feedback correction signal.

[0104] After receiving the feedback correction signal, the risk matching layer of the high-risk factor mining body jointly adjusts the output preliminary high-risk assessment values: it semantically matches the feedback correction signal with the risk query probes of each high-risk factor dimension, calculates the correction amount, and adjusts the confidence level or risk weight of the high-risk existence value upwards or downwards. For the first... The adjusted risk confidence level for each of the high-risk factor dimensions is: ,in The preset correction step size coefficient; For feedback correction signal and the first The inner product of risk query probes for each high-risk factor dimension. A positive inner product indicates enhanced confirmation, while a negative inner product or no inner product indicates no confirmation. The truncation function restricts the corrected confidence score to the interval between zero and one.

[0105] More detailed, preset correction step size coefficients A value of 0.1 ensures that the adjustment range of the risk confidence level by the feedback correction signal is kept within a reasonable range, preventing drastic fluctuations in the confidence level due to excessive changes in the original confidence level in a single correction, and guaranteeing the stability of the iterative correction process. Feedback Correction Signal Dimensions and Risk Query Probe They are the same, both are Wei, because It is obtained by summing the feedback components of each atypical symptom dimension element by element, and each feedback component is an atypical query probe for that atypical symptom dimension (dimension is...). Multiplying by the weighting coefficient (scalar), the sum is... Still dimensional vector, therefore Indicates two The dot product of a dimensional vector yields a scalar. Furthermore, the joint adjustment of the preliminary high-risk assessment value of the high-risk factor mining body in step S3 also includes adjusting the high-risk presence value.

[0106] While revising the risk confidence level, the high-risk presence value is fine-tuned based on the feedback correction signal. The adjustment formula is as follows: ,in A step size coefficient of 0.05 is used to adjust the preset high-risk presence value. When the feedback correction signal is positive, the high-risk presence value is increased, indicating that the atypical symptom detection results confirm the high-risk hypothesis; when the feedback correction signal is negative, the high-risk presence value is decreased, indicating that the atypical symptom detection results weaken the high-risk hypothesis. The risk weight remains unchanged because it is determined by the pre-set risk level of the matched standard clinical clues in the high-risk clue map and is not adjusted with the feedback signal. After the above correction, both the high-risk presence value and the risk confidence level in the high-risk preliminary assessment value output by the high-risk factor mining system are updated, achieving joint adjustment of the high-risk preliminary assessment value.

[0107] After completing the bidirectional cross-attention correction described above, each agent outputs structured features that have undergone cross-correction and residual uncertainty annotations. Specifically, this includes: the first feature vector and first uncertainty map of the subject semantic parser after correction; the second feature vector and second uncertainty map of the high-risk factor mining agent after feedback correction; and the third feature vector and third uncertainty map of the atypical symptom detector after risk enhancement injection.

[0108] The above three sets of multi-source heterogeneous information are aggregated, namely: extracting the symptom confidence of each symptom attribute from the first feature vector, extracting the risk confidence of each high-risk factor dimension from the second feature vector, and extracting the atypical detection confidence score of each atypical symptom dimension from the third feature vector. All confidence scores are arranged in a fixed order to form the global confidence vector in the current consultation state. The distribution of the gap between the current confidence level and the ideal sufficient confidence level (1) is quantified for each clinical semantic dimension (corresponding to symptom attributes, high-risk factor dimensions, and atypical symptom dimensions), yielding the missing confidence values ​​for each clinical semantic dimension. Finally, the missing confidence values ​​for all clinical semantic dimensions constitute the missing confidence distribution. Based on the confidence gap distribution, a global uncertainty map is constructed: the confidence gap missing value of each clinical semantic dimension in the confidence gap missing value distribution is determined one by one. Clinical semantic dimensions with a confidence gap missing value greater than zero are determined to have an information gap, and their dimension index and confidence gap missing value are extracted as a record in the global uncertainty map. Clinical semantic dimensions with a confidence gap missing value equal to zero are determined to have sufficient information and are not included in the global uncertainty map. After all assessments are completed, the extracted clinical semantic dimension indices with information gaps and their missing confidence values ​​together constitute a global uncertainty graph. The global uncertainty graph uses clinical semantic dimensions as indexes, and each record contains a dimension index field and a missing value field, explicitly marking the information gaps that urgently need to be filled in the current consultation state and the degree of missingness for each gap. The order of records in the global uncertainty graph is consistent with the order of clinical semantic dimensions in the unified index of clinical semantic dimensions; dimensions with larger missing values ​​correspond to a higher degree of missingness in the global uncertainty graph. To transform the explicitly labeled information gaps in the global uncertainty map constructed in step S3 into a dynamic follow-up questioning and safe termination strategy aimed at minimizing clinical risk—that is, within a limited number of consultation rounds, prioritizing the dimension that contributes the most to reducing the overall clinical risk to the patient from multiple clinical semantic dimensions with information gaps for follow-up questioning, and terminating the consultation in a timely manner when the marginal safety benefit of follow-up questioning is insufficient to offset the cost of delay—step S4 generates natural language text that can be directly used to ask questions to the patient based on the global uncertainty map, specifically: In emergency chest pain triage, there is an inherent tension between the efficiency and safety of the inquiry process. Asking more questions can obtain more comprehensive information to improve diagnostic accuracy, but each round of inquiry consumes time. For fatal diseases such as acute myocardial infarction and aortic dissection, time delays directly translate into myocardial necrosis or life-threatening situations. Therefore, the inquiry strategy must strike an optimal balance between information gain and time cost. A large-scale medical inquiry decision-making method based on multi-agent collaboration and structured output needs to prioritize inquiring about the information gaps that contribute most to reducing the patient's overall clinical risk within a limited time, while promptly terminating the inquiry when the marginal safety gain from inquiry is insufficient to offset the cost of delay. Step S3 constructs a global uncertainty graph that explicitly labels the confidence gap values ​​for each clinical semantic dimension in the current inquiry state. Larger confidence gap values ​​indicate more severe information gaps in the aforementioned dimensions, and the greater the contribution of obtaining information in these dimensions through inquiry to reducing overall uncertainty. Step S4 generates inquiry text based on the global uncertainty graph, which is essentially a risk-oriented priority scheduling process. The large-scale medical consultation decision-making method based on multi-agent collaboration and structured output prioritizes inquiring about the dimension with the highest degree of missing information in the uncertainty graph, because this dimension contributes the most to the uncertainty of the current clinical decision, and obtaining this information can minimize the overall risk. When the confidence missing values ​​of all dimensions in the global uncertainty graph have dropped below the preset threshold, the information gain from continuing to inquire is insufficient to offset the time cost. The large-scale medical consultation decision-making method based on multi-agent collaboration and structured output should terminate the consultation and output the current optimal clinical judgment. The above design achieves a dynamic balance between information sufficiency and time urgency in the consultation process. The working principle of step S4 is more detailed as follows: The clinical semantic dimensions included in the global uncertainty graph are used as the target dimensions for inquiry. Using the target dimension as an index, pre-defined knowledge entries associated with that dimension are retrieved from the domain knowledge graph of the corresponding agent. This domain knowledge graph is a pre-constructed medical knowledge structured representation system based on a large-scale model medical consultation decision-making method using multi-agent collaboration and structured output. It comprises three layers: entities, relationships, and attributes. The entity layer covers symptom attribute entities (e.g., pain location, pain nature), high-risk factor dimension entities (e.g., acute myocardial infarction, aortic dissection), atypical symptom dimension entities (e.g., syncope, lower limb weakness), standard clinical terminology entities (e.g., retrosternal, crushing), and disease entities (e.g., acute myocardial infarction, aortic dissection, pulmonary embolism). The relationship layer defines the semantic associations between entities, including "appears as" relationships (connecting disease entities and symptom attribute entities), "belongs to" relationships (connecting standard clinical terminology entities and symptom attribute entities), "points to" relationships (connecting high-risk factor dimension entities and disease entities), and "accompanied" relationships (connecting atypical symptom dimension entities and disease entities). The attribute layer assigns specific attribute values ​​to each entity, including association strength (the numerical correlation between atypical symptoms and high-risk diseases), risk level (the urgency of the disease corresponding to standard clinical clues), and a valid value space (the set of optional terms for symptom attributes). The domain knowledge graph is constructed as follows: using emergency clinical guidelines, medical literature, and drug instructions as primary data sources, a rule-based ontology extraction method is employed to extract entity names, semantic relationships between entities, and attribute values ​​from these data sources. For symptom attributes and their valid value space, they are directly extracted from the symptom description section of the emergency clinical guidelines. For the high-risk factor dimension and its set of standard disease clues, they are extracted from the differential diagnosis section of the emergency clinical guidelines. For the atypical symptom dimension and its list of associated high-risk diseases and association strength values, they are extracted from the atypical manifestation section of the emergency clinical guidelines and epidemiological statistics in medical literature. After extraction, the above information is stored in the domain knowledge graph in the form of Resource Description Framework (RDF) triples. The relationship between the domain knowledge graph and the structured prompt templates of the three agents is as follows: The field definition area (symptom field set) in the symptom template layer of the chief complaint semantic parsing agent is directly derived from the instantiation of symptom attribute entities and their legal value space in the domain knowledge graph. The field definition area (high-risk clue graph) in the risk template layer of the high-risk factor mining agent is directly derived from the instantiation of high-risk factor dimension entities and their standard disease clue set in the domain knowledge graph. The field definition area (atypical symptom association graph) in the atypical template layer of the atypical symptom detector agent is directly derived from the instantiation of atypical symptom dimension entities and their associated high-risk disease list and association strength values ​​in the domain knowledge graph. During the construction of these three template layers, all information of the corresponding entities in the domain knowledge graph is copied to the field definition area of ​​the template and kept synchronized with the graph.In step S4, when performing follow-up question material retrieval, the target dimension of the follow-up question (such as "location") is used as an index to query all related entities and attribute values ​​corresponding to that entity in the domain knowledge graph, thereby obtaining all the standard clinical terms or key clinical clues required for the follow-up question.

[0109] If the target dimension for follow-up questions belongs to the symptom attribute dimension, the legal value space for that dimension is retrieved from the symptom field set, and the follow-up material consists of all standard clinical terms acceptable for that dimension. If the target dimension for follow-up questions belongs to the high-risk factor dimension, the standard disease clue set for that dimension is retrieved from the high-risk clue atlas, and the follow-up material consists of key clinical clues pointing to that high-risk disease. If the target dimension for follow-up questions belongs to the atypical symptom dimension, the legal value space for that dimension and the list of associated high-risk diseases are retrieved from the atypical symptom association atlas, and the follow-up material consists of the standard terminology for that atypical symptom and its association information with high-risk diseases. Specific pre-defined knowledge items have been pre-set based on emergency clinical guidelines and medical literature during the domain knowledge graph construction phase, ensuring the clinical rationality and standardization of the follow-up material. Finally, the follow-up questions are filled into the preset natural language question template to generate natural language text that can be directly asked to the patient; The aforementioned natural language question template is a pre-defined standardized sentence framework, containing pre-set fillable slots and fixed sentence structures. The process of generating natural language text from the follow-up questions constitutes one slot-filling operation, as detailed below: First, based on the dimension category to which the follow-up question belongs, a matching natural language question template is selected. Different types of clinical semantic dimensions correspond to different natural language question templates: symptom attribute dimensions correspond to symptom confirmation templates, high-risk factor dimensions correspond to clue confirmation templates, and atypical symptom dimensions correspond to exploratory templates. Each template has a pre-defined fixed natural language sentence structure, which contains one or more fillable slots. These slots indicate the insertion position of the follow-up question material.

[0110] Then, the standard terminology values ​​or standard clinical clue descriptions from the follow-up materials are sequentially filled into the corresponding slots of the template. During filling, the standard terminology values ​​from the follow-up materials are directly embedded into the slots in their original text form. Connectors or enumeration separators can be inserted between multiple candidate terms in the follow-up materials according to their logical relationships to generate complete questions that conform to the expression habits of natural language.

[0111] Once filled, the template with the slots replaced becomes a piece of natural language text that can be used to directly ask questions to patients; Taking the "location" dimension of the symptom attribute as an example, the original sentence structure of the symptom confirmation template might be "Which specific location do you feel uncomfortable in? Is it [Term 1] or [Term 2]?", where [Term 1] and [Term 2] are fillable slots. After filling "retrosternal" and "precordial region" from the valid value space into the corresponding slots, the generated candidate follow-up question in natural language text is "Which specific location do you feel uncomfortable in? Is it retrosternal or precordial region?" A one-time preprocessing process is automatically completed using a subset of doctor-patient dialogues from a medical corpus through cluster analysis and slot labeling algorithms. The construction of natural language question templates is a one-time preprocessing process that is automatically completed during the training preparation stage of the shared coding model by using a subset of doctor-patient dialogues in a medical corpus through cluster analysis and slot labeling algorithms.

[0112] The aforementioned subset of doctor-patient dialogues specifically originates from real online consultation records on internet hospital platforms, obtained with informed consent from patients and anonymized, as well as anonymized transcribed texts of emergency dispatch calls collected in pre-hospital emergency scenarios. This subset contains approximately 100,000 complete doctor-patient dialogue records, totaling about 30 million Chinese characters, covering various common emergency room complaints such as acute chest pain, acute dyspnea, palpitations, and syncope. Cluster analysis employed a density-based clustering algorithm (DBSCAN), with the core parameter set as the neighborhood radius. and minimum sample size The parameters mentioned above were determined by conducting multiple grid search experiments on the sentence vectors of all query statements, selecting the parameter combination that maximizes the cluster silhouette coefficient. Dependency parsing employed the Chinese dependency parsing tool HanLP (version 2.1), which was domain-adapted and trained on a medical corpus, accurately identifying the syntactic roles (such as subject, predicate, object, attributive, adverbial, etc.) and dependency relations (such as subject-predicate, verb-object, attributive-head, etc.) of lexical units in medical texts. The slot labeling algorithm matched syntactic roles and part-of-speech tags, marking lexical units that simultaneously met the conditions of being non-core functional words (i.e., not belonging to core roles such as subject, predicate, or core verb) and belonging to standard clinical terms or symptom descriptions included in the medical lexical unit dictionary as replaceable slots.

[0113] The aforementioned subset of doctor-patient dialogues specifically originates from real online consultation records on internet hospital platforms, processed with informed consent and anonymized, as well as anonymized transcribed texts of emergency dispatch calls collected in pre-hospital emergency scenarios. This subset contains approximately 100,000 complete doctor-patient dialogue records, totaling about 30 million Chinese characters, covering various common emergency room complaints such as acute chest pain, acute dyspnea, palpitations, and syncope. Cluster analysis employs a density-based clustering algorithm (DBSCAN), with its core parameter set as the neighborhood radius. and minimum sample size The above parameters were determined by performing a grid search on the sentence vectors of all query statements, selecting the parameter combination that maximizes the cluster silhouette coefficient. Dependency parsing was performed using the Chinese dependency parsing tool HanLP (version 2.1), which was domain-adapted and trained on a medical corpus, capable of identifying the syntactic roles and dependency relations of lexical units in medical texts. The criteria for determining syntactic roles as non-core function words were: In the dependency parsing results, lexical units do not belong to core syntactic roles such as subject, predicate, or core verb, and their syntactic role labels are marked as any one of the following: attributive, adverbial, complement, object, or prepositional phrase. The number of clusters is automatically determined by the algorithm based on the density peaks of the sentence vector distribution, specifically using the cluster expansion mechanism based on the density reachability of core points in the DBSCAN algorithm. First, set the neighborhood radius Contains at least Each sample point is labeled with a sentence vector as a core point. Then, starting from any core point, all density-reachable core points and boundary points are grouped into the same cluster. If there is no density-reachable path between different core point sets, they are divided into different clusters. The number of clusters generated in this way is the final number of clusters, which does not need to be specified in advance.

[0114] The specific principle is as follows: First, extract all doctor-patient dialogue records and their questions from a medical corpus to form a set of question statements. Each question statement is then segmented to obtain a sequence of lexical units. The arithmetic mean of the lexical embedding vectors of all lexical units in each question statement is used as its sentence vector representation. These lexical embedding vectors are derived from the lexical embedding matrix trained on the medical corpus. A density-based clustering algorithm is then used to cluster the sentence vectors of all question statements, grouping those with neighboring sentence vectors in the semantic space into the same cluster. Each cluster corresponds to a question pattern with the same semantic function. The number of clusters is automatically determined by the algorithm based on the density peaks of the sentence vector distribution.

[0115] Secondly, for each cluster, the question statement with the highest cosine similarity between the sentence vector and the cluster center vector is selected as the representative statement of that cluster. Dependency parsing is performed on the representative statement to obtain the syntactic role labeling for each lexical unit. Lexical units in the representative statement that simultaneously meet the following two conditions are marked as replaceable slots: the syntactic role of the lexical unit is a non-core functional word, and the lexical unit belongs to a standard clinical term or symptom description word included in the medical lexical vocabulary. Lexical units marked as replaceable slots are removed from the representative statement and replaced with slot marker symbols. The slot marker symbols are associated with the corresponding clinical semantic dimension's follow-up question material category; the association is determined by the dimension category to which the replaced lexical unit belongs in the symptom field set, high-risk clue graph, or atypical symptom association graph. After the replacement is completed, the representative statement is transformed into a natural language question template with fillable slots.

[0116] Finally, all natural language question templates generated from the clusters are organized and stored according to clinical semantic dimensions. Question templates for symptom attributes are stored in the template area of ​​the symptom prompt template, question templates for high-risk factors are stored in the template area of ​​the risk prompt template, and question templates for atypical symptoms are stored in the template area of ​​the atypical prompt template. When generating candidate follow-up questions in step S4, the system uses the dimension category of the follow-up target dimension as an index to read the matching natural language question template from the template area of ​​the corresponding prompt template, fills the template with the standard terminology values ​​from the follow-up material according to the slot association relationship, and generates natural language text.

[0117] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.

Claims

1. A large-scale medical consultation decision-making method based on multi-agent collaboration and structured output, characterized in that, include: Step S1: Train a shared encoding model to encode the acquired free-narrative text into corresponding semantic embedding vectors; Step S2: Construct the chief complaint semantic parsing body, the high-risk factor mining body, and the atypical symptom detection body; Each agent shares an encoding model and uses its own pre-set structured prompt template to transform the semantic embedding vector corresponding to the same free claim text into feature vectors for cross-agent collaborative reasoning and risk quantification assessment. The feature vectors are then assigned corresponding confidence scores as uncertainty labels. Step S3: Use the low-confidence high-risk clues output by the high-risk factor mining body to generate a risk enhancement vector, and inject the risk enhancement vector into the attention mechanism of the atypical symptom detector to improve the detection sensitivity of associated atypical symptoms. The detection results of the atypical symptom detector are used as feedback correction signals to jointly adjust the preliminary high-risk assessment value of the high-risk factor mining body. After completing the bidirectional linkage correction, the structured features and uncertainty annotations of the chief complaint semantic parsing body, the high-risk factor mining body, and the atypical symptom detection body after cross-correction are aggregated to construct a global uncertainty map; Step S4: Based on the global uncertainty graph, generate natural language text that can be used to directly ask questions to patients.

2. The large-scale medical consultation decision-making method based on multi-agent collaboration and structured output according to claim 1, characterized in that, Step S1 includes: The obtained free-narrative text is segmented to obtain a text word sequence; The semantic embedding vector of each word in the text word sequence is obtained by using the word embedding matrix, and the position embedding vector of each word is obtained by using the position embedding matrix. The semantic embedding vector and the position embedding vector are added element by element to obtain the initial input. The initial input is fed into multiple semantic coding layers of the shared coding model, and the initial input is encoded layer by layer. Each semantic coding layer uses a multi-head self-attention mechanism to enable each word representation to interact with the other word representations in the sequence, and fuses contextual semantic information to obtain the final word representation of each word. The semantic embedding vector corresponding to the free-narrative text is obtained by taking the arithmetic mean of each element of the final word representation on the dimension of the text word sequence.

3. The large-scale medical consultation decision-making method based on multi-agent collaboration and structured output according to claim 2, characterized in that, Step S1 further includes: Obtain multi-source medical texts, perform word segmentation on each multi-source medical text to obtain the text word sequence corresponding to each medical text, and form a training dataset from all text word sequences. The training dataset is input into the shared coding model to be trained, and the masking language mechanism is used as a self-supervised learning task for training. The masking language mechanism forces the shared coding model to predict the original identity of the masked words based on the unmasked context words by randomly masking some words in the input text. During training, the trainable parameters of the shared coding model are iteratively updated using the stochastic gradient descent algorithm.

4. The large-scale medical consultation decision-making method based on multi-agent collaboration and structured output according to claim 3, characterized in that: The chief complaint semantic parsing body includes a symptom template layer, an attribute decoding layer, and a symptom confidence layer, wherein: The symptom template layer contains pre-set symptom prompt templates. These templates are organized into a three-part structure: field definition area, role definition area, and output protocol area. They store the symptom field set, symptom role instructions, and symptom output protocol, respectively. The attribute decoding layer performs attention calculations on the semantic embedding vector in parallel based on the symptom query probes specific to each symptom attribute in the symptom task vector, obtains the local semantic representation corresponding to each symptom attribute, performs semantic equivalence reasoning on each local semantic representation, calculates the semantic similarity between each local semantic representation and each candidate concept vector in the corresponding legal value space, and selects the candidate concept vector with the highest similarity as the initial decoding value. The symptom confidence layer receives the preliminary decoded values ​​of each symptom attribute and the local semantic representation of each symptom attribute, calculates the information concentration of each local semantic representation, and assigns a symptom confidence to the corresponding preliminary decoded value based on the information concentration. The symptom confidence layer determines symptom attributes with symptom confidence below a preset confidence threshold as low-confidence fields, summarizes all low-confidence fields, and generates a first uncertainty graph with symptom attributes as the index and symptom confidence as the value. The preliminary decoded values ​​of each symptom attribute, the symptom confidence of each preliminary decoded value, and the first uncertainty graph are integrated into a first feature vector with a nested structure, indexed by the symptom attributes.

5. The large-scale medical consultation decision-making method based on multi-agent collaboration and structured output according to claim 1, characterized in that, The high-risk factor mining body includes a risk template layer, a risk matching layer, and a risk confidence layer, wherein: The risk template layer contains a pre-set risk warning template, which is organized in a three-part structure: field definition area, role definition area, and output protocol area. It stores high-risk clue map, risk role instructions, and risk output protocol respectively. The risk matching layer receives a semantic embedding vector, a risk task vector, and a first feature vector output from the chief complaint semantic parsing body. It extracts preliminary decoding values ​​of each symptom attribute from the first feature vector, maps the preliminary decoding values ​​to vector representations, and multiplies them element-wise with the corresponding symptom confidence to obtain a conditional symptom vector. It then performs attention calculations on the semantic embedding vectors in parallel based on risk query probes specific to each high-risk factor dimension to obtain local semantic representations corresponding to the high-risk factor dimensions. It adds the local semantic representations to the conditional symptom vectors element-wise to obtain a joint representation vector. It calculates the semantic similarity between the joint representation vector and the vector representation of each standard clinical clue in the standard disease clue set, and selects the standard clinical clue with the highest semantic similarity to determine the preliminary high-risk assessment value. The risk confidence layer receives the preliminary risk assessment values ​​and corresponding local semantic representations of each high-risk factor dimension, calculates the information concentration of each local semantic representation, assigns a risk confidence level to the corresponding preliminary risk assessment value based on the information concentration level, and aggregates the high-risk factor dimensions with risk confidence levels lower than a preset confidence threshold to generate a second uncertainty map. The preliminary risk assessment values, risk confidence levels, and second uncertainty maps of each high-risk factor dimension are integrated into a nested second feature vector with the high-risk factor dimension as the index.

6. The large-scale medical consultation decision-making method based on multi-agent collaboration and structured output according to claim 5, characterized in that, The atypical symptom detector comprises an atypical template layer, a directional detection layer, and an atypical confidence layer, wherein: The atypical template layer contains a pre-set atypical prompt template. The atypical prompt template is organized into a three-segment structure: field definition area, role definition area, and output protocol area. It stores the atypical symptom association map, the directional detection role command, and the atypical detection output format protocol, respectively. The directional detection layer receives a semantic embedding vector, an atypical detection task vector, a first feature vector output by the chief complaint semantic parsing body, and a high-risk preliminary assessment value output by the high-risk factor mining body. It extracts the preliminary decoding value from the first feature vector and multiplies it element-wise with the corresponding symptom confidence to obtain a first condition vector. It multiplies the high-risk presence value in the high-risk preliminary assessment value with the risk weight element-wise to obtain a second condition vector. It adds the first condition vector and the second condition vector element-wise to form a joint condition vector. It performs attention calculation on the semantic embedding vector in parallel according to the atypical query probes specific to each atypical symptom dimension to obtain the local semantic representation corresponding to the atypical symptom dimension. It adds the local semantic representation and the joint condition vector element-wise to obtain a fusion representation vector. It calculates the semantic similarity between the fusion representation vector and the standard clinical term vector representation in the corresponding legal value space to determine the atypical preliminary detection value. The atypical confidence layer receives the atypical preliminary detection values ​​and corresponding local semantic representations of each atypical symptom dimension, calculates the information concentration of each local semantic representation, assigns an atypical detection confidence score to the corresponding atypical preliminary detection value based on the information concentration, and aggregates atypical symptom dimensions with atypical detection confidence scores lower than a preset confidence threshold to generate a third uncertainty map. The atypical preliminary detection values, atypical detection confidence scores, and third uncertainty maps of each atypical symptom dimension are integrated into a nested third feature vector, indexed by the atypical symptom dimension.

7. The large-scale medical consultation decision-making method based on multi-agent collaboration and structured output according to claim 1, characterized in that, In step S3, generating a risk enhancement vector using low-confidence high-risk clues output by the high-risk factor mining body includes: High-risk factor dimensions in the second feature vector whose high-risk presence value is greater than or equal to a preset high-risk presence value significance threshold are retrieved as high-risk suspected clue items; Based on the high-risk existence value of high-risk and questionable clue items, and using the degree of uncertainty as an amplification factor, a risk enhancement vector is calculated and generated. The risk enhancement vectors of all the high-risk and questionable clues are summed element by element to obtain the comprehensive risk enhancement vector; The comprehensive risk enhancement vector is added as an additional attention bias term and superimposed on the weight distribution when performing attention calculations on atypical query probes and semantic embedding vectors in the atypical symptom detector.

8. The large-scale medical consultation decision-making method based on multi-agent collaboration and structured output according to claim 7, characterized in that, In step S3, the detection results of the atypical symptom detector are used as feedback correction signals to jointly adjust the preliminary high-risk assessment value of the high-risk factor mining body, including: The atypical presence value and correlation degree of each atypical symptom dimension are extracted from the third feature vector output by the atypical symptom detector. The atypical presence value and correlation degree are multiplied to obtain the feedback contribution value of each atypical symptom dimension. The feedback contribution value is used as a weighting coefficient and multiplied by the atypical query probe of the atypical symptom dimension generated by the atypical template layer encoding to obtain the feedback component of the atypical symptom dimension. The feedback components of all the atypical symptom dimensions are summed element by element to obtain the feedback correction signal; The feedback correction signal is injected into the risk matching layer of the high-risk factor mining body. The feedback correction signal is semantically matched with the risk query probes of each high-risk factor dimension, the correction amount is calculated, and the confidence of the initial high-risk assessment value is adjusted.

9. The large-scale medical consultation decision-making method based on multi-agent collaboration and structured output according to claim 8, characterized in that, In step S3, constructing the global uncertainty map includes: The symptom confidence of each symptom attribute is extracted from the first feature vector after the semantic parsing of the chief complaint. The risk confidence of each high-risk factor dimension is extracted from the second feature vector after feedback correction from the high-risk factor mining body. The atypical detection confidence score of each atypical symptom dimension is extracted from the third feature vector after risk enhancement injection from the atypical symptom detector body. All confidence scores are arranged in a fixed order to form the global confidence vector in the current consultation state. The distribution of the gap between the current confidence level and the ideal full confidence level is quantified in each clinical semantic dimension to obtain the confidence missing value of each clinical semantic dimension. The confidence missing value of all clinical semantic dimensions constitutes the confidence missing distribution. Clinical semantic dimensions with a confidence gap greater than zero are identified as having an information gap. The dimension index and confidence gap of the clinical semantic dimension are extracted as a record in the global uncertainty graph. All clinical semantic dimension indices with information gaps and their confidence gaps together constitute the global uncertainty graph.

10. The large-scale medical consultation decision-making method based on multi-agent collaboration and structured output according to claim 1, characterized in that, In step S4, based on the global uncertainty graph, the clinical semantic dimension included in the global uncertainty graph is used as the target dimension for follow-up questions. Pre-set knowledge items associated with the target dimension for follow-up questions are retrieved from the corresponding domain knowledge graph as follow-up question materials. The follow-up question materials are then filled into a preset natural language question template to generate natural language text that can be directly asked to the patient.