This application provides an error-driven self-correcting answer generation method, apparatus, device, and medium, applicable to the financial or medical fields. The method includes: segmenting documents in a target
knowledge base to obtain a benchmark dataset; acquiring data to be answered and generating preliminary answer data based on the benchmark dataset and the data to be answered using a RAG model; inputting the benchmark dataset and the preliminary answer data into a preset error assessment model for classification and evaluation to obtain a first target error type and a comprehensive
score for a first evaluation index, and determining whether self-correction is needed based on the comprehensive
score for the first evaluation index; if self-correction is needed, inputting the benchmark dataset, the preliminary answer data, the first target error type, and the comprehensive
score for the first evaluation index into a preset self-correction model to generate a self-correction task; and regenerating the target answer data based on the self-correction task using the RAG model. This allows for self-correction during answer generation, improving
system reliability.