Agentic AI · L-Intro
Given the joint distribution $P(X,Y)$:
| $X$ | $Y$ | $P$ |
|---|---|---|
| 0 | 0 | 0.1 |
| 0 | 1 | 0.2 |
| 1 | 0 | 0.6 |
| 1 | 1 | 0.1 |
Compute the conditional distribution $P(X \mid Y{=}1)$.
Given the marginal $P(W)$ and the conditional $P(D\mid W)$:
| $W$ | $P(W)$ |
|---|---|
| sun | 0.8 |
| rain | 0.2 |
| $P(D\mid W)$ | $D=$ wet | $D=$ dry |
|---|---|---|
| $W=$ sun | 0.1 | 0.9 |
| $W=$ rain | 0.7 | 0.3 |
Compute the joint table $P(W,D)=P(D\mid W)\,P(W)$.
Marginals $P(T)$: hot 0.5, cold 0.5; $P(W)$: sun 0.6, rain 0.4. Joint $P(T,W)$:
| $T$ | $W$ | $P(T,W)$ |
|---|---|---|
| hot | sun | 0.4 |
| hot | rain | 0.1 |
| cold | sun | 0.2 |
| cold | rain | 0.3 |
Are $T$ and $W$ statistically independent? Justify.
The lecture estimated a first-order Markov (bigram) model from this corpus. The corpus is
counted as one sequence of $20$ tokens, and . is a token of its own. The pair . the,
which crosses a sentence boundary, is therefore counted as a bigram like every other pair:
the cat sat on the mat . the cat ate the fish . the dog sat on the log .
(a) Estimate by counting: the conditional distributions $P(W_t \mid W_{t-1}{=}\texttt{the})$ and $P(W_t \mid W_{t-1}{=}\texttt{cat})$. Give every non-zero entry and check each distribution sums to $1$.
(b) Score the sentence the cat sat on the mat . under the bigram model
$P(W_{1:T}) = P(W_1)\prod_{t=2}^{T} P(W_t \mid W_{t-1})$. Take $P(W_1{=}\texttt{the})=1$: the
first token of a sentence follows a ., and $P(\texttt{the}\mid\texttt{.})=\tfrac22=1$ in the
corpus.
(c) Now score the dog ate the fish . — a grammatical sentence built from the same vocabulary.
What value do you get, and why? Name the problem and the standard family of remedies.
(d) The corpus has $\vert{}V\vert{}=10$ distinct tokens. How many free parameters does the full joint $P(W_{1:6})$ need? How many does the bigram model need (transitions and the initial distribution)? How many a trigram model?
(e) Which conditional-independence statement licenses the reduction in (d)? Write it with the $\perp$ notation.
(f) An LLM is not an $n$-gram model with a very large $n$. Give two distinct reasons — one about the table in (d), one about how the conditional is computed.
(g) An $n$-gram model is usually estimated with two additional tokens: a start token <s>
before the first token of every sequence and an end token </s> after its last token.
Jurafsky & Martin (2026), ch. 3, count every
sentence as a sequence of its own. Here the corpus is one sequence, so it receives one <s>
and one </s>:
<s> the cat sat on the mat . the cat ate the fish . the dog sat on the log . </s>
In a formula the two tokens are written $\langle s\rangle$ and $\langle /s\rangle$.
<s> replace?. and the token </s>.(a) Explain what each ladder stage adds, and why a tool-calling-tuned model drives an agent loop reliably.
(b) The rungs say what a model can do; the pipeline stages — pre-training, mid-training, post-training — say when it was installed. Assign each rung to the stage(s) that produce it, and state what distinguishes mid-training from pre-training given that both optimise the same next-token objective.
(c) The training ladder (base → aligned → tool-calling) and the agent capability levels (0–3) answer two different questions. State each question in one sentence. Then give a system that sits high on one and low on the other — in both directions.
(a) Classify each as chatbot or agent, and justify:
(b) In the agent architecture, which component
The lecture writes the agent loop with the deliberation factored out:
$$ \begin{array}{l} \textbf{Agent-Loop}(\textit{goal}) \\ \hline \textbf{Input: } \textit{goal} \text{; a runtime providing the tools; a step budget } B \\ \textbf{Output: } \text{the result} \\ \hline 1: \quad \textit{state} \gets \text{Init}(\textit{goal}) \\ 2: \quad \textbf{while } \neg\,\text{Done}(\textit{state}) \textbf{ and } \text{steps} < B \textbf{ do} \\ 3: \quad \qquad a \gets \text{Decide}(\textit{state}) \\ 4: \quad \qquad o \gets \text{Execute}(a) \\ 5: \quad \qquad \textit{state} \gets \text{Update}(\textit{state}, a, o) \\ 6: \quad \textbf{return } \text{Result}(\textit{state}) \\ \hline \end{array} $$
(a) A chatbot is this loop with two things taken away. Which, and what does the loop reduce to?
(b) Assign each of the four core capabilities — tools, memory, planning, proactivity — to the line (or the argument) that carries it.
(c) Line 4 is the security boundary. State precisely what it separates, and what is lost if the model executes the action itself.
(d) Give two distinct failure modes the step budget $B$ guards against. What does the caller lose when the loop stops because $B$ ran out rather than because $\text{Done}$ became true — and what must $\text{Result}$ therefore report?
(e) The model is stateless, yet $\textit{state}$ survives across iterations. Where does it live, and what exactly does the runtime do at line 3 on the $k$-th iteration?
(a) Classify each system as implicit planning, explicit plan generation, or search-based planning:
(b) Look again at the Agent-Loop box. Which of the three paradigms does it describe? Justify your answer by naming the line that differs between them, and say what each paradigm needs $\textit{state}$ to hold.
(c) Workflow or agent? Decide for each and justify in terms of predictability and cost:
This exercise is optional and is not part of the exam.
Open question. Are language models capable of critical thinking, or do they mainly reproduce majority opinion, including its prejudices? Answer in about one page: take a clear position, and state the strongest objection to it.
(a) A language model approximates the distribution $P(W_t \mid W_{1:t-1})$ of its training text. Does the most probable continuation correspond to the best-argued position or to the most frequent one? What follows for a well-argued view that is rarely written down?
(b) Which of these mechanisms could make a model depart from the majority — and does each one evaluate reasons or only shift the probabilities?
(c) Preference tuning rewards answers that raters prefer, and models learn from it to agree with the user's stated view, at times over the correct one — sycophancy (Sharma et al., 2023). Why is this more dangerous for an agent than for a chatbot?
(d) Design a test, runnable with the lab setup, that shows whether a model follows the evidence or the user's opinion, and state which result would falsify your position.
References.