Program Transformation Lab
General Information
... on the administrative structure of the lab can be found here.
Topic: Derivative & Differentiability Sanitizer
Derivative Sanitizer:
Develop a tool for the automatic sanitization of Python subprograms subject to the local gradient norm. Given a numerical Python code, the sanitizer should allow the user to compute gradients/Jacobians for selected subprograms (function calls). The Gradient/Jacobian norms should be compared to a threshold, and if that threshold is reached, a warning should be issued at runtime. The derivative should be calculated before the actual function call via finite differences or an automatic differentiation (AD) tool (e.g., Pytorch, JAX, etc.).
Requirements:
- The user should be able to select a list of subprograms (function calls) that are instrumented with the derivative check
- By default, all numerical outputs should be differentiated with respect to all numerical inputs. The user should also be able to define a subset of input/output arguments (e.g., via a config file or via in-code annotations)
- The user should be able to define an upper bound for the derivative norm. If the norm is higher than the threshold, a warning should be issued with a comprehensible warning message (line number, function, argument name)
- The user should be able to select how the derivatives are computed: Finite Differences or via tangent/adjoint mode of an AD tool (e.g., Pytorch, JAX, etc.).
- Floating-point types, as well as numpy arrays, should be supported as argument types
- Non-pure functions should be supported, i.e., functions that change a local/global state. The states must be recovered after the derivative calculation for the actual function call.
- Optional: If inputs/outputs are in structs or global variables, the user should be able to specify those via annotations or in the config file.
Differentiability Sanitizer:
The tool should be extended with a non-differentiability check. The check can be performed by comparing the finite-difference solution with the AD tool. A large relative error might indicate potential non-differentiability.
Requirements:
- The user should be able to set a threshold for the relative finite-difference error.
- If the norm or the error is higher than the corresponding threshold, a warning should be issued with a comprehensible warning message (line number, function, argument name)
- The user should be able to select the mode of operation: Derivative norm, non-differentiability check, or both.
Differential Invariant Sanitizer:
A differential invariant < x(1), x(1) > = <y(1), y(1) > relates the inner vector product of input tangents (x(1)) and input adjoints (x(1)) to the inner vector product of output tangents (y(1)) and output adjoints (y(1)) [1,3]. We want to check this invariant at selected points in the code.
Requirements:
- The user should be able to define the global inputs
- The user should be able to define the locations where the differential invariant is validated (e.g., before or after a specified function call)
- The user should be able to decide whether the seeds (input tangents and output adjoints) are generated randomly (with a specified seed) or are set to be the Cartesian unit vectors.
Organization
There are various jobs that can be distributed across team members:
- Implementation & design of the sanitizers
- Documentation
- Software testing / Quality assurance
Distribute these jobs among yourselves. Not everyone has to do the implementation. Especially a division between implementation and testing/QA can help to find usability issues more quickly.
Non-functional Requirements:
- Use git
- Set up CI pipelines for testing
- Use Python formatters/linters (black, mypy, flake8, pyright, pydocstyle, darglint, interrogate, etc.)
Agenda
- Kick-Off: 17.04.2026 at 11am, room 231, IT Center, Seffenter Weg 23.
- Proposal and Requirements: Presentation on 08.05.2026 at 2pm room 231.
- Design: Presentation on 19.06.2026 at 2pm in room 231.
- Final Presentation on 17.07.2026 at 2pm in room 231.
- Publication (PDF report + Software Repo) by 26.07.2026 at 11:59pm.
