Differentiable Swift Feb 2026 update

Hello everyone!

It's been a while since our last update!
There's quite a lot to talk about. Over the last period we’ve been working on improving stability and performance, as well as adding support for more language features and platforms! For more details keep reading!

We now also have our own spot on the forums in the Differentiable Swift category. Please feel free to ask any questions there! Differentiable Swift - Swift Forums

New features as of Swift 6.3

We're very excited about the following features we've enabled for Swift 6.3

@_alwaysEmitIntoClient

This feature was mentioned in the last update. We can now define derivatives for functions marked with @_alwaysEmitIntoClient thanks to the work by @kovdan01 in:

Throwing functions

We can now define derivatives for functions that throw! (Either typed or untyped throws)

Wasm support

Thanks to help from Max Desiatov, Differentiable Swift is now available for Wasm as well!

performance improvements

bugfixes

Ongoing toolchain work

Differentiation for new accessors (read/modify)

This was also mentioned in the future work section of our previous update. We are still working towards completing this feature Check / implement automatic differentiation for new kinds of accessors · Issue #86405 · swiftlang/swift · GitHub
The latest progress/PR can be found here Add AST representation for coroutines by asl · Pull Request #85372 · swiftlang/swift · GitHub

Variadic differential operators

Currently we can only call valueWithPullback with 1 to 3 parameters. We can get around this by packing inputs together into structs but this is not always ideal.
We're working towards parameter pack based differential operators to enable using more parameters and reduce duplication. The relevant issue

Protocol default derivatives

We're working on being able to register default derivatives for protocols. This will allow us to add a lot more derivatives for standard library functions.

Differentiable curry

As described in the original issue: [SR-11882] [AutoDiff] Implement the differentiable curry · Issue #54297 · swiftlang/swift · GitHub
This enables currying differentiable functions without losing differentiability with respect to any function parameter. For more info check here and/or here
This will allow us to support @autoclosure but also differentiating w.r.t. captured values in closures.
[AutoDiff] Initial support for differentiable curry by kovdan01 · Pull Request #87004 · swiftlang/swift · GitHub

Differentiable closure specialization

We're working on a performance pass specifically aimed at closures produced by autodiff. The previously finished and ongoing work can be seen here:

Library updates

New library features

We've spent quite some time on unifying and improving working with Collections using differentiable Swift. The following is available in swift-differentiation as of today. But this is very much work in progress and more is planned to follow!

swift-differentiation (GitHub - differentiable-swift/swift-differentiation · GitHub)

  • Differentiable conformance for InlineArray
  • Differentiable conformance for ContiguousArray
  • Differentiable conformance for Repeated
  • Differentiable conformance for ArraySlice
  • Added differentiableZip
  • Added `runWithoutDerivative

Ongoing library work

With the added support for throwing functions in 6.3 we'll be implementing a few derivatives commonly used functions that throw. We're also continuing our work to improve the user experience of working with collections in differentiable code.

swift-differentiation (GitHub - differentiable-swift/swift-differentiation · GitHub)

  • add throwing differentiableMap
  • add throwing differentiableReduce
  • differentiableZip performance improvements
  • more differentiable collection operators like gather, permute, scatter

Thanks

A lot of thanks go out to the following people since our last update.

26 Likes