Mix residual streams with Sinkhorn normalization
Project mixing logits into an approximately doubly stochastic residual matrix.
What’s going wrong
Original LLM Architecture lab. Implement the missing behavior in solve(data) and keep the supplied JSON interface. Use Python’s standard library.
Given an S×S logits matrix, streams (S feature vectors) and positive iterations, exponentiate after subtracting the global maximum. Logit range is at most 100. Each iteration normalizes every row by its sum and then every column by its sum. Return mixing and output = mixing×streams. Run exactly the requested number of iterations.
Small, well-formed JSON inputs and standard-library Python arithmetic. Keep full precision during computation. The supplied output wrapper rounds results to six decimal places.
Expected behavior
Project mixing logits into an approximately doubly stochastic residual matrix.
Reproduction
{"logits":[[3,1],[0,2]],"streams":[[1,2],[5,6]],"iterations":6}{"mixing":[[0.880797,0.119203],[0.119203,0.880797]],"output":[[1.476812,2.476812],[4.523188,5.523188]]}{"logits":[[1]],"streams":[[2,3]],"iterations":4}{"mixing":[[1]],"output":[[2,3]]}{"logits":[[1,1],[1,1]],"streams":[[2],[6]],"iterations":2}{"mixing":[[0.5,0.5],[0.5,0.5]],"output":[[4],[4]]}Before you begin
- Python functions, lists and dictionaries
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
Read the report, then sign in to start your investigation.