Softmax (“Scores into chances”) divides each exp(score) by the total of them all. Scores now arrive one at a time and can’t be kept, so keep a small state instead: [biggest, total], the biggest score so far and total = Σ exp(score − biggest) over the scores so far, measured from that biggest one so nothing overflows. Before the first score the state is None. Write update(state, score): the new state after one more score arrives.
Scores arrive one at a time and drop off the end: they can’t be kept. All that stays is a two-slot memory, the biggest score so far and a running total. Watch the scores go by, then say what the total should hold.
update(state, score)| state | [biggest score so far, total of exp(s - biggest)], or None at the start | e.g. None |
| score | the score that just arrived | e.g. 3 |
| returns | the new state | |