OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Developer Tools & SDKs

backprop

backprop is a Haskell library for automatic differentiation that computes gradients of user-defined functions, including functions with heterogeneous intermediate values and parameter structures.

Independent OpenViST project profile, based on linked sources.

backprop — Automatic gradients in differentiable Haskell code
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use backprop when a Haskell program already expresses the computation or loss function and needs gradients for numerical optimization or parameter updates.

Who it is for

  • Haskell developers building differentiable numerical programs.
  • Developers implementing optimization or training code for numerical models.

Documented uses

  • Compute a function’s derivative or gradient at chosen inputs.
  • Obtain gradients for parameters in a model with matrix, vector, and scalar components.
  • Use gradients as input to a numerical optimization or model-training routine.
Before you choose

Requirements & limits

  • The documented project setup adds backprop through Cabal or package.yaml dependencies.
  • The neural-network example relies on hmatrix-related operations and additional Haskell tooling, including lens accessors and Template Haskell.
  • The library computes gradients; model definition, loss construction, and parameter-update logic remain part of the user's code.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Add backprop and compute a function’s gradient

Set up the library as a Haskell project dependency and apply automatic differentiation to a function.

Before you start

  • A Haskell package using Cabal or package.yaml.

Steps

  1. Add backprop to the package's build-depends field.

  2. Import Numeric.Backprop.

  3. Define a Haskell function, then use gradBP on the function and an input value to obtain its gradient.

Expected outcome

The project can evaluate a defined function and compute its gradient at an input.

Guide limitations

  • The guide demonstrates a scalar example; it does not specify compiler or package-version requirements.
Source-based practical guide

Compute gradients for a heterogeneous network loss

Follow the documented pattern for obtaining gradients of a network loss with respect to parameters of different types.

Before you start

  • A Haskell project with backprop.
  • The documented example uses hmatrix and hmatrix-backprop, lens accessors, and Template Haskell.

Steps

  1. Represent network parameters with matrix and vector fields and make the network type an instance of Backprop.

  2. Write a function that runs the network and a loss function that evaluates its output.

  3. Apply gradBP to the loss function and network parameters to obtain their gradients.

Expected outcome

The loss gradient is available for the network’s parameter structure, including its weights and biases.

Guide limitations

  • The example outlines adjusting parameters in the opposite direction of the gradient but does not give a complete training loop or update implementation.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
20 November 2026
Original website title
backprop - Home · Official homepage title · retained in its source language