Large language model social attitude cross-period prediction method based on timing prior correction
Patent Information
- Application Number
- CN202611211224.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-11
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2046-08-11
AI Technical Summary
此外,若为每一道新入卷题目重新执行一遍微调,需要占用大量图形处理器训练算力、更新并存储相应的适配器权重与优化器状态,开销随题目轮换持续累积
[0029] First, cross-topic generalization. This invention diagnoses prediction failures on unseen topics as prior bias and implements targeted corrections. On three multinational panel datasets, the prediction accuracy of the method for unseen topics is no lower than that of the fine-tuned model itself and the persistent baseline, and significantly outperforms it in most combinations.
Smart Images

Figure CN122735770B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of artificial intelligence and computational social science, and in particular relates to a method for intertemporal prediction of social attitudes based on a large language model with temporal prior correction. Background Technology
[0002] Using large language models to simulate respondents' responses to survey questions is becoming an important technical means of risk warning. Supervised fine-tuning of large language models can read demographic profiles of respondents and the text of the questions, accurately reproducing respondents' answers at the current point in time. However, existing technologies are generally static and cross-sectional, providing "how the respondent answered now," but unable to answer "how the respondent will answer in the future."
[0003] The real world is characterized by a dual dynamism. First, respondents change. Individual attitudes evolve year by year under the impact of economic changes and social events, making intertemporal prediction a panel data problem rather than a cross-sectional one. Second, questionnaires also change. Each round of a follow-up survey involves the addition and removal of questions. After new questions are added, decision-makers often want to immediately obtain the prediction results for all respondents in the next few waves, rather than fine-tuning the large language model for each new question. Current technology cannot simultaneously bridge the two generalization dimensions of "time" and "question." More importantly, when the fine-tuned large language model is directly used for intertemporal prediction, it performs well on questions already covered in the training, but exhibits systematic category marginal inaccuracies on new questions not covered in the training. The predicted probabilities of all respondents for the same question shift in the same direction, and group averaging cannot eliminate this shift, while the relative ranking among respondents within the same question remains effective.
[0004] Existing remedies fail to address the aforementioned issues. Methods such as Kalman filtering, Bayesian probabilistic fusion, post-hoc temperature calibration, and internal characterization probes all assume zero-mean observation noise and address only the variance component of the error. Furthermore, based on mean squared error decomposition, these methods cap their effectiveness in scenarios dominated by systematic bias. Existing class prior re-estimation methods either rely on a labeled source-domain validation set to estimate the confusion matrix or use the model's own output as an anchor point for expectation maximization iterations. However, when the model prior itself exhibits systematic bias, the iteration anchor point becomes unreliable, making both methods difficult to directly apply to intertemporal prediction scenarios where the target answer is completely unknown. Traditional time series models (logistic regression, long short-term memory networks, etc.) only read numerical sequences and cannot interpret the semantics of the question text, lacking the ability to generalize to new questions. Zero-shot inference for cutting-edge commercial large language models also consistently falls below the baseline in various tests. Moreover, re-tuning for each new question requires significant GPU training resources to update and store the corresponding adapter weights and optimizer states, with overhead accumulating as questions are rotated. Therefore, there is an urgent need for a method for intertemporal prediction of social attitudes that can eliminate the systematic category prior bias of large language models on unseen items, without changing the parameters of large language models, and can be deployed after only one wave of testing on new items. Summary of the Invention
[0005] The technical problems to be solved by this invention specifically include: first, the output probability of a frozen neural network model on the out-of-train distribution input is systematically biased, leading to unreliable output data from the computer system; second, retraining the large language model item by item causes computational and storage overhead, which accumulates linearly with the number of items. To address these issues, this invention proposes a method for intertemporal prediction of social attitudes using a large language model based on temporal prior correction. This method constructs a unified temporal prior correction framework consisting of two components: a temporal observer and a test-time corrector. The frozen supervised fine-tuned large language model is modeled as a temporal observer, its failure on unseen items is attributed to an estimable and eliminable prior bias, and the inherent temporal structure of panel data is used as a correction benchmark. Without altering any model parameters, the test-time corrector performs Bayesian prior correction on the observed readings, achieving robust prediction across items and waves.
[0006] To achieve the above-mentioned objectives, the present invention specifically adopts the following technical solution:
[0007] In a first aspect, the present invention provides a method for intertemporal prediction of social attitudes using a large language model based on temporal prior correction, comprising the following steps:
[0008] S1. Obtain a multi-wave panel survey dataset containing multiple time-series samples. Each time-series sample includes a respondent profile, the target question text, the respondent's answer trajectory to the target question in historical waves, and the target wave to be predicted.
[0009] S2. The large language model trained in a supervised fine-tuning manner is used as a temporal observer, and all parameters are frozen; the temporal samples are converted into temporal prompts and then input into the temporal observer. The temporal observer outputs the category probability distribution of the respondents' answers to the target questions in the target wave as the observation reading.
[0010] S3. The test-time corrector performs temporal prior correction for each target item: First, it obtains the temporal empirical prior based on the model's implicit prior and the last observation margin corresponding to the target item; if the target item meets the silent gating condition, the test-time corrector is silent and directly uses the observed readings as the social attitude prediction results; if the target item does not meet the silent gating condition, it is determined that the temporal observer has a prior bias on the target item, and Bayesian updates are used to reweight and normalize the observation readings of each respondent under the target item category by category, re-anchoring the observation readings to the temporal empirical prior, obtaining the corrected prediction distribution, and taking the category with the highest probability as the social attitude prediction result for each respondent;
[0011] S4. Deploy the time series observer and test-time corrector on the social attitude prediction platform. When the social attitude prediction platform receives the prediction request sent by the client, it outputs the social attitude prediction results of the respondents and returns them to the client along with the prior offset diagnosis report of the target topic, so as to achieve robust prediction across topics and waves.
[0012] Based on the above scheme, each step can be implemented in the following preferred manner.
[0013] As a preferred embodiment of the first aspect mentioned above, in S1, the interviewee profile includes static attribute dimensions and time-varying attribute dimensions; the static attribute dimensions include one or more of the following: gender dimension, year of birth dimension, urban / rural classification dimension, and highest education level dimension; the time-varying attribute dimensions include one or more of the following: age dimension, marital status dimension, employment status dimension, and income level dimension, and the values of the time-varying attribute dimensions correspond one-to-one with each historical wave in the response trajectory.
[0014] As a preferred embodiment of the first aspect mentioned above, in S2, the time-series prompt consists of a respondent information area, a question area, a historical answer area, a target wave row, and an option area: the respondent information area is used to provide a structured natural language description of the static attributes in the respondent profile; the question area is used to display the target question; the historical answer area is used to list the year of each historical wave, the value of the attribute that changes over time for that historical wave, and the category in which the target question was answered in that historical wave in chronological order; the target wave row is used to provide the year of the target wave and the value of the attribute that changes over time for that target wave; the option area is used to provide multiple candidate categories that can be selected when answering the target question, and the order of the candidate categories is randomly permuted to suppress the positional bias of the large language model.
[0015] As a preferred embodiment of the first aspect above, in S3, the implicit prior of the model is obtained by calculating the arithmetic mean of the observation readings of all respondents under the target question for each category; the last observation margin is obtained by statistically analyzing the frequency of each category when all respondents answer the target question in the last observation of their answer trajectory.
[0016] As a preferred embodiment of the first aspect mentioned above, in S3, the temporal empirical prior is obtained by: based on the marginal stationarity of the attitude process, using the last observed margin as the marginal estimate of the target wave, and using the model's implicit prior as the contraction center and the pseudo-counting parameter to control the contraction intensity, performing Dirichlet contraction to obtain the temporal empirical prior.
[0017] Furthermore, the temporal empirical prior is constructed using the following formula:
[0018]
[0019] in, For the target question Temporal experience priors in categories The value of ; For the target question The number of respondents who participated in the statistics; For the target question The model implicit priors in categories The value of ; For the target question The last observed margin in category The value of ; The pseudo-count parameter for Dirichlet contraction.
[0020] As a preferred embodiment of the first aspect above, in S3, the method for determining whether the target question meets the silent gating condition is as follows: the training set used when training the large language model is used as the training coverage question set; if the target question belongs to the training coverage question set, the corrector is silent during testing; if the target question does not belong to the training coverage question set, the offset between the model's implicit prior and the temporal empirical prior is measured by the total variation distance; when the offset does not exceed a preset threshold, the corrector is silent during testing; when the offset exceeds the preset threshold, the Bayesian update is performed; the threshold is determined by taking the high quantile of the offset distribution of the training coverage question set.
[0021] As a preferred approach to the first aspect mentioned above, in the Bayesian update of S3, the ratio of temporal empirical prior to model implicit prior is used. The power of a number is used as a weighting factor. These are the preset correction strength parameters.
[0022] As a preferred embodiment of the first aspect mentioned above, in S4, the social attitude prediction platform includes a server and a panel survey database; the server is a physical server or a cloud server, in which a time-series observer and a test-time corrector are deployed; the panel survey database is used to store the respondents' answer trajectories and respondents' profiles for the target questions in historical waves; when the server receives a prediction request sent by the client, it parses the target question and target wave carried in the prediction request, reads the corresponding answer trajectories and respondents' profiles from the panel survey database, outputs the observation readings through the time-series observer according to step S2, performs time-series prior correction by the test-time corrector according to step S3, and finally returns the respondents' social attitude prediction results and the prior offset diagnosis report of the target questions to the client.
[0023] In a second aspect, the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, can realize the intertemporal prediction method for social attitudes based on temporal prior correction of a large language model as described in any of the solutions of the first aspect above.
[0024] Thirdly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the intertemporal prediction method for social attitudes based on temporal prior correction of a large language model as described in any of the solutions of the first aspect above.
[0025] Fourthly, the present invention provides a computer electronic device, which includes a memory and a processor;
[0026] The memory is used to store computer programs;
[0027] The processor is configured to, when executing the computer program, implement the intertemporal prediction method for large language models based on temporal prior correction as described in any of the above-described first aspects.
[0028] Compared with the prior art, the present invention has the following advantages:
[0029] First, cross-topic generalization. This invention diagnoses prediction failures on unseen topics as prior bias and implements targeted corrections. On three multinational panel datasets, the prediction accuracy of the method for unseen topics is no lower than that of the fine-tuned model itself and the persistent baseline, and significantly outperforms it in most combinations.
[0030] Second, the invention features strict non-inferiority and self-decaying closed-loop properties within the distribution. Through a gating mechanism, the corrector automatically becomes silent and degenerates into an identity mapping during testing on the training covered topics, ensuring that the output is completely consistent with the fine-tuned model. This guarantees that introducing the method of this invention will not cause performance loss on any covered topics. More importantly, this invention links the prior construction centered on the model's implicit prior, the prior ratio reweighting, and the gating mechanism. The correction strength adaptively decays with the degree of deviation and the amount of evidence. This closed-loop property is not a simple summation of the effects of various methods.
[0031] Third, cold-start deployment capability. For new questions, predictions for multiple subsequent waves can be output after only one test. Moreover, on the dataset with the most severe prior bias (NIDS), the shorter the historical waves, the more severe the prior bias of the time series observer. However, the gain brought by correction is actually greater when the historical waves do not exceed two. That is, the corrector has the greatest value at the weakest point of the time series observer during testing.
[0032] Fourth, it is model-independent and has extremely low overhead. During testing, the corrector only consumes the class probability distribution output by the time series observer, without reading or modifying any model parameters; the correction of each question only requires a set of population statistics, and the computational complexity is linearly related to the number of samples. It is deployed as a lightweight post-processing module, which can be plugged and played to adapt to open source and closed source large language models that expose word probabilities; when a new question is added, there is no need to occupy the graphics processor training resources again, and the additional storage of adapter weights and optimizer states is also eliminated.
[0033] Fifth, interpretability. The correction coefficients themselves constitute a readable diagnostic report, providing the offset and prior deviation factor for each category for each item, and can be summarized into a prior offset map, revealing on which category of items the observer drifts the most. Attached Figure Description
[0034] Figure 1 This is an overall flowchart of the method of the present invention;
[0035] Figure 2 This is a schematic diagram illustrating the shift in the model's implicit prior in this embodiment;
[0036] Figure 3 This is a schematic diagram illustrating the use of timing experience priors as a correction benchmark in this embodiment;
[0037] Figure 4 This is a schematic diagram illustrating the mechanism of Bayesian update in this embodiment;
[0038] Figure 5 This is a schematic diagram illustrating the application process of the method of the present invention;
[0039] Figure 6 This is a comparison chart showing the accuracy of predictions for questions not seen in this embodiment;
[0040] Figure 7 This is a schematic diagram of a computer electronic device provided by the present invention. Detailed Implementation
[0041] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. Technical features in various embodiments of the present invention can be combined accordingly without mutual conflict.
[0042] In the description of this invention, it should be understood that the terms "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first" and "second" may explicitly or implicitly include at least one of those features.
[0043] Before describing the method of the present invention, the terms and concepts involved in this embodiment will be explained.
[0044] Social attitudes: The evaluations, tendencies, or subjective feelings that respondents hold about social issues, social phenomena, or their personal life situations, and are represented by discrete response categories to survey questions.
[0045] Large Language Model (LLM): refers to a deep learning language model with a large number of parameters. It obtains general language understanding and generation capabilities through pre-training on a large corpus and can be fine-tuned to adapt to downstream tasks.
[0046] Supervised Fine-Tuning (SFT) refers to the process of supervising the training of a pre-trained large language model using labeled input-output samples to adapt it to a specific task.
[0047] Low-Rank Adaptation (LoRA): A parameter-efficient fine-tuning method that injects a low-rank decomposition matrix next to the linear layers of a pre-trained model, training only the low-rank matrix while freezing the model's original parameters.
[0048] Panel Survey: A follow-up survey that repeatedly administers the same group of respondents at multiple time points (waves) to generate a time-series tracking of each respondent's responses to each question.
[0049] Wave: A round of data collection in a panel survey, typically spaced one or two years apart.
[0050] Target Wave: A round of data collection in a panel survey that is to be predicted.
[0051] Historical Wave: A round of data collection that has been completed before the target wave.
[0052] Temporal Sensor: In this embodiment, this is the name given to the supervised fine-tuning of the large language model with frozen parameters. It reads the response trajectory of each respondent and outputs the category probability distribution of future responses. This output is regarded as a noisy observation of the potential attitude state.
[0053] Observation readings: The class probability distribution output by the time series observer at the response position.
[0054] Last Observation in the response trajectory: the latest observation reading before the target wave.
[0055] The model's implicit prior is the group average of all respondents' observation readings for a given question, reflecting the inherent assumption of the time series observer's response rate for that question.
[0056] Temporal empirical prior: The distribution of the cross-sectional margin of all respondents under a certain topic, after being dynamically propagated to the target wave number through marginal stationary propagation and Dirichlet contraction, is the calibration benchmark inherent in the data.
[0057] Prior bias: The systematic deviation between the model's implicit prior and the temporal empirical prior, manifested as all observations under the same topic shifting in the same direction, corresponding to the label bias phenomenon in statistical learning.
[0058] Dirichlet contraction: A proportional estimation method for contraction that uses the Dirichlet distribution as a conjugate prior and controls the intensity with a pseudo-count parameter, so that small sample estimates automatically regress to the contraction center.
[0059] like Figure 1 As shown, in a preferred embodiment of the present invention, the above-mentioned method for intertemporal prediction of social attitudes based on temporal prior correction using a large language model includes the following steps S1 to S4. The specific implementation process of each step will be described in detail below.
[0060] S1. Obtain a multi-wave panel survey dataset containing multiple time-series samples. Each time-series sample includes at least the respondent profile, the target question text, the respondent's answer trajectory to the target question in historical waves, and the target wave to be predicted.
[0061] It should be noted that in step S1 of the present invention, the interviewee profile includes static attribute dimensions and time-varying attribute dimensions; the static attribute dimensions include at least one or more of the following: gender dimension, year of birth dimension, urban / rural classification dimension, and highest education level dimension; the time-varying attribute dimensions include at least one or more of the following: age dimension, marital status dimension, employment status dimension, and income level dimension, and the values of the time-varying attribute dimensions correspond one-to-one with each historical wave in the response trajectory.
[0062] In step S1 of this embodiment, the multi-wave panel survey dataset can be derived from any multi-wave tracking survey project. This embodiment uses the following three multinational panel survey projects as data sources to verify the cross-cultural universality of the method:
[0063] Family Panel Studies of a Certain Country: A nationally representative longitudinal survey covering multiple provinces of a certain country, conducted every two years. This example uses attitude-related questions from seven waves conducted between 2010 and 2022.
[0064] A study on income dynamics in a certain country: This example uses subjective well-being questions from five waves of a representative panel survey of a certain country from 2008 to 2017.
[0065] A panel study on income dynamics in a certain country: the world's longest-running household panel survey. This example uses attitude and well-being questions from consecutive annual waves from 1968 to 1972.
[0066] Specifically, the original scales for each target item are uniformly mapped into three ordered categories: low, medium, and high. Each time-series sample consists of four parts: the respondent profile, the target item description, the respondent's response trajectory for the target item in historical waves, and the target wave to be predicted. The prediction span covers 1 to 8 years. Here, "response trajectory" refers to the year recorded for each historical wave, the attributes that change over time in that year, and the response category.
[0067] To examine cross-topic generalization ability during the training and validation phases, this embodiment deterministically bins respondents based on their identifier hash values, dividing them into training respondents and test respondents. The target topic is encoded using a general sentence vector model and clustered; topics in the same cluster are grouped into either the training covered topic set or the uncovered topic set to avoid leakage caused by similar topics. It should be noted that this division is only for performance validation; in actual deployment, no division is needed, and any new topics not covered during training are processed according to step S4.
[0068] S2. The large language model trained in a supervised fine-tuning manner is used as a temporal observer, and all parameters are frozen. The temporal samples are converted into temporal prompts and then input into the temporal observer. The temporal observer outputs the category probability distribution of the respondents' answers to the target questions in the target wave as the observation reading.
[0069] It should be noted that in step S2 of this invention, the time sequence prompt consists of the respondent information area, the question area, the past years' answer area, the target wave row, and the option area:
[0070] The respondent information area is used to provide structured natural language descriptions of the static attributes in the respondent profile;
[0071] The question display area is used to display the target question.
[0072] The historical answer section lists the year of each historical wave in chronological order, the value of the attribute that changed over time for that historical wave, and the category of the target question when answering that historical wave.
[0073] The target wavelet row provides the year of the target wavelet and the value of the attribute that changes over time for that target wavelet;
[0074] The options area provides multiple candidate categories (e.g., in the format of "letter.category") for answering the target question. The order of the candidate categories is randomly permuted to suppress positional bias in the large language model.
[0075] In step S2 of this embodiment, the historical answer area lists "Year (attribute that changes over time): Answer Category" in chronological order; the target wave row gives "Please predict the answer for ×××× year (attribute that changes over time)".
[0076] It should be noted that in step S2 of this embodiment, a low-rank adaptation method is used to perform supervised fine-tuning of the pre-trained large language model. This large language model can be an open-source large language model or a closed-source large language model that exposes lexical probabilities via an interface and supports supervised fine-tuning. During supervised fine-tuning, only the low-rank matrix injected into the linear layer bypass of the large language model is trained. The training objective is the standard next-lexical cross-entropy loss, and this loss is calculated only on the target lexical at the answer position. This embodiment uses two models, Llama-3.1-8B-Instruct and Qwen2.5-7B-Instruct, as base models to verify base independence. After supervised fine-tuning is completed, the large language model that has undergone supervised fine-tuning is used as a temporal observer, and all parameters of the temporal observer are frozen and will not be updated in any subsequent steps. Then, this embodiment converts the temporalized samples into temporal cues and inputs them into the temporal observer to obtain observation readings. At a given response location, the probabilities of the corresponding lexical units for each candidate category are read from the output layer of the large language model. These probabilities are then normalized after being restored to the category space via a random permutation inverse mapping, yielding the complete category probability distribution. It is important to emphasize that this invention retains the complete category probability distribution as an observational reading, rather than a single category generated through sampling. If the generation process only retains the mode of the category probability distribution (i.e., only a single category), the uncertainty information required for correction will be lost. The inference stage can employ a batch inference engine to process all respondents in parallel.
[0077] S3. The test-time corrector performs temporal prior correction on each target item: First, it obtains the temporal empirical prior based on the model's implicit prior and the last observation margin corresponding to the target item; if the target item meets the silent gating condition, the test-time corrector is silent and directly uses the observed readings as the social attitude prediction results; if the target item does not meet the silent gating condition, it is determined that the temporal observer has a prior bias on the target item, and the Bayesian update is used to reweight and normalize the observation readings of each respondent under the target item category by category, and the observation readings are re-anchored to the temporal empirical prior to obtain the corrected prediction distribution, and the category with the highest probability is taken as the social attitude prediction result of each respondent.
[0078] It should be noted that in step S3 of the present invention, the implicit prior of the model is obtained by calculating the arithmetic mean of the observation readings of all respondents under the target question for each category; the last observation margin is obtained by statistically analyzing the frequency of each category when all respondents answer the target question in the last observation of their answer trajectory.
[0079] In step S3 of this embodiment, the implicit prior of the model is constructed as follows:
[0080]
[0081] in, For the target question The model implicit priors in categories The value of ; For the target question The number of respondents who participated in the statistics; For the target question The index set of all respondents; For the time series observer to the first timing prompts Output observation readings in category The probability of it.
[0082] In step S3 of this embodiment, the last observation boundary is constructed according to the following formula:
[0083]
[0084] in, For the target question The last observed margin in category The value of ; For the first In the last observation of their response trajectory, the respondents answered the target question. The time category, the last observation being the wave preceding the target wave; 1[·] is the indicator function, when When the value is 1, the indicator function value is 1; otherwise, the indicator function value is 0.
[0085] It should be noted that in step S3 of the present invention, the time-series empirical prior is obtained by: based on the marginal stationarity of the attitude process, using the last observation margin as the marginal estimate of the target wave, and using the model implicit prior as the contraction center and the pseudo-counting parameter to control the contraction intensity, performing Dirichlet contraction to obtain the time-series empirical prior.
[0086] In step S3 of this embodiment, the timing empirical prior is constructed according to the following formula:
[0087]
[0088] in, For the target question Temporal experience priors in categories The value of ; The pseudo-count parameter for Dirichlet contraction is set to 30 in this embodiment.
[0089] In constructing the formula for the time-series empirical prior, this embodiment takes the identity mapping under the marginal stationarity assumption, that is, directly using the last observed margin as the estimate of the target wavelet population margin, without the need for an explicit transition operator. Dirichlet contraction enables the time-series empirical prior of small sample problems to automatically backtrack to the model's implicit prior, thereby automatically reducing the correction magnitude and preventing overcorrection.
[0090] As can be seen from the above equation, the construction method of the time series empirical prior uses the model's implicit prior as the contraction center, which automatically reduces the correction magnitude for a small number of issues. It is worth noting that the above time series prior correction does not use any labeling of the target wave, does not perform iterative estimation, and does not update any parameters of the time series observer.
[0091] It should be noted that during the temporal prior correction process, the correction benchmark does not need to be absolutely accurate, only significantly better than the shifted model prior: the magnitude of the prior shift in the uncovered questions should be several times greater than the error of the correction benchmark itself. It is worth emphasizing that the last observation is precisely the last line of the answer section for each year in the temporal prompt; the temporal empirical prior does not introduce any information beyond the temporal observer input, but is merely a rereading of the same data along the orthogonal direction of the "respondent cross-section".
[0092] It should be noted that, in step S3 of this invention, the method for determining whether the target question meets the silent gating condition is as follows: the training set used when training the large language model is used as the training coverage question set; if the target question belongs to the training coverage question set, the corrector is silent during testing; if the target question does not belong to the training coverage question set, the offset between the model's implicit prior and the temporal empirical prior is measured by the total variation distance; when the offset does not exceed a preset threshold, the corrector is silent during testing; when the offset exceeds the preset threshold, the Bayesian update is performed; the threshold is determined by taking the high quantile of the offset distribution of the training coverage question set.
[0093] In step S3 of this embodiment, the offset between the implicit prior of the metric model and the temporal empirical prior is calculated based on the total variance distance:
[0094]
[0095] in, For the title The offset.
[0096] It should be noted that in this invention, during testing, the corrector operates from a position of comprehensive time series overview, checking the consistency between the model's implicit prior and the temporal empirical prior for each item, and performing a Bayesian update when determining prior shift. Its design is based on the fact that observation error consists of two distinct components: item-level systematic bias and individual-level zero-mean random noise. For training covered items, the systematic bias is approximately zero, while for uncovered items, the systematic bias dominates, meaning the observer is unaware of the base rate of the new item's answer and incorrectly transfers the base rate of the training items, resulting in a uniform reading drift across the entire queue. Existing methods such as filtering, fusion, and smoothing only address the variance component and cannot eliminate the systematic bias; however, the systematic bias is structural and estimable, and therefore can be corrected if estimated.
[0097] It should be noted that in the Bayesian update of step S3 of this invention, the ratio of temporal empirical prior to model implicit prior is used. The power of a number is used as a weighting factor. These are the preset correction strength parameters.
[0098] In step S3 of this embodiment, the Bayesian update is performed as follows:
[0099]
[0100]
[0101] in, For the first The corrected predicted distribution of respondents is in category The probability of it; This is a normalization factor that makes the sum of the probabilities of each category equal to 1 after correction; To correct the intensity parameter, the selected item is verified on the training coverage item set. Specifically, during verification, some items in the training coverage item set are temporarily considered uncovered, and the complete time series prior correction process is performed on them according to step S3. The item with the highest prediction accuracy is selected from the observation readings output by the time series observer. This embodiment selects the item accordingly. That is, to perform a priori correction of full strength; For the time series observer to the first timing prompts Output observation readings in category The probability of it; For the target question Temporal experience priors in categories The value of ; For the target question The model implicit priors in categories The value of ; This represents the total number of categories.
[0102] It should be noted that the Bayesian update described above, in log-odds space, is equivalent to shifting the observed readings for the target question by the same constant vector. The relative differences among respondents remain unchanged; only the common baseline position of all questions is changed. Therefore, the optimal category of some respondents is flipped as the baseline is corrected, and the number of correct flips is significantly greater than the number of incorrect flips. Priors are corrected at the group level, and gains are realized at the individual level. When the model's implicit prior and the temporal empirical prior are consistent, the reweighting coefficient tends to 1, and the test-time corrector automatically degenerates into an identity mapping, i.e., no correction is performed if there is no offset. The entire correction process requires only one set of group statistics for each question, and the computational complexity is linearly related to the number of samples. Compared to re-tuning parameters for each new question, the test-time corrector of this invention does not require any gradient calculations or parameter writing and can be completed in real time on a central processing unit.
[0103] This embodiment provides a numerical example: the implicit prior of a model for an uncovered problem is (low 0.05, medium 0.90, high 0.05), exhibiting a typical severe prior bias, such as... Figure 2 As shown; the time series empirical prior is (low 0.45, medium 0.35, high 0.20), as... Figure 3 As shown. Figure 4 As shown, a respondent's observed readings are (low 0.06, medium 0.88, high 0.06). Although the absolute value of their "low" class probability is small, it is 1.2 times the corresponding value in the model's implicit prior. After Bayesian correction and normalization, their distribution becomes (low 0.48, medium 0.30, high 0.21, with all values rounded), and the predicted class is flipped from "medium" to "low." Meanwhile, another respondent with a relatively prominent "medium" class probability is still predicted as "medium" after correction. That is, correction does not pull all respondents towards the base rate; each respondent retains their own relative evidence.
[0104] S4. Deploy the time series observer and test-time corrector on the social attitude prediction platform. When the social attitude prediction platform receives the prediction request sent by the client, it outputs the social attitude prediction results of the respondents and returns them to the client along with the prior offset diagnosis report of the target topic, so as to achieve robust prediction across topics and waves.
[0105] It should be noted that, in this embodiment, as Figure 5As shown, the social attitude prediction platform includes a server and a panel survey database. The server can be a physical server or a cloud server, in which a time-series observer and a test-time corrector are deployed. The panel survey database is used to store the respondents' answer trajectories and respondent profiles for the target items in historical waves. When the server receives a prediction request from the client, it parses the target item and target wave carried in the prediction request, reads the corresponding answer trajectories and respondent profiles from the panel survey database, outputs the observation readings through the time-series observer according to step S2, performs time-series prior correction by the test-time corrector according to step S3, and finally returns the social attitude prediction results of the respondents and the prior offset diagnosis report of the target items to the client.
[0106] Furthermore, the prior offset diagnostic report includes: the offset of the target question, the ratio of temporal empirical priors to model implicit priors in each category (i.e., the prior deviation ratio), a prior offset map generated by summarizing the offsets of multiple target questions, and a judgment result on whether Bayesian updates are triggered.
[0107] It should be noted that the server caches the model's implicit priors, temporal empirical priors, and biases for each question as low-dimensional statistics, which can be directly reused when a prediction request for the same question is received later.
[0108] It should be noted that in step S4 of the present invention, for new questions not covered during training, after at least one round of testing is completed, there is no need to retrain the large language model. The observation reading acquisition operation in step S2 and step S3 can be directly executed to output the prediction results of all respondents in the target round and the prior offset diagnosis report of the target question.
[0109] It should be noted that the application scenarios of the method of the present invention include at least one of the following scenarios:
[0110] 1) Questionnaire design assistance scenario: Utilize prior offset map identification models to predict question types with low reliability, and guide the design of question rotation in follow-up surveys;
[0111] 2) Tracking and investigation completion scenario: Predictively complete the missing waves due to loss or rotation, reducing the implementation cost of tracking and investigation.
[0112] To better demonstrate the specific implementation and technical effects of the present invention, the method for intertemporal prediction of social attitudes based on temporal prior correction of large language models shown in steps S1 to S4 of the above preferred implementation is applied to a specific example.
[0113] Example
[0114] The specific implementation process of the large language model social attitude intertemporal prediction method based on temporal prior correction used in this embodiment is as described above and will not be repeated here.
[0115] This embodiment evaluates the effectiveness of the proposed method on three multinational panel datasets: CFPS, NIDS, and PSID. Evaluations were conducted on items not covered in the training (including those for which no respondents were seen during training). The sample sizes for the three datasets were 61,412 (NIDS), 60,720 (CFPS), and 20,480 (PSID), respectively. The base models used were Llama-3.1-8B-Instruct and Qwen2.5-7B-Instruct, respectively. Comparison methods included: fine-tuning the model for direct prediction (i.e., taking the highest probability category from uncorrected observations) and persistent baseline (using the previous round of answers). A persistent baseline, which directly uses the respondents' previous round of answers as the baseline for prediction, is a recognized strong baseline in panel prediction, and its accuracy on respondents whose attitudes have changed is always zero by definition.
[0116] Table 1. Comparison of inter-period prediction accuracy on questions not covered in training
[0117] The experimental results are shown in Table 1. Table 1 and Figure 6 Experimental results show that the fine-tuned model directly predicts that five out of six combinations are below the persistent baseline, confirming the prior bias problem described in the background section. After temporal prior correction according to this invention, the accuracy of all combinations is not lower than the persistent baseline, with five combinations significantly exceeding it, showing an improvement of 2.5–4.4 percentage points on Llama, and a maximum improvement of 19.2 percentage points compared to the direct prediction of the fine-tuned model. The two base models are aligned in direction, verifying the orthogonality between the corrector and the base. Furthermore, in terms of training coverage, the gating mechanism ensures that the output of the method in this invention is completely consistent with the fine-tuned model, i.e., strictly non-inferior within the distribution.
[0118] Table 2 verifies the cold-start deployment capability of this invention: using Llama-3.1-8B-Instruct as the base model, with only one historical wave, the method of this invention still outperforms the persistence baseline by 5.1 and 1.6 percentage points, respectively, on the NIDS and PSID datasets. More importantly, on the NIDS dataset with the most severe prior bias, the shorter the historical wave, the more severe the degradation in the accuracy of the direct predictions of the fine-tuned model. Conversely, the gain from correction is greater when there are no more than two historical waves, meaning that the corrector is most valuable at the weakest point of the observer during testing. The improvement values in Table 2 are calculated from the unrounded raw accuracy.
[0119] Table 2. Accuracy of Unseen Questions by Historical Wave Count
[0120] The comparison results in Table 3 support two assertions in the background section: First, the improvement of various numerical time-series methods relative to the persistence baseline is at most about 1.9 percentage points, and is lower than the method of this invention on all three datasets, indicating that the variance tool's benefit caps in bias-dominated unseen question scenarios; Second, the zero-shot inference of the two cutting-edge commercial large language models is lower than the persistence baseline on all three datasets, indicating that simply increasing the model size cannot replace the division of labor between observation and correction. Furthermore, in terms of change-of-attitude accuracy, the method of this invention achieves 0.22–0.35, which is generally higher than the 0.14–0.23 of the numerical time-series methods, while the persistence baseline is always zero by definition, indicating that this invention retains the unique ability of large language models to read the semantics of the question and identify change-of-attitude individuals. Change-of-attitude accuracy refers to the prediction accuracy calculated only on respondents whose true answers have changed relative to the previous wave, used to measure the method's true ability to identify attitude changes.
[0121] Table 3. Comparison of the method of the present invention with the prior art
[0122] It is understood that the intertemporal prediction method for social attitudes based on temporal prior correction using a large language model, as described in S1-S4 above, can essentially be implemented by a computer program. Therefore, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer program product corresponding to the intertemporal prediction method for social attitudes based on temporal prior correction provided in the above embodiments. This product includes a computer program / instruction, which, when executed by a processor, can implement the intertemporal prediction method for social attitudes based on temporal prior correction using a large language model as described in the above embodiments.
[0123] Similarly, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer electronic device corresponding to the intertemporal prediction method for social attitudes based on temporal prior correction of large language models provided in the above embodiments, such as... Figure 7 As shown, it includes a memory and a processor;
[0124] The memory is used to store computer programs;
[0125] The processor is configured to implement the intertemporal prediction method for social attitudes based on temporal prior correction of a large language model in the above embodiments when executing the computer program.
[0126] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0127] Therefore, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer-readable storage medium corresponding to the intertemporal prediction method of social attitudes based on temporal prior correction of a large language model provided in the above embodiments. The storage medium stores a computer program, which, when executed by a processor, can realize the intertemporal prediction method of social attitudes based on temporal prior correction of a large language model in the above embodiments.
[0128] Specifically, in the computer-readable storage medium of the above three embodiments, the stored computer program is executed by a processor, which can perform the aforementioned steps S1 to S4.
[0129] It is understood that the aforementioned storage media may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Furthermore, the storage media may also be various media capable of storing program code, such as USB flash drives, external hard drives, magnetic disks, or optical discs.
[0130] It is understood that the processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0131] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the invention. Therefore, all technical solutions obtained through equivalent substitution or transformation fall within the protection scope of the present invention.
Claims
1. A method for intertemporal prediction of social attitudes using a large language model based on temporal prior correction, characterized in that, Includes the following steps: S1. Obtain a multi-wave panel survey dataset containing multiple time-series samples. Each time-series sample includes a respondent profile, the target question text, the respondent's answer trajectory to the target question in historical waves, and the target wave to be predicted. S2. The large language model trained in a supervised fine-tuning manner is used as a temporal observer, and all parameters are frozen; the temporal samples are converted into temporal prompts and then input into the temporal observer. The temporal observer outputs the category probability distribution of the respondents' answers to the target questions in the target wave as the observation reading. S3. The test-time corrector performs temporal prior correction for each target item: first, it obtains temporal empirical prior based on the model's implicit prior and the last observation margin corresponding to the target item; if the target item satisfies the silent gating condition, the test-time corrector is silent and directly uses the observed readings as the social attitude prediction results. If the target topic does not meet the silent gating condition, it is determined that the time series observer has a prior bias on the target topic. Bayesian update is used to reweight and normalize the observation readings of each respondent on the target topic, and the observation readings are re-anchored to the time series empirical prior. The corrected prediction distribution is obtained and the category with the highest probability is taken as the social attitude prediction result of each respondent. S4. Deploy the time series observer and test-time corrector on the social attitude prediction platform. When the social attitude prediction platform receives the prediction request sent by the client, it outputs the social attitude prediction results of the respondents and returns them to the client along with the prior offset diagnosis report of the target topic, so as to achieve robust prediction across topics and waves. In S3, the model's implicit prior is obtained by calculating the arithmetic mean of the observation readings of all respondents under the target question for each category; the last observation margin is obtained by statistically analyzing the frequency of each category when all respondents answer the target question in the last observation of their answer trajectory. In S3, the time-series empirical prior is obtained by: based on the marginal stationarity of the attitude process, using the last observation margin as the marginal estimate of the target wave, and using the model's implicit prior as the contraction center and the pseudo-counting parameter to control the contraction intensity, performing Dirichlet contraction to obtain the time-series empirical prior. In S3, the method to determine whether the target question meets the silent gating condition is as follows: the training set used when training the large language model is used as the training coverage question set. If the target question belongs to the training coverage question set, the corrector is silent during testing. If the target question does not belong to the training covered question set, the total variation distance is used to measure the offset between the model's implicit prior and the temporal empirical prior. When the offset does not exceed a preset threshold, the corrector is silent during testing; when the offset exceeds the preset threshold, the Bayesian update is performed. The threshold is determined by taking the high quantile of the offset distribution of the training covered question set.
2. The method for intertemporal prediction of social attitudes using a large language model based on temporal prior correction as described in claim 1, characterized in that, In S1, the interviewee profile includes static attribute dimensions and time-varying attribute dimensions; the static attribute dimensions include one or more of the following: gender dimension, year of birth dimension, urban / rural classification dimension, and highest education level dimension; the time-varying attribute dimensions include one or more of the following: age dimension, marital status dimension, employment status dimension, and income level dimension, and the values of the time-varying attribute dimensions correspond one-to-one with each historical wave in the response trajectory.
3. The method for intertemporal prediction of social attitudes using a large language model based on temporal prior correction as described in claim 2, characterized in that... In S2, the time-series prompt consists of a respondent information area, a question area, a historical answer area, a target wave row, and an option area: the respondent information area provides a structured natural language description of the static attributes in the respondent profile; the question area displays the target question; the historical answer area lists the year of each historical wave, the value of the attribute that changes over time, and the category in which the target question was answered in that historical wave in chronological order; the target wave row provides the year of the target wave and the value of the attribute that changes over time; and the option area provides multiple candidate categories that can be selected when answering the target question, and the order of the candidate categories is randomly permuted to suppress positional bias in the large language model.
4. The method for intertemporal prediction of social attitudes using a large language model based on temporal prior correction as described in claim 1, characterized in that, In the Bayesian update of S3, the ratio of temporal empirical prior to model implicit prior is used. The power of a number is used as a weighting factor. These are the preset correction strength parameters.
5. The method for intertemporal prediction of social attitudes using a large language model based on temporal prior correction as described in claim 1, characterized in that, In S4, the social attitude prediction platform includes a server and a panel survey database. The server is either a physical server or a cloud server, which deploys a time-series observer and a test-time corrector. The panel survey database stores respondents' answer trajectories for the target item and their profiles across historical waves. When the server receives a prediction request from the client, it parses the target item and target wave carried in the prediction request, reads the corresponding answer trajectories and respondent profiles from the panel survey database, outputs observation readings through the time-series observer according to step S2, performs time-series prior correction by the test-time corrector according to step S3, and finally returns the predicted social attitude of the respondents and a prior offset diagnostic report for the target item to the client.
6. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it can realize the intertemporal prediction method of social attitudes based on temporal prior correction of a large language model as described in any one of claims 1 to 5.
7. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the intertemporal prediction method for social attitudes based on temporal prior correction of a large language model as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Power load prediction method based on large language model and social population statistical information
CN119443751A
Large language model social survey simulation method based on stable adaptive fairness optimization
CN122220472A