Techniqueadvanced
Per-survivor processing
Also called per-survivor estimation.
Runs a separate channel or phase estimator along each survivor path of the Viterbi algorithm, using its own tentative decisions.
Per-survivor processing (PSP) is a way to run the Viterbi algorithm when some parameter of the channel is unknown or drifts: the taps of the channel, the carrier phase or the symbol timing. A conventional receiver has one estimator, driven by the tentative decisions of the detector. Those decisions are reliable only after a delay, when the survivors have merged, so the estimator works with old data. PSP gives each survivor its own estimator and drives it with the symbols of that survivor, at once. The branch metrics of a survivor use its own estimate. The best path then comes with the estimate that fits it best. Raheli, Polydoros and Tzou gave the general principle in 1995.
In plain words
The Viterbi algorithm keeps one best path into each state. Each of these paths is a hypothesis about the symbols sent so far. If the path is right, the symbols on it are known, and the channel can be estimated as if from a training sequence. So every path gets its own estimator, trained on its own symbols. Wrong paths get poor estimates and soon fall behind. The right path gets a good estimate with no delay. The cost is one estimator per state instead of one in total.
When it applies
- The detector is a search over a trellis or a tree: a Viterbi equalizer, a maximum likelihood sequence estimator, a trellis decoder or reduced-state sequence estimation.
- The branch metrics depend on a parameter that is unknown or changes with time, and a data-aided estimator for that parameter exists: LMS, RLS, a Kalman filter or a phase-locked loop.
- The parameter changes too fast for an estimator that waits for the decision delay of the detector, or no training sequence is available.
The template
- Attach an estimate to each state. Next to the metric and the back pointer, each state holds the parameter estimate of its survivor.
- Score branches with the estimate of their start state. A branch from the state with the new symbol gets the metric , where holds the symbols of that branch.
- Add, compare and select as usual. Each next state keeps its best incoming branch.
- Update along the winner. The estimate of the next state is the estimate of the winning start state, updated by one step of the estimator with the error and the symbols of the winning branch.
For a channel with taps and LMS with the step size , the receiver is:
PSP-VITERBI(y, f0, β, pre)- 1
Γ(start) ← 0, f̂(start) ← f0 ▷ start = the known symbols pre - 2
for n ← 0 to N - 1 - 3
for each reached state s and each symbol a - 4
e ← y[n] - f̂(s)ᵀ (a, s) ▷ the prediction error with the estimate of s - 5
keep for t = first L-1 entries of (a, s) the branch with the smallest Γ(s) + e² - 6
for each next state t: f̂(t) ← f̂(s) + β e (a, s) ▷ s, a, e of the winning branch - 7
trace back from the state with the smallest Γ
Correctness. By induction on , the estimate of each state is the LMS estimate run on the symbols of its own survivor, so it never uses a decision from another path, and it uses the newest symbol without a delay. With , every estimate stays , and the receiver is exactly the Viterbi equalizer for , which returns the maximum likelihood sequence. With it is not the maximum likelihood detector for an unknown channel, but a search in which every path is scored by the prediction errors of its own adaptive estimate. The proofs folder has the details.
Cost. With symbols and states, each step evaluates branches and updates estimates, each at . A block of samples costs time in the word RAM with unit-cost real arithmetic, the same order as the Viterbi equalizer, and space for the back pointers. A conventional receiver has one estimator instead of , which matters when the estimator is expensive, such as RLS with per update.
Classic examples
A drifting channel. BPSK on the channel with the taps , , noise variance 0.05 and 3000 symbols (seed 8001). The tests count the errors:
| receiver | errors in 3000 | agreement with the known-channel Viterbi |
|---|---|---|
| Viterbi that knows at every time | 1 | |
| Viterbi with the fixed estimate | 297 | |
| PSP with LMS, | 0 | 2999 of 3000 |
With and , PSP made 70 and 23 errors on the same data, because the estimates lag behind the drift.
Learning the channel from a wrong start. On the fixed channel with noise variance 0.05 and 1000 symbols (seed 8003), the Viterbi equalizer for the wrong channel makes 44 errors. PSP from the same wrong start with makes no errors, and its final estimate of the best survivor is .
Carrier phase. For a channel with an unknown, slowly drifting phase, each survivor runs its own phase-locked loop, driven by the phase error between and the noiseless output of its branch. This is decision-directed carrier recovery with the decisions of each survivor, and it avoids the delay that a single loop driven by the detector output would have.
Decision feedback in reduced-state detectors. In reduced-state sequence estimation and delayed decision feedback sequence estimation, the trellis keeps only part of the channel memory, and each survivor cancels the rest with its own past symbols. This is per-survivor processing applied to the symbols that the state does not hold.
Variations
- The estimator. LMS is the cheapest. RLS and the Kalman filter track faster channels at per survivor and step.
- Fewer estimators. Keep estimators only for the best few survivors, or share one estimator among the states that differ only in old symbols, to cut the cost.
- Blind start. With no training, PSP can start from a rough estimate and let the survivors learn the channel, as in the second example. The sign of the channel is ambiguous for BPSK, so a known start or differential coding is still needed.
- Tree and list searches. The same idea works in the M-algorithm and in other breadth-first searches, where each kept path carries its estimate.
- Soft output. In iterative receivers, the per-survivor estimates can feed soft-output detectors, as in turbo equalization.
Pitfalls
- The step size. Too small, and the estimates lag behind the drift (70 errors with in the first example). Too large, and the noise in the estimates raises the error rate. Tune it to the drift rate and the SNR.
- No ML guarantee with adaptation. With , a wrong path can fit its own estimate well and win, in particular when the channel is badly known at the start. The detector is a good heuristic, not the ML detector for an unknown channel.
- Phase and sign ambiguity. A blind PSP receiver can converge to with all symbols inverted, or to a rotated channel for QAM. Use a known preamble or differential coding.
- Cost with many states. With states, each with an RLS estimator, the cost grows fast. Combine PSP with a reduced-state trellis.
- Ties in the metric. When two branches into a state have equal metrics, the choice decides which estimate survives. Break ties in a fixed order so that the result is reproducible.
Code
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/per-survivor-processing/. The authors are listed in prov/24BB6C.jsonl.
"""Per-survivor processing: a Viterbi equalizer with one LMS channel estimate per survivor.
The received samples are y[n] = sum_k f_n[k] x[n - k] + noise, with real symbols
and channel taps f_n that may drift slowly. The trellis state is the last
L - 1 symbols, most recent first. Every state keeps its own channel estimate.
A branch from state s with the new symbol a is scored with the estimate of s,
and after the add-compare-select step, the estimate of the winning branch is
updated by one LMS step that uses the symbols of that branch. So every
estimate is driven by the decisions of its own survivor, with no decision
delay. With the step size 0, the receiver is the plain Viterbi equalizer for
the channel f0.
"""
from itertools import product
def psp_viterbi(
y: list[float],
f0: list[float],
step: float,
alphabet: tuple[float, ...] = (-1.0, 1.0),
pre: list[float] | None = None,
) -> tuple[list[float], list[float]]:
"""Return the decisions and the final channel estimate of the best survivor.
pre holds the L - 1 symbols sent before y[0], in time order. The default is
alphabet[0] repeated, a known start.
"""
m = len(f0) - 1
if m < 0:
raise ValueError("the channel needs at least one tap")
if pre is None:
pre = [alphabet[0]] * m
if len(pre) != m:
raise ValueError("pre must hold len(f0) - 1 symbols")
start = tuple(reversed(pre))
metric = {start: 0.0} # @line L1
est = {start: [float(v) for v in f0]}
back = []
for yn in y: # @line L2
best = {}
for s, ms in metric.items(): # @line L3
f = est[s]
for a in alphabet:
x = (a,) + s
e = yn - sum(fk * xk for fk, xk in zip(f, x)) # @line L4
cand = ms + e * e
t = x[:m]
if t not in best or cand < best[t][0]: # @line L5
best[t] = (cand, s, a, e, x)
metric, new_est, bp = {}, {}, {}
for t, (cand, s, a, e, x) in best.items():
metric[t] = cand
new_est[t] = [fk + step * e * xk for fk, xk in zip(est[s], x)] # @line L6
bp[t] = (s, a)
est = new_est
back.append(bp)
t = min(metric, key=metric.get) # @line L7
final = est[t]
out = []
for bp in reversed(back):
s, a = bp[t]
out.append(a)
t = s
out.reverse()
return out, final
def drifting_channel(n: int, base: list[float], depth: float, period: float) -> list[list[float]]:
"""Taps that drift as base[k] + depth sin(2 pi i / period + k), for i < n."""
import math
return [[b + depth * math.sin(2 * math.pi * i / period + k) for k, b in enumerate(base)] for i in range(n)]
def transmit(x: list[float], taps: list[list[float]], pre: list[float]) -> list[float]:
"""Noiseless output of the time-varying channel, taps[n] used at time n."""
full = list(pre) + list(x)
m = len(pre)
return [sum(f[k] * full[m + n - k] for k in range(len(f))) for n, f in enumerate(taps)]
test_per_survivor_processing.py 103 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/per-survivor-processing/. The authors are listed in prov/24BB6C.jsonl.
import math
import random
from itertools import product
import pytest
from per_survivor_processing import drifting_channel, psp_viterbi, transmit
def ml_by_search(y, f, pre, alphabet=(-1.0, 1.0)):
best = None
for x in product(alphabet, repeat=len(y)):
r = transmit(list(x), [f] * len(y), pre)
cost = sum((a - b) ** 2 for a, b in zip(y, r))
if best is None or cost < best[0]:
best = (cost, list(x))
return best[1]
def genie_viterbi(y, taps, pre, alphabet=(-1.0, 1.0)):
# the Viterbi equalizer that knows the channel at every time
m = len(taps[0]) - 1
metric = {tuple(reversed(pre)): 0.0}
back = []
for n, yn in enumerate(y):
best = {}
for s, ms in metric.items():
for a in alphabet:
x = (a,) + s
e = yn - sum(f * v for f, v in zip(taps[n], x))
if x[:m] not in best or ms + e * e < best[x[:m]][0]:
best[x[:m]] = (ms + e * e, s, a)
metric = {t: v[0] for t, v in best.items()}
back.append({t: (v[1], v[2]) for t, v in best.items()})
t = min(metric, key=metric.get)
out = []
for bp in reversed(back):
t, a = bp[t]
out.append(a)
return out[::-1]
def errors(a, b):
return sum(u != v for u, v in zip(a, b))
def test_step_zero_is_the_viterbi_equalizer() -> None:
rng = random.Random(8002)
for _ in range(20):
f = [1.0] + [rng.uniform(-0.8, 0.8) for _ in range(rng.randint(0, 2))]
pre = [rng.choice((-1.0, 1.0)) for _ in range(len(f) - 1)]
x = [rng.choice((-1.0, 1.0)) for _ in range(9)]
y = [v + rng.gauss(0, 0.6) for v in transmit(x, [f] * 9, pre)]
d, est = psp_viterbi(y, f, 0.0, pre=pre)
assert d == ml_by_search(y, f, pre)
assert est == f
def test_drifting_channel() -> None:
# taps 1, 0.5, 0.3 plus 0.4 sin(2 pi n / 500 + k), noise variance 0.05, seed 8001
rng = random.Random(8001)
n = 3000
taps = drifting_channel(n, [1.0, 0.5, 0.3], 0.4, 500)
x = [rng.choice((-1.0, 1.0)) for _ in range(n)]
pre = [-1.0, -1.0]
y = [v + rng.gauss(0, math.sqrt(0.05)) for v in transmit(x, taps, pre)]
genie = genie_viterbi(y, taps, pre)
fixed, _ = psp_viterbi(y, taps[0], 0.0, pre=pre)
psp, _ = psp_viterbi(y, taps[0], 0.05, pre=pre)
assert errors(genie, x) == 1
assert errors(fixed, x) == 297
assert errors(psp, x) == 0
assert errors(psp, genie) == 1 # agrees with the genie on 2999 of 3000 symbols
slow, _ = psp_viterbi(y, taps[0], 0.01, pre=pre)
assert errors(slow, x) == 70 # a small step lags behind the drift
def test_learns_the_channel_from_a_wrong_start() -> None:
rng = random.Random(8003)
n = 1000
h = [1.0, 0.5, 0.3]
x = [rng.choice((-1.0, 1.0)) for _ in range(n)]
pre = [-1.0, -1.0]
y = [v + rng.gauss(0, math.sqrt(0.05)) for v in transmit(x, [h] * n, pre)]
blind, _ = psp_viterbi(y, [1.0, 0.0, 0.0], 0.0, pre=pre)
d, est = psp_viterbi(y, [1.0, 0.0, 0.0], 0.02, pre=pre)
assert errors(blind, x) == 44
assert errors(d, x) == 0
assert max(abs(a - b) for a, b in zip(est, h)) < 0.05
def test_no_memory_and_input_checks() -> None:
d, est = psp_viterbi([0.9, -1.2, 0.1], [1.0], 0.1)
assert d == [1.0, -1.0, 1.0]
# f = 1 + 0.1(-0.1) = 0.99, then 0.99 + 0.1(-0.21)(-1) = 1.011, then 1.011 + 0.1(-0.911) = 0.9199
assert abs(est[0] - 0.9199) < 1e-12
with pytest.raises(ValueError):
psp_viterbi([1.0], [], 0.1)
with pytest.raises(ValueError):
psp_viterbi([1.0], [1.0, 0.5], 0.1, pre=[1.0, 1.0])
Exercises
- Show by induction that, after time , the estimate of each state is the LMS estimate run on the symbols of its own survivor.
- Show that with the receiver gives the same decisions as the Viterbi equalizer for .
- For the channel with one tap , the step size 0.1 and , compute the decisions and the final estimate by hand. (The answer is and 0.9199.)
- A conventional adaptive Viterbi equalizer updates one estimate with the decision made steps back. Explain why it must predict the channel steps ahead on a fast-fading channel, and why PSP does not.
- Count the operations per symbol for PSP with RLS on a channel with taps and symbols, and compare them with a single RLS estimator.
Proof: Each survivor's estimate is the LMS estimate driven by that survivor's own symbols, and with the step size 0 the receiver is the maximum likelihood Viterbi equalizerfull
The received samples are with real symbols from an alphabet of points, and the symbols before the block are known (the argument pre). The trellis state at time is , most recent first. For the state and the new symbol , the branch vector is , of length , and the next state is the first entries of . Each state that is reached holds a metric , a channel estimate and a back pointer. The step size is .
Lemma 1 (one survivor per state). After time , every state that is reached has exactly one survivor: the sequence obtained by following the back pointers from . Its metric is
where is the branch vector of the survivor at time and is the estimate that the survivor held before time .
Proof. By induction on . Before time 0 only the known start state is reached, with metric 0 (line L1). At time , line L3 extends every reached state by every symbol , line L4 computes the error with the estimate of , and line L5 keeps, for each next state , the branch with the smallest . The kept branch extends the survivor of , so the survivor of is the survivor of followed by , and its metric is the metric of plus the new term.
Lemma 2 (the estimate follows its own survivor). After time , the estimate of the state is the result of the LMS recursion
run for on the symbols of the survivor of .
Proof. By induction on , with Lemma 1. Line L6 computes the estimate of from the estimate of the winning predecessor , with the error and the branch vector of the winning branch. By the induction hypothesis, the estimate of is the LMS result on the survivor of , and the survivor of is that survivor followed by the winning branch.
So no estimate uses a symbol that its own survivor does not contain, and every estimate is updated at time with the symbol of its survivor, without a decision delay. A receiver with one estimator must wait until the survivors merge before it can trust a decision. Here each hypothesis is carried with its own channel.
Theorem 1 (step size 0). If , the decisions equal the maximum likelihood sequence for the channel and white Gaussian noise, and the returned estimate is .
Proof. With , line L6 copies the estimate, so by Lemma 2 every estimate is at every time. Then the branch metric in line L4 is , the same for every survivor, and the metric of Lemma 1 is the squared distance between and the noiseless output of the survivor. This is the add-compare-select of the Viterbi algorithm on the trellis of the channel . The cost of a whole sequence is a sum of branch costs that depend only on the state and the new symbol, so the principle of optimality applies: if the best sequence passes through the state at time , its first symbols are the best path into , which is the survivor of . Line L7 takes the end state with the smallest metric and follows the back pointers, so it returns the sequence with the smallest squared distance. For white Gaussian noise this is the maximum likelihood sequence.
Theorem 2 (the cost). With states, each time step evaluates branches at each and updates estimates at each. A block of samples costs time, the same order as the Viterbi equalizer with a known channel, and space for the back pointers and the estimates.
Proof. Count the work in lines L3 to L6 for one time step, and multiply by . The traceback in line L7 costs .
With , the receiver is not the maximum likelihood detector for an unknown channel. Lemma 2 gives what it is: a Viterbi search in which every path is scored by the prediction errors of its own adaptive channel estimate. The page reports measured error counts for this case.
References
- Riccardo Raheli, Andreas Polydoros and Ching-Kae Tzou, Per-survivor processing: a general approach to MLSE in uncertain environments, IEEE Transactions on Communications 43(2/3/4), 1995, pages 354 to 364, the principle of per-survivor processing, with channel identification, phase tracking and reduced-state examples
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H2 full proof |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 24BB6C Edit this page History Report an error Markdown