Scan a selective state-space recurrence
Run the forward scan of a small selective state-space model.
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.
Input state is an initial vector. Each entry in steps has input (scalar), decay, write and read (vectors matching state) and skip (scalar). At each step update state[j] = decay[j]×state[j] + write[j]×input. Output read·updated_state + skip×input. Return output and final state. The coefficients are supplied after discretization; the learning and parallel-scan kernels are outside this exercise.
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
Run the forward scan of a small selective state-space model.
Reproduction
{"state":[2,4],"steps":[{"input":1,"decay":[0.5,1],"write":[1,-1],"read":[1,1],"skip":0},{"input":2,"decay":[0,0.5],"write":[2,1],"read":[1,2],"skip":0.1}]}{"output":[5,11.2],"state":[4,3.5]}{"state":[2,4],"steps":[]}{"output":[],"state":[2,4]}{"state":[5],"steps":[{"input":2,"decay":[0],"write":[1],"read":[1],"skip":0}]}{"output":[2],"state":[2]}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.