Intelligence education is the key research direction of artificial intelligence. The most important is to describe the students’ cognitive process by ultilizing the knowledge points in the test questions. Aiming at the problem that the cognitive diagnosis model is insufficient for mining students, test questions and their interactive information, this study proposed a cognitive diagnosis model integrating forgetting and the importance of knowledge points. According to the historical interaction between the test questions and knowledge points, the model introduces forgetting factors in combination with the difficulty information of knowledge points, thus alleviates the problem of insufficient information mining for students. Through the attention mechanism, the importance information of the test questions to the knowledge points was obtained to alleviate the problem of insufficient information mining of the test questions. Learning the interaction relation between students and test questions through Transformer alleviates the problem of insufficient interaction information between students and test questions. The results of experiments carried out on the classic dataset show that the accuracy Acc, root mean square error (RMSE), and the area under curve (AUC) values of this method on the Math1, Math2, and Assistment datasets are 0.716, 0.445, 0.776, 0.725, 0.432, 0.807, 0.741, 0.427, 0.779, respectively. Compared with other existing models, the proposed method has better results. The proposed method illustrates the importance of knowledge importance and timeliness for cognitive modeling.