Hasty Briefsbeta

Backpropagating through a maze with candle and WASM

18 days ago
  • #maze-solving
  • #gradient-descent
  • #WebAssembly
  • The demo uses gradient descent to solve a discrete maze without a neural network.
  • It runs entirely on the local device using candle and Rust's WebAssembly support.
  • The maze navigation is solved by relaxing the discrete problem into a differentiable stochastic formulation.
  • State representation is a 2D probability grid over possible positions.
  • Five possible actions are available at each time step: up, right, down, left, and noop.
  • Transition dynamics are pre-computed for each action, allowing gradient-based optimization.
  • Direct logit parameterization is used with time-dependent logits for position-independent action probabilities.
  • State evolution involves probability mass flowing according to valid actions and transitions.
  • The learning objective is to maximize the probability of reaching the goal after a set number of steps.
  • The algorithm initializes parameters randomly and updates them via the Adam optimizer.