Machine Reading Comprehension(MRC) aims to enable machines to independently reason and extract information and answer questions. This study proposes improvements based on the Bidirectional Attention Flow(BiDAF) model to enhance the accuracy and efficiency of the question-answering system.Firstly, the BiDAF model imposes constraints on text length during modeling, which may lead to the loss of answers when processing long texts. To address this issue, a sliding window mechanism is introduced to retain excessive information within the same text. Secondly, due to the use of Long Short Term Memory (LSTM) in the model, it is difficult for the model to capture distant time step information, resulting in long-term dependence issues and poor parallelization capability; Based on this, an Encoder model based on self-attention mechanism is used to extract text information. Finally, for the limited length, the method of matching within the group and external sorting outside the group is designed to obtain the position information of model training. Test results of the improved BiDAF model on the public dataset SQuAD show that the F1 score and Exact Match (EM) rate have increased by 2.48 percentage points and 11.86 percentage points respectively compared with the traditional BiDAF model.