← 返回 openai 的题目列表Compute the Distribution of LLM Decoding Stopping Time and Build a Strategy Against Adversaries
类型:online_judge
Problem: Model the Distribution of LLM Decoding Stopping Time and Implement a Minimax Strategy Against Adversaries
In a simplified LLM decoding process, at each step the model may emit a special token <STOP> and terminate. You must do two things.
Part A: Stopping-Time Distribution
Given a maximum length N (generation runs for at most N tokens; if it does not stop early, it is forced to stop at N) and a per-step stop probability sequence:
At step t (1-indexed), the probability of emitting <STOP> is p[t] (0 <= p[t] <= 1)
If it does not stop at step t, it proceeds to step t+1
Compute:
For all t = 1..N, the stopping-time probability P(T=t)
The expected stopping time E[T]
Note: If <STOP> is never emitted by step N, define T=N (forced stop).
Part B: Strategy Against Adversaries
There are multiple adversaries. Each adversary corresponds to a different mechanism that influences p[t] and/or the payoff. After observing p[1..N] (or its parametric form), your program must choose a decision (e.g., a cutoff step k, an early-stop policy, or an action a) to maximize the worst-case (minimax) expected reward.
Implement a program that takes:
N
p[1..N]
parameters for M adversaries (each defines a possible p[t] and/or reward function)
a reward function reward(decision, T, adversary)
Output:
the chosen decision
the expected reward under the worst adversary
I/O Spec
You must clearly specify:
stdin input format
stdout output format
constraints (N, M) and complexity requirements
Provide at least 5 test cases including edge cases.
Example
Input
3
0.5 0.0 0.0
Output
P(T=1)=0.5 P(T=2)=0.0 P(T=3)=0.5
E[T]=2.0