Semantic hybrid retrieval and reordering method for intelligent psychological counseling of primary and secondary school students

Through the semantic hybrid retrieval and re-ranking method, combined with the FAQ knowledge base and large language model, the deficiencies in semantic understanding and dialogue generation in psychological counseling for primary and secondary school students are solved, efficient and professional psychological counseling services are achieved, and the retrieval accuracy and reliability of dialogue generation are improved.

CN120611018APending Publication Date: 2025-09-09FUZHOU EDUCATION COLLEGE SECOND AFFILIATED MIDDLE SCHOOL

Patent Information

Application Number
CN202510693980.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-09-09

AI Technical Summary

Technical Problem

Existing technologies in psychological counseling for primary and secondary school students have problems such as limited semantic retrieval accuracy, insufficient reliability of dialogue generation, insufficient optimization of context and multi-round interactions, and insufficient depth of knowledge fusion and reasoning. As a result, intelligent psychological counseling systems are unable to accurately understand students' deep intentions and provide professional and coherent responses.

Method used

A semantic hybrid retrieval and re-ranking method is used to screen candidate questions and answers from the FAQ knowledge base through keyword matching, synonym expansion, word vector embedding and similarity calculation, and a pre-trained large language model is used to generate optimized answers. Combined with manual review and knowledge base updates, the accuracy and coherence of the answers are ensured.

Benefits of technology

It significantly improves the accuracy of question-answer matching and the quality of responses in psychological counseling for primary and secondary school students, provides highly natural, professional and multi-round dialogue support, and meets the timeliness and security requirements of online counseling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120611018A_ABST
    Figure CN120611018A_ABST
Patent Text Reader

Abstract

The invention relates to a semantic hybrid retrieval and reordering method for intelligent psychological counseling of primary and secondary school students, which comprises the following steps of: S1, receiving questions input by a user, preprocessing the questions, extracting a keyword set, and converting the keyword set into normalized Chinese semantic representation; s2, based on a mixed retrieval technology including keyword matching and semantic indexing, retrieving a candidate question and answer set related to the user question from the FAQ knowledge base; s3, word vector embedding representation is carried out on the user question and each candidate question and answer, the similarity between the user question and each candidate question and answer is calculated, the candidate questions are reordered according to similarity scores, and Top K candidate questions are screened out; s4, inputting the Top K candidate questions and the answers thereof into a pre-trained large language model, and generating optimized natural language answers; and S5, performing semantic integrity and context consistency verification on the generated answer, and outputting a final answer. The method can improve the matching accuracy and reply quality of intelligent psychological consultation questions and answers of primary and secondary school students.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a semantic hybrid retrieval and re-ranking method for intelligent psychological counseling for primary and secondary school students. Background Art

[0002] With the development of artificial intelligence (AI), psychological counseling platforms for primary and secondary school students are gradually integrating semantic understanding and question-answering dialogue technologies. Currently, most mainstream products adopt two approaches: one is retrieval and matching based on knowledge bases or community Q&A, and the other is the use of large models (large pre-trained language models) for dialogue generation.

[0003] Knowledge Base / Community Q&A Path: Early online psychological counseling platforms (such as Yixinli) were primarily focused on providing psychological content and services, gathering professional counselors through online Q&A communities to answer users' questions. After users submit text questions on the platform, the system posts the questions, and interested counselors leave messages to answer them, gradually accumulating a large number of question-and-answer pairs and psychological knowledge content. To improve retrieval efficiency, such platforms have gradually introduced semantic analysis and matching technologies: for example, a patent for a community question-and-answer retrieval system (CN105786794B) extracts, expands, and calculates weights for user questions, combining dependency analysis to match relevant question-and-answer pairs and improve retrieval accuracy. In these solutions, natural language processing is used to understand the user's question intent and retrieve the best answer from an existing FAQ knowledge base.

[0004] Large-model conversational approaches: With breakthroughs in deep learning and pre-trained models, recent explorations have led to the use of large models for psychological conversations. For example, the concept product "AI Xinyu" proposes leveraging advanced large-model technology to create a psychological counseling platform. Through personalized psychological assessments, instant feedback, and interactive learning, it aims to provide users with comprehensive and convenient mental health services. Major companies are also beginning to explore this approach in practice. The Yidianling platform announced integration with Baidu's Wenxin Yiyan (ERNIEBot) large-model capabilities, becoming one of the first platforms in the industry to apply generative conversational models to psychological counseling scenarios. ERNIEBot leverages its cross-modal and cross-language deep semantic understanding and generation capabilities for intent recognition and content generation in counseling conversations. By incorporating this large-model conversational technology, the platform aims to achieve in-depth analysis of users' natural language and emotional expressions, enabling timely identification of potential psychological issues and providing support. Tencent has also collaborated with the Institute of Psychology of the Chinese Academy of Sciences to develop an AI-powered psychological counseling robot and has applied for patent CN111667926B, proposing a counseling conversation system based on a psychological knowledge graph and multi-turn dialogue management. This system includes an input module, a language analysis module, a logic tree dialogue module, a corpus, and a feedback module. It uses a psychological knowledge graph to assist in multi-round conversation intent analysis and guide the conversation flow, aiming to provide users with a conversation experience close to that of a real-person counselor. Furthermore, some customized large-scale models are beginning to emerge, such as the EmoLLM model introduced by Baidu Smart Cloud, which is designed specifically for mental health support. It utilizes instruction fine-tuning and multi-model fusion techniques, combining the advantages of multiple pre-trained models to improve understanding and responsiveness to user emotional context. These solutions each have their own unique features in semantic retrieval, question-answer matching, and large-scale model fusion: from FAQ retrieval systems based on domain knowledge bases to large-scale dialogue systems that integrate sentiment analysis and knowledge graphs.

[0005] Although the above technical solution has improved the intelligent level of online psychological counseling, compared with the objectives of the present invention, the existing technology still has some shortcomings and areas for improvement: 1. Limited semantic search accuracy: Traditional FAQ retrieval and community question-and-answer matching rely primarily on keywords and shallow semantic extensions. When elementary and middle school students describe psychological distress in everyday language or in subtle ways, simple keyword matching may fail to accurately understand their underlying intent, leading to incomplete searches and inaccurate matches. While some existing solutions improve question-and-answer matching rates through rule weights and dependencies, they can still result in incomplete semantic analysis and an inability to identify implicit emotional factors in a student population with diverse language usage.

[0006] 2. Insufficient reliability of dialogue generation: While directly using large models for psychological dialogues offers excellent fluency, it also exposes issues with content reliability. General-purpose large models (such as ChatGPT) often lack the constraints of professional psychological knowledge and may generate responses inconsistent with standard psychological counseling practices, or even biased or distorted advice. Current industry attempts at simple integration (such as using Wenxin Yiyan to generate responses) lack verification and guidance of large model outputs, posing certain risks.

[0007] 3. Inadequate optimization of context and multi-round interactions: Many existing psychological question-and-answer systems are either stuck in a single-round Q&A model (user questions, system replies) or employ a pre-set dialogue logic tree to manage multi-round conversations. However, fixed logic trees struggle to cover the vast diversity of real-world consultation scenarios, potentially leading to rigid conversation flows and an inability to dynamically adjust based on user feedback. Furthermore, typical FAQ systems lack conversation memory and are unable to incorporate user history into their responses to provide more relevant responses.

[0008] 4. Insufficient knowledge integration and reasoning depth: Current solutions often operate independently of knowledge base retrieval and large-scale model reasoning, lacking a comprehensive integration. For example, while FAQ retrieval systems are reliable, their responses tend to be template-based and lack individual analysis. Pure large-scale model dialogues can generate responses to specific statements, but may overlook mature psychological intervention knowledge. Summary of the Invention

[0009] The purpose of the present invention is to provide a semantic hybrid retrieval and re-ranking method for intelligent psychological consultation for primary and secondary school students, which can improve the matching accuracy and response quality of intelligent psychological consultation questions and answers for primary and secondary school students.

[0010] To achieve the above objectives, the present invention adopts a technical solution: a semantic hybrid retrieval and re-ranking method for intelligent psychological counseling for primary and secondary school students, comprising the following steps: S1. Receive Chinese psychological counseling questions input by users, pre-process them, extract a set of keywords that can represent the core semantics of the questions, and convert them into standardized Chinese semantic representations; S2. Based on a hybrid retrieval technology including keyword matching and semantic indexing, a candidate question and answer set related to the user's question is retrieved from the FAQ knowledge base; S3. Embed the user question and each candidate question and answer into word vectors, calculate the similarity between the user question vector and each candidate question vector, and re-rank the candidate questions from high to low based on the similarity score to select the top K candidate questions. S4: Input the top K candidate questions and their corresponding answers into the pre-trained large language model to generate optimized natural language answers; S5. Check the semantic integrity and context consistency of the generated answer and output the final answer.

[0011] Furthermore, in step S1, the implementation method of pre-processing the Chinese psychological counseling questions input by the user is: 101) Segment the Chinese psychological counseling questions input by the user and tag all the words using part-of-speech tagging technology. Then, extract keywords including nouns and verbs, filter out stop words, and obtain a set of keywords that can represent the core semantics of the question. 102) Synonym expansion is performed on the extracted keywords through a predefined synonym dictionary, and the keywords are mapped into standard vocabulary expressions, thereby converting the user's natural language questions into standardized Chinese semantic representations.

[0012] Furthermore, in step S2, the method for retrieving a candidate question-answer set related to the user's question from the FAQ knowledge base is as follows: 201) Perform preliminary matching retrieval in the FAQ knowledge base based on keyword matching, retrieve candidate questions with a relevance to the user question higher than a set value from the FAQ knowledge base, and obtain a preliminary candidate question and answer set; 202) Use the pre-trained word vector model to convert the user question into a vector, and retrieve several candidate questions and corresponding candidate answers in the vector space whose semantic distance to the vector is less than a set value based on vector similarity; 203) Combining the retrieval results obtained in step 201) and step 202) to obtain a mixed candidate question and answer set.

[0013] Furthermore, the specific implementation method of step S3 is: 301) Perform word vector embedding on the user question and each candidate question in the candidate question and answer set to obtain the corresponding vectorized semantic representation, i.e., the user question vector and the candidate question vector; 302) Calculate the cosine similarity between the user question vector and each candidate question vector to measure the degree of semantic matching between the user question and each candidate question; 303) Re-rank all candidate questions based on their similarity scores from high to low, where higher scores indicate stronger semantic relevance; 304) Select the top K candidate questions with the highest similarity scores, i.e., the top K candidate questions, as the candidate questions most likely to match the user's needs.

[0014] Furthermore, in step S4, the screened top K candidate questions and their corresponding answers are input into the pre-trained large language model, and the generation process is constrained by a semantically guided prompt template to generate optimized natural language answers; in the semantically guided prompt template, the large prediction model is constrained to answer based on the user question and the standard answer texts corresponding to the top K candidate questions, thereby guiding the large language model to use the existing knowledge base content to generate more accurate and detailed replies; the large language model is deployed on a local server for training and fine-tuning as needed.

[0015] Furthermore, in step S5, the generated answer is submitted to the manual review module for content verification. After the review is passed, the final answer is sent to the user, and the new question and answer pairs that have passed the review are added to the FAQ knowledge base in real time to complete the dynamic update of the knowledge base.

[0016] Furthermore, the review rules of the manual review module include: A1) Score the emotional soothingness and professional accuracy of the generated answers; A2) If the score is below the preset threshold, the psychological counselor will manually revise the answer; A3) The revised answer is stored in conjunction with the user's question and added to the FAQ knowledge base as a new entry.

[0017] Furthermore, the update mechanism of the FAQ knowledge base includes: B1) Perform deduplication verification on newly added question and answer pairs to avoid duplicate entries in the database; B2) Regularly eliminate inefficient question-answer pairs from the knowledge base. The elimination rules are based on historical answer adoption rates and manual scoring.

[0018] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor implements the above method when executing the computer program.

[0019] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program implements the above method when executed by a processor.

[0020] Compared with the prior art, the present invention has the following beneficial effects: 1. Improved retrieval accuracy: Thanks to the introduction of synonym expansion and semantic vector matching, the system provides a more comprehensive understanding of user questions, significantly improving the recall rate of semantically relevant questions. Regardless of how students phrase their questions, the platform can identify their true intent and find the corresponding answer, avoiding previous retrieval failures due to wording discrepancies. Tests have shown that this method can significantly increase the hit rate of useful answers compared to traditional FAQ matching methods.

[0021] 2. Enhanced naturalness of responses: Leveraging a large language model to generate and polish responses, responses are more fluent and closer to human expression. System-generated responses are not only accurate but also contextually coherent and emotionally charged, reading more like thoughtful advice from a consultant. This natural, fluent response style improves the user experience, fostering a stronger sense of empathy and understanding during communication, significantly boosting student satisfaction.

[0022] 3. Multi-round complex semantic support: The architecture of the present invention has good scalability and can support multi-round dialogues and complex semantic scenarios. In actual applications, students often have multiple question-and-answer interactions with the platform on the same topic. By accumulating contextual semantics in prompts and leveraging the support of knowledge bases and knowledge graphs, this system can understand the relationship between previous and subsequent questions and still provide coherent and targeted answers when asking subsequent questions. When students' questions involve multiple sub-topics or require reasoning, the system can also use the reasoning capabilities of knowledge graphs and large models to give answers that comprehensively consider multiple factors. This enables the platform to handle more complex and in-depth psychological counseling dialogue scenarios.

[0023] 4. Response Efficiency and Professionalism: By combining intelligent search and generation, the platform ensures high-quality answers while maintaining a high response speed. After a student asks a question, the system quickly finds candidate answers from the vast knowledge base and, using AI, quickly generates customized responses. This entire process is completed in real time, meeting the timeliness requirements of online consultations. Furthermore, the generated answers reflect the experience of professional counselors (especially when the knowledge base continuously draws on answers provided by experts), ensuring the scientific and reliable nature of the advice. The platform also incorporates a built-in compliance review mechanism and manual audit process to prevent inappropriate comments and ensure a safe and controllable service process. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 This is an implementation architecture diagram of the semantic hybrid retrieval and re-ranking method provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0026] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present application belongs.

[0027] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.

[0028] like Figure 1 As shown, this embodiment provides a semantic hybrid retrieval and re-ranking method for intelligent psychological counseling for primary and secondary school students, which specifically includes the following steps: S1. Question preprocessing: Receive Chinese psychological counseling questions input by users, preprocess them, extract a set of keywords that can represent the core semantics of the questions, and convert them into standardized Chinese semantic representations; the specific implementation method is as follows: 101) Segment the Chinese psychological counseling questions input by the user and tag all the words using part-of-speech tagging technology. Then, extract keywords including nouns and verbs, filter out stop words, and obtain a set of keywords that can represent the core semantics of the question. 102) Synonym expansion is performed on the extracted keywords through a predefined synonym dictionary, and the keywords are mapped into standard vocabulary expressions, thereby converting the user's natural language questions into standardized Chinese semantic representations.

[0029] S2. Candidate matching retrieval: Based on a hybrid retrieval technology that includes keyword matching and semantic indexing, a candidate set of questions and answers related to the user's question is retrieved from the FAQ knowledge base. The specific implementation method is as follows: 201) Perform preliminary matching retrieval in the FAQ knowledge base based on keyword matching, retrieve candidate questions with a relevance to the user question higher than a set value from the FAQ knowledge base, and obtain a preliminary candidate question and answer set; 202) Use the pre-trained word vector model to convert the user question into a vector, and retrieve several candidate questions and corresponding candidate answers in the vector space whose semantic distance to the vector is less than a set value based on vector similarity; 203) Combining the retrieval results obtained in step 201) and step 202) to obtain a mixed candidate question and answer set.

[0030] S3. Semantic vectorization and similarity calculation: This involves embedding the user question and each candidate question and answer into word vectors, calculating the similarity between the user question vector and each candidate question vector, and reordering the candidate questions from high to low based on the similarity score to select the top K candidate questions. The specific implementation method is as follows: 301) Perform word vector embedding on the user question and each candidate question in the candidate question and answer set to obtain the corresponding vectorized semantic representation, i.e., the user question vector and the candidate question vector; 302) Calculate the cosine similarity between the user question vector and each candidate question vector to measure the degree of semantic matching between the user question and each candidate question; 303) Re-rank all candidate questions based on their similarity scores from high to low, where higher scores indicate stronger semantic relevance; 304) Select the top K candidate questions with the highest similarity scores, i.e., the top K candidate questions, as the candidate questions most likely to match the user's needs.

[0031] S4. Generative answering: The top K candidate questions and their corresponding answers are input into the pre-trained large language model, and the generation process is constrained by semantically guided prompt templates to generate optimized natural language answers.

[0032] In the semantically guided prompt template, the constrained large prediction model combines the user's question and the standard answer text corresponding to the top K candidate questions to answer, thereby guiding the large language model to use the existing knowledge base content to generate more accurate and detailed responses.

[0033] S5. Answer verification optimization: perform semantic integrity and context consistency verification on the generated answers and output the final answer.

[0034] Specifically, the generated answers are submitted to the manual review module for content verification. After passing the review, the final answers are sent to the user, and the new question-answer pairs that pass the review are added to the FAQ knowledge base in real time to complete the dynamic update of the knowledge base. The review rules of the manual review module include: A1) Score the emotional soothingness and professional accuracy of the generated answers; A2) If the score is below the preset threshold, the psychological counselor will manually revise the answer; A3) The revised answer is stored in conjunction with the user's question and added to the FAQ knowledge base as a new entry.

[0035] The update mechanism of the FAQ knowledge base includes: B1) Perform deduplication verification on newly added question and answer pairs to avoid duplicate entries in the database; B2) Regularly eliminate inefficient question-answer pairs from the knowledge base. The elimination rules are based on historical answer adoption rates and manual scoring.

[0036] The following is a further explanation of the relevant contents involved in this method.

[0037] 1. Problem Preprocessing The system receives inquiries from students, performs word segmentation on the Chinese input questions, and uses part-of-speech tagging technology to identify key components such as nouns and verbs. It also uses a pre-built synonym dictionary to expand the word segmentation results into synonyms, mapping the key information in the questions to standard vocabulary expressions to alleviate matching difficulties caused by different expressions. This process also filters out common function words or stop words to extract a set of keywords that can represent the core semantics of the question. After these preprocessing steps, the user's natural language questions are converted into standardized Chinese semantic representations, laying the foundation for subsequent retrieval.

[0038] 2. Candidate Match Retrieval The keywords and extended vocabulary of the question are used to query the FAQ question and answer knowledge base. The knowledge base stores a large number of psychological counseling question and answer pairs, including common questions asked by students and the corresponding standard answers. The system first performs a preliminary matching search based on keywords to quickly screen out a set of candidate questions that are highly relevant to the user's questions. At the same time, the system can query the knowledge base in combination with semantic indexing technology: for example, using a trained word vector model to convert user questions into vectors, and searching for several candidate questions with close semantic distances in the vector space. This hybrid retrieval strategy combines the advantages of keyword matching and semantic similarity retrieval to ensure that potential related questions and answers with different expressions but similar meanings are not missed. After this step, the system obtains a list of candidate questions, which contains several known questions and answers that may be semantically consistent with the user's questions.

[0039] 3. Semantic vectorization and similarity calculation For the above-mentioned set of candidate questions, the system further introduces a semantic vector re-ranking mechanism. Specifically, the user question and each candidate question are respectively represented by word vector embedding to obtain the corresponding vectorized semantic representation (for example, sentence vectors are generated using embedding models such as Word2Vec and BERT). The cosine similarity between the user question vector and each candidate question vector is then calculated to measure their degree of semantic matching. The candidate questions are sorted according to the similarity score, and the higher the value, the stronger the semantic relevance. The system selects the top K questions with the highest similarity as the candidates most likely to match user needs. Through this re-ranking process based on word vector cosine similarity, interference items that rely only on a few identical keywords but are not really semantically related can be effectively eliminated, ensuring that the final selected candidate questions and answers are highly semantically consistent with the user's questions.

[0040] 4. Generative Answers For the top K candidate questions and answers selected through semantic rearrangement, the system utilizes a large language model to generatively supplement and optimize the responses. First, the answer text corresponding to each candidate question is extracted from the FAQ knowledge base. These answers, along with the user's current question, form prompts and are fed into a pre-trained large language model (LLM). Furthermore, the system can design semantically guided prompt templates, explicitly requiring the model to respond based on the provided candidate answers and the user's question. This guides the large language model to utilize the existing knowledge base content to generate more accurate and detailed responses. The models integrated in this invention are domestically developed large language models (e.g., Baidu's "Wenxin Yiyan" and Alibaba's "Tongyi Qianwen"), which can understand and generate Chinese sentences. The system inputs the user's question, the selected relevant Q&A content, and pre-set system prompts into the model, triggering it to generate natural language responses. For questions already covered in the knowledge base, this process serves as a linguistic polish and personalized representation of the existing standard answers. For new questions not directly covered in the knowledge base, the large language model uses its own training knowledge to generate inferences and provide helpful suggestions to the extent possible. The generative AI module ensures that the language of the final response is more vivid and fluent, and can be integrated with multiple reference information to make the answer more in line with the context of the student's question.

[0041] 5. Answer verification optimization After the large language model generates a preliminary response, the system verifies and optimizes its semantic integrity and contextual consistency. One approach is to leverage the model's own feedback mechanism or additional rules to make secondary adjustments to the response, such as eliminating ambiguities and supplementing missing information, to ensure that the response is semantically coherent and closely addresses the user's question. If the platform includes human counselors (such as psychology teachers) for review, the generated answer is submitted to the teacher for confirmation and appropriate revision. The teacher can refer to the model's response and fine-tune the content based on their own experience to ensure that the response is professional, accurate, and relevant to the student's specific situation. The final confirmed answer is sent to the student through the platform, completing one round of consultation and Q&A service. Furthermore, the system supports the real-time addition of valuable new Q&A pairs to the FAQ knowledge base, dynamically expanding the knowledge base. The results of each student consultation, after teacher review and confirmation, can be fed back into the knowledge base as new knowledge, gradually expanding the range of questions the platform can answer. This iterative mechanism enables the system to continuously learn and grow during use, making retrieval and generation more efficient and accurate for similar questions in the future.

[0042] The semantic hybrid retrieval and re-ranking method for intelligent psychological counseling for primary and secondary school students provided by this invention has several key innovations and advantages in technology: 1. Semantic Reranking with Word Vectors: This approach uses word vector representations and cosine similarity calculations to reorder candidate answers obtained from the initial search by semantic relevance. Compared to traditional matching methods that rely solely on keywords, this vectorized reranking can identify synonyms and semantic similarities, significantly improving matching accuracy and ensuring that search results are sorted by semantic relevance rather than literal similarity.

[0043] 2. Hybrid Q&A combining retrieval and generation: This approach utilizes a hybrid retrieval-generation architecture (introducing RAG, Retrieval-Augmented Generation) to organically integrate knowledge base retrieval with large language model generation. When the knowledge base has an answer, the retrieval results guide the generative model's response. When the knowledge base lacks a direct answer, the generative model creatively generates responses. This hybrid strategy combines the advantages of both approaches: it ensures that answers are based on facts in the knowledge base while leveraging generative AI to provide richer and more natural expressions, achieving a balance between retrieval accuracy and generation flexibility.

[0044] 3. Semantically guided prompt mechanism: A semantically guided prompt strategy was designed for interacting with large language models. By incorporating contextual information, such as selected relevant questions and answers, into the prompts, the model is guided to draw on this semantically relevant content when answering, preventing the model from randomly generating answers that are detached from existing knowledge. This mechanism effectively builds a bridge between the model and the knowledge base, constraining and guiding the generated results within the semantic constraints of the knowledge base, thereby improving the relevance and reliability of the answers. Compared to allowing the model to generate answers freely, this semantically guided approach effectively reduces content bias, ensuring that answers are relevant and appropriate for the counseling context.

[0045] 4. Integration and compliance of domestic large models: The present invention preferably integrates domestic large-scale language models as generation engines, such as Chinese pre-training models developed by institutions such as Baidu and iFlytek. Compared with relying on overseas models, this solution has more advantages in data security and usage compliance, which can ensure that students' sensitive question data does not leave the country and meets relevant regulatory requirements. In addition, domestic models have been optimized in the Chinese field, and they better understand the tone and habits of adolescent psychological counseling conversations in the Chinese context, and the wording is more in line with local culture. Locally deployed large models can also be specially trained and fine-tuned as needed, so as to provide customized psychological counseling answer services with higher efficiency.

[0046] 5. Dynamic expansion of the knowledge base: Supporting continuous updating and iteration of the FAQ knowledge base is also a major feature of the present invention. The system will promptly integrate high-quality question and answer pairs added during operation back into the knowledge base, continuously enriching the content of the knowledge base. This dynamic expansion mechanism means that the platform's knowledge coverage will expand with use, avoiding the problem of solidified and outdated knowledge bases in traditional systems. Over time, the types of questions that the platform can answer and the accuracy will gradually improve, and new questions can also be quickly collected and answered, forming a virtuous self-optimization cycle.

[0047] This embodiment further provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor implements the above method when executing the computer program.

[0048] This embodiment further provides a computer-readable storage medium storing a computer program, which implements the above method when executed by a processor.

[0049] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0050] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0051] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0052] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0053] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any other manner. Any person skilled in the art may utilize the above-disclosed technical content to modify or modify the present invention into equivalent embodiments. However, any simple modifications, equivalent variations, and modifications to the above embodiments that do not depart from the technical content of the present invention and are based on the technical essence of the present invention remain within the scope of protection of the present invention.

Claims

1. A semantic hybrid retrieval and re-ranking method for intelligent psychological counseling for primary and secondary school students, characterized by: The following steps are involved: S1. Receive Chinese psychological counseling questions input by users, pre-process them, extract a set of keywords that can represent the core semantics of the questions, and convert them into standardized Chinese semantic representations; S2. Based on a hybrid retrieval technology including keyword matching and semantic indexing, a candidate question and answer set related to the user's question is retrieved from the FAQ knowledge base; S3. Embed the user question and each candidate question and answer into word vectors, calculate the similarity between the user question vector and each candidate question vector, and re-rank the candidate questions from high to low based on the similarity score to select the top K candidate questions. S4: Input the top K candidate questions and their corresponding answers into the pre-trained large language model to generate optimized natural language answers; S5. Check the semantic integrity and context consistency of the generated answer and output the final answer.

2. The semantic hybrid retrieval and re-ranking method for intelligent psychological counseling for primary and secondary school students according to claim 1 is characterized in that: In step S1, the implementation method of pre-processing the Chinese psychological counseling questions input by the user is as follows: 101) Segment the Chinese psychological counseling questions input by the user and tag all the segmented words using part-of-speech tagging technology. Then, extract keywords including nouns and verbs, filter out stop words, and obtain a set of keywords that can represent the core semantics of the question. 102) Synonym expansion is performed on the extracted keywords through a predefined synonym dictionary, and the keywords are mapped into standard vocabulary expressions, thereby converting the user's natural language questions into standardized Chinese semantic representations.

3. The semantic hybrid retrieval and re-ranking method for intelligent psychological counseling for primary and secondary school students according to claim 1 is characterized in that: In step S2, the method for retrieving a candidate question-answer set related to the user's question from the FAQ knowledge base is as follows: 201) Perform preliminary matching retrieval in the FAQ knowledge base based on keyword matching, retrieve candidate questions with a relevance to the user question higher than a set value from the FAQ knowledge base, and obtain a preliminary candidate question and answer set; 202) Use the pre-trained word vector model to convert the user question into a vector, and retrieve several candidate questions and corresponding candidate answers in the vector space whose semantic distance to the vector is less than a set value based on vector similarity; 203) Combining the retrieval results obtained in step 201) and step 202) to obtain a mixed candidate question and answer set.

4. The semantic hybrid retrieval and re-ranking method for intelligent psychological counseling for primary and secondary school students according to claim 1 is characterized in that: The specific implementation method of step S3 is: 301) Perform word vector embedding on the user question and each candidate question in the candidate question and answer set to obtain the corresponding vectorized semantic representation, i.e., the user question vector and the candidate question vector; 302) Calculate the cosine similarity between the user question vector and each candidate question vector to measure the degree of semantic matching between the user question and each candidate question; 303) Re-rank all candidate questions based on their similarity scores from high to low, where higher scores indicate stronger semantic relevance; 304) Select the top K candidate questions with the highest similarity scores, i.e., the top K candidate questions, as the candidate questions most likely to match the user's needs.

5. The semantic hybrid retrieval and re-ranking method for intelligent psychological counseling for primary and secondary school students according to claim 1 is characterized in that: In step S4, the top K candidate questions and their corresponding answers are input into the pre-trained large language model, and the optimized natural language answers are generated through the semantically guided prompt template constraint generation process; In the semantically guided prompt template, the large prediction model is constrained to answer the user's question and the standard answer text corresponding to the top K candidate questions, thereby guiding the large language model to use the existing knowledge base content to generate more accurate and detailed responses; The large language model is deployed on a local server for training and fine-tuning as needed.

6. The semantic hybrid retrieval and re-ranking method for intelligent psychological counseling for primary and secondary school students according to claim 1 is characterized in that: In step S5, the generated answer is submitted to the manual review module for content verification. After the review is passed, the final answer is sent to the user, and the new question and answer pairs that have passed the review are added to the FAQ knowledge base in real time to complete the dynamic update of the knowledge base.

7. The semantic hybrid retrieval and re-ranking method for intelligent psychological counseling for primary and secondary school students according to claim 6 is characterized in that: The review rules of the manual review module include: A1) Score the emotional soothingness and professional accuracy of the generated answers; A2) If the score is below the preset threshold, the psychological counselor will manually revise the answer; A3) The revised answer is stored in conjunction with the user's question and added to the FAQ knowledge base as a new entry.

8. The semantic hybrid retrieval and re-ranking method for intelligent psychological counseling for primary and secondary school students according to claim 6 is characterized in that: The update mechanism of the FAQ knowledge base includes: B1) Perform deduplication verification on newly added question and answer pairs to avoid duplicate entries in the database; B2) Regularly eliminate inefficient question-answer pairs from the knowledge base. The elimination rules are based on historical answer adoption rates and manual scoring.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.

10. A computer-readable storage medium, characterized in that A computer program is stored, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • A question-and-answer pair retrieval method and a community question-and-answer retrieval system

    CN105786794B

Cited By

  • Large-scale language model knowledge extraction method and system without retrieval assistance

    CN121255967A

  • Electric power intelligent knowledge retrieval method based on RAG model

    CN121365127A

  • Long video understanding method and device and storage medium

    CN122024146A

  • FAQ knowledge base closed-loop optimization method based on million-level user message data

    CN122064792A

  • Mental health detection method and device based on large model fine granularity enhancement and medium

    CN122088713A