Journal of Indian Acad. Math.  
ISSN: 0970-5120  
Vol. 48, No. 1 (2026) pp. 10–15.  
MODELING SEMANTIC DRIFT IN CHATGPT  
RESPONSES USING MARKOV CHAINS: AN  
EXCEL-BASED SIMULATION APPROACH  
Ashwini Modi  
Abstract. ChatGPT and other large language models generate text by guessing one  
word at a time based on what came before. While their responses often sound smooth  
and logical, they sometimes slowly drift o-topic or repeat themselves. In this study, we  
use a simple Markov chain model—built and tested in Excel—to track how the meaning  
of ChatGPT’s replies shifts over time. By simulating these “semantic states,” we uncover  
patterns in how the model stays on track, loops back, or wanders. Our results show  
that even basic probability tools can help us peek into the structure behind ChatGPT’s  
behavior, making it easier to fine-tune prompts and improve how we interact with these  
models.  
Keywords: ChatGPT, Semantic Drift, Markov Chains, Excel Simulation, Language Mod-  
els.  
2010 AMS Subject Classification: 60J20 (Primary) 60J35 (Secondary).  
1. Introduction  
ChatGPT and other large language models have changed the way we generate text—  
they’re fluent, fast, and often sound impressively human. But they’re not perfect. In  
longer replies or when randomness is turned up, these models can start to drift o-topic  
or repeat themselves. Most tools for analyzing this behavior are technical and hard to  
use, especially for beginners.  
This paper introduces a hands-on, beginner-friendly approach using Markov chains to  
track how the meaning of ChatGPT’s responses shifts over time. By simulating these  
transitions in Excel, we reveal patterns in how the model stays coherent—or doesn’t. It’s  
a lightweight way to peek under the hood and better understand how these models build  
their replies.[5]  
2. Related Work  
Earlier studies have examined semantic drift in large language models by tracking em-  
bedding trajectories and entropy dynamics [1]. Others have proposed methods such as  
context-preserving gradient modulation to keep long-form text coherent [2]. Work on  
dialogue modeling has also used Hidden Markov Models to capture conversational flow  
[3]. In the case of ChatGPT, researchers have compared its cohesion and coherence with  
human writing [4], and highlighted the importance of semantic and pragmatic precision in  
conversational AI [5]. Building on these insights, our study focuses directly on ChatGPT’s  
10  
MODELING SEMANTIC DRIFT IN CHATGPT RESPONSES  
11  
conversational dynamics. Unlike prior work that relied on external dialogue corpora, we  
construct a transition matrix from annotated ChatGPT responses themselves. By apply-  
ing Markov chains to track shifts in meaning, we provide a simple and reproducible way  
to see how ChatGPT moves between definitions, examples, clarifications, and eventually  
drifts o-topic. This approach fills a gap in the literature by modeling semantic drift with  
probability, making the process transparent and scalable.  
2.1. Markov Chains for Semantic Modeling. Markov chains are a simple yet pow-  
erful way to model how things change over time. Imagine a system that moves from one  
state to another—like shifting from “explaining” to “giving an example” based only on  
where it is right now, not on the full history. This idea is called the Markov assumption:  
the next move depends only on the current state. Formally, if Xt represents the semantic  
state at time t, then:  
Pij = P(Xt+1 = sj | Xt = si, Xt1, . . . , X0) = P(Xt+1 = sj | Xt = si).  
The behavior of a Markov chain is governed by a transition matrix P, where each entry  
Pij represents the probability of moving from state Si to state Sj. Each row of the matrix  
sums to 1, ensuring that the system always transitions to some state.[1],[2]  
In this paper, we use this method to study how ChatGPT’s responses shift between  
dierent types of meaning, like “Definition,” “Example,” or “Repetition.” We treat each  
of these as a state in the chain and simulate how ChatGPT moves between them over  
time. By doing this in Excel, we uncover patterns in how ChatGPT stays on topic,  
repeats itself, or drifts away. It’s a simple, transparent way to understand how these  
models behave—no deep coding or AI expertise needed.  
3. Methodology  
We define six semantic states based on functional roles in ChatGPT responses:  
S = {s1, s2, s3, s4, s5, s6} = {Definition, Example, Meta-comment, Repetition, Clarification, O-topic}  
3.1. Transition Matrix Construction. Transition Matrix  
To understand how ChatGPT’s responses shift over time, we broke each utterance into  
one of six categories: Definition, Example, Meta-comment, Repetition, Clarification, and  
O-topic. We then collected 50 responses from ChatGPT and annotated them according  
to these roles. By looking at pairs of consecutive utterances, we could see how meaning  
moved from one state to another. The probability of moving from state si to state sj was  
calculated using a simple formula  
N(si sj)  
Pij =  
6
k=1 N(si sk)  
The resulting transition matrix, built directly from ChatGPT’s annotated responses, is  
shown below:  
12  
Ashwini Modi  
From \To  
Definition Example Meta-comment Repetition Clarification O-topic  
Definition  
0.08  
0.10  
0.06  
0.04  
0.20  
0.00  
0.42  
0.36  
0.14  
0.08  
0.28  
0.00  
0.12  
0.18  
0.28  
0.16  
0.10  
0.00  
0.06  
0.14  
0.22  
0.44  
0.12  
0.00  
0.24  
0.14  
0.18  
0.20  
0.20  
0.00  
0.08  
0.08  
0.12  
0.10  
0.10  
1.00  
Example  
Meta-comment  
Repetition  
Clarification  
O-topic  
3.2. Excel-Based Simulation. To simulate semantic transitions in ChatGPT responses,  
we implemented a discrete-time Markov chain model in Microsoft Excel. Each row in the  
spreadsheet represents a time step, with columns for the current state, a randomly gen-  
erated number, and the computed next state.  
Sheet Structure  
The simulation uses four columns:  
Step: Time index from 1 to 100.  
Current State: The semantic state at time t.  
Random Number: A uniformly distributed value generated using =RAND().  
Next State: Determined by conditional logic based on the transition matrix.  
State Propagation  
The simulation begins with an initial state (e.g., Definition) and evolves over time. At  
each step, the current state is used to select a row from the transition matrix, and the  
random number determines the next state via nested IF statements. For example, the  
transition from the Definition state is computed using:  
=IF(RAND() <= 0.08, "Definition",  
IF(RAND() <= 0.50, "Example",  
IF(RAND() <= 0.62, "Meta-comment",  
IF(RAND() <= 0.68, "Repetition",  
IF(RAND() <= 0.92, "Clarification", "Off-topic")))))  
Similar formulas are constructed for each of the six semantic states.  
Frequency Analysis. After simulating 100 steps, we use COUNTIF to tally the number  
of occurrences of each state. These counts are visualized using a pie chart to illustrate  
the distribution of semantic behavior over time.  
MODELING SEMANTIC DRIFT IN CHATGPT RESPONSES  
13  
Interpretability This Excel-based approach provides a transparent and accessible frame-  
work for modeling LLM behavior. It allows researchers to explore semantic drift, repeti-  
tion loops, and transition dynamics without requiring programming or statistical software.  
3.3. Analytic Measures. To evaluate the behavior of the semantic Markov chain, we  
analyzed a 100-step simulation using the following measures:  
1. State Frequency Distribution  
We used COUNTIF()formulas in Excel to count how often each semantic state ap-  
peared. This gives an empirical distribution that approximates the long-run behavior  
of the chain.  
2. Transition Dynamics  
By examining the sequence of transitions, we observed:  
High self-transition rates for Definition and Example  
Frequent transitions from Example to Meta-comment and Repetition to Repeti-  
tion  
Absorption into O-topic after certain paths  
These patterns validate the structure of the transition matrix.  
3. Absorbing State Behavior  
The O-topic state acts as an absorbing state. Once entered, the system remains  
there indefinitely. This was confirmed by the simulation, which showed no transitions  
out of O-topic. The model drifted into “O-topic” after an average of 35 steps. This  
suggests that even coherent responses tend to lose focus over time, especially under  
high-temperature settings.  
14  
Ashwini Modi  
Figure above shows a 100-step simulation of semantic transitions. After step 35, the  
system enters the O-topic state and remains there for the rest of the simulation,  
confirming its absorbing nature  
4. Limitations and Future Work  
Our transition matrix was built from a relatively small set of 50 ChatGPT responses,  
so the probabilities may not fully reflect the wide variety of ways the model behaves.  
Because the labeling of the responses was done manually, some bias could have slipped in.  
In addition, the Excel simulation only looks at immediate shifts between states and does  
not capture deeper context across longer conversations. In the future, this work can be  
strengthened by using a larger dataset, involving multiple annotators or automated tools  
to reduce bias, and exploring more advanced models that track longer-range dependencies  
in dialog.  
5. Discussion and Implications  
Our results show that ChatGPT often moves from giving definitions to examples, and  
then into clarifications or repetitions, before eventually drifting o-topic. This pattern  
suggests that the model is good at explaining and illustrating ideas, but it struggles to stay  
focused on longer conversations. For teachers or researchers, this means that ChatGPT  
can be a helpful tool for generating explanations and examples, yet its tendency to wander  
must be managed carefully. From a broader perspective, our study shows that even a  
simple Markov chain can capture these shifts in meaning, making complex AI behavior  
easier to measure and understand.  
MODELING SEMANTIC DRIFT IN CHATGPT RESPONSES  
15  
6. Conclusion  
This study used a transition matrix built from real ChatGPT responses to show how the  
model shifts between definitions, examples, clarifications, and repetitions before eventually  
drifting o-topic. By applying Markov chains and simulating the process in Excel, we  
created a simple and transparent way to measure semantic drift in AI conversations. The  
results highlight both the strengths of ChatGPT in generating explanations and examples,  
and its weakness in maintaining focus over longer interactions. While the dataset was  
small and the simulation limited to immediate transitions, the approach demonstrates  
how probability models can make complex language behaviour easier to understand. In  
doing so, our work provides a practical framework that can be scaled up in future studies  
to capture richer patterns of conversational dynamics.  
REFERENCES  
[1] Weatherstone, C., et al. (2025). Quantifying Latent Semantic Drift in Large Language Models Through  
Self-Referential Inference Chains. arXiv preprint  
[2] Kobanov, N., et al. (2025). Context-Preserving Gradient Modulation for Large Language Models: A  
Novel Approach to Semantic Consistency in Long-Form Text Generation. arXiv:2502.03643.  
[3] Boyer, K. E., et al. (2010). Modeling Dialogue Structure with Adjacency Pair Analysis and Hidden  
Markov Models. Proc. Intelligent Tutoring Systems.  
[4] Shaarawy, H. Y. (2023). Cohesion and Coherence in Essays Generated by ChatGPT: A Comparative  
Analysis to University Students’ Writing. Badr University in Cairo.  
[5] Bunt, H., and Petukhova, V. (2023). Semantic and Pragmatic Precision in Conversational AI Systems.  
Frontiers in Artificial Intelligence, 6, Article 896729  
(Received, January 16, 2026)  
(Revised, February 02, 2026)  
Mathematics Department,  
SIWS College, Wadala, Mumbai.  
Email AshwiniModi@siwscollege.edu.in