The invention discloses a big
language model illusion detection method and
system, and relates to the technical field of
natural language processing and
artificial intelligence. Comprising the steps that 1, a question and answer
data set is selected, twenty internal state vectors generated when a large
language model generates answers to an input question are extracted, and the internal state vectors are semantic coding vectors of a
hidden layer in the model reasoning process; 2, the twenty internal state vectors are constructed into a sample matrix, and a
covariance matrix of the sample matrix is calculated; 3, calculating a standardized
determinant of the
covariance matrix, wherein the standardized
determinant is a twentieth-power root of
a determinant value of the
covariance matrix; 4, taking the obtained standardized
determinant value as a feature F1, and taking the token number of the answer output by the large
language model as a feature F2; 5, training a
support vector machine dichotomy model by using the question and answer
data set, wherein labels of training samples are illusion or non-illusion; and step 6, inputting F1 and F2 into the trained
support vector machine dichotomy model, and outputting a hallucination or non-hallucination detection result.