The invention discloses an optimized RAG-based
urban rail transit emergency field question and answer method and
system, and relates to the technical field of
artificial intelligence, and the method comprises the steps: firstly
rewriting a user question into a new question conforming to an
urban rail transit style, and then analyzing different types of documents in a
knowledge base; then, the document is segmented, vector embedding is carried out, and meanwhile, a new problem is converted into a vector; then, by calculating the similarity between a problem vector and a document block vector, the most relevant document block is selected to form a recall set; then, a cross
encoder is used for reordering the recalled documents, and the most relevant documents are selected to form a rearranged document set; and finally, inputting the new question and the rearranged document set into the fine-tuned large
language model to generate a final answer. According to the method, through a large
language model of question
rewriting, accurate
document segmentation and vectorization, multi-level retrieval and rearrangement and field fine adjustment, the accuracy and correlation of
question answering in the
urban rail transit emergency field are remarkably improved, and more professional and reliable intelligent
question answering service is achieved.