This invention discloses a method and
system for constructing a dynamic
loss function for large-scale models based on cognitive memory strength, belonging to the fields of large-
scale model training optimization and cognitive dynamics. Existing large-
scale model training generally employs a fixed cross-entropy
loss function, using equal weights for all tokens in the supervision process. This fails to distinguish between key
semantics, logical cores, and redundant padding information in the text, resulting in insufficient supervision of core
semantics,
overfitting of redundant information, gradient imbalance during long text training, and accumulation of cognitive biases in the model. Consequently, the model suffers from weak logical ability,
poor memory of key information, and frequent hallucinations. This invention, based on an original cognitive memory dynamics mechanism, constructs a dynamically weighted
loss function. It allocates training weights in real-time according to the four-dimensional spatiotemporal attributes and memory strength of each token, applying high weights to logical cores, key
temporal information, and core
semantics of the context, while applying low weights to redundant padding, invalid repetitions, and
noise information. This invention breaks away from the traditional equal supervision mode of fixed loss, achieving a training process that aligns with the laws of human cognitive memory, matching the principle of minimum action in field theory, significantly improving the model's core semantic fitting ability, long text cognitive stability, and
logical reasoning accuracy, thus reducing the model hallucination problem at its root.