HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelfā™§ 0
← Back to top all-time
breandan
kotlingrad
Kotlin2019–2022
breandan / kotlingrad

kotlingrad

🧩 Shape-Safe Symbolic Differentiation with Algebraic Data Types

4Distinct people
13Mentions
0Explicit recommenders
545GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

🧩 Shape-Safe Symbolic Differentiation with Algebraic Data Types

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC Ā· Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year13 dated mentions

Observed mentions: 2019-01-18 18:25:36 UTC to 2022-05-04 20:52:00 UTC.

02462019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 6 mentions; 2 submissions, 4 comments20192020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2022

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC624
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC110
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC413
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC202

What Hacker News says

13 sources
I really don't see how Scala is not fit for this. Swift for Tensorflow was mainly revolving around the Differentiable protocol. There is a paper published in 2019 from Purdue University where they show how AD can be combined with multi-stage programming in Scala. [1] DeepLearning.scala that does compile-time reverse AD. [2] Compute.scala for operator fusion at runtime (JITifying) [3] Here [4] is a Pre-SIP to add reifiable control flow to Scala compiler so AD and operator fusion could happen at compile-time. Moreover, Kotlin also has a library that does type-safe AD. [5] nVidia and Oracle want better interopabiltiy between CUDA and GraalVM through grCuda. [6] [1] Demystifying Differentiable Programming: Shift/Reset the Penultimate Backpropagator - https://arxiv.org/pdf/1803.10228.pdf [2] https://github.com/ThoughtWorksInc/DeepLearning.scal
Read the rest
In Swift for TensorFlow Shuts Down
Author here, thank you for your kind remarks! You’re right, the backticks surrounding our type level integers are too distracting. The Kotlin grammar [1] requires class names must either start with a letter, or be enclosed by back-ticks. Unless the Kotlin language designers reconsider the identifier scheme [2] (?), we would be better off replacing these with something like T1, T2, ..., TN for readability and to minimize confusion. Re: Shape Inference. To properly understand how this works, the best place to start is by looking at ToyVectorExample.kt [3]. Once you’re comfortable with that, ToyMatrixExample.kt is a fairly direct generalization. The best way to explain our type system is that we stick to equality checking and perform manual type conversion for tensor contractions and expansions. Haven’t figures out a good way to do concatena
Read the rest
tion, slicing, or convolution which require type-level arithmetic. This may be feasible for a fixed number set of predefined shapes, but seems to be generally intractable in the Java/Kotlin type system without a significant overhead. But if someone has an idea, I would be very happy to be proven wrong about this! [1]: https://kotlinlang.org/docs/reference/grammar.html [2]: https://github.com/Kotlin/kotlin-spec/blob/master/grammar/sr... [3]: https://github.com/breandan/kotlingrad/blob/master/src/main/... [4]: https://github.com/breandan/kotlingrad/blob/master/src/main/...
In Kotlingrad: A shape-safe DSL for differentiable programming
Thanks for checking out our project! Completely understand where you're coming from, I also struggled with imagining how differentiable programs could work, after all, computer programs implement discrete functions! When building it, I learned two surprising facts: (1) We can perform gradient descent on integer functions! [1] There are rigorous assumptions for differentiability (e.g. Lipschitz-continuity, β-smoothness), but most often, these don't apply in the real world. Although many discrete optimization problems can relaxed to semi-differentiable ones, even if a function is not strictly differentiable, we can still derive an approximately correct expression for the gradient. (2) It is possible to symbolically derive functions in discrete spaces! There are many, many examples of this in various settings (e.g. Brzonski's derivative [2]
Read the rest
, Lambda calculus [3], Boolean algebra [4], et al. [5]). A number of researchers are studying generalized differentiation, or "change propagation" in other topological spaces [6]. Although still very abstract and hard to interpret, these ideas have important applications for incremental computation and together with probabilistic programming [7], may one day lead to an analogous mechanism to gradient descent on a much broader class of functions. With this in mind, Kotlinš› implements symbolic differentiation. Whenever the user writes "+" or "*" in their program and later asks for the derivative, we apply the sum and product rules, and do not consider the question of domain validity. For floating point numbers, we try to perform some consistency checks using finite differences, but ultimately, leave this up to the user to verify whether their their domain is a valid one. Shameless plug, but if you find this interesting, you can learn more about this in Chapter 3 of my M.S. thesis [8]. Please don't hesitate to get in touch if you have any questions or would like to chat! [1]: https://openreview.net/pdf?id=HJGXzmspb [2]: http://maveric.uwaterloo.ca/reports/1964_JACM_Brzozowski.pdf [3]: https://core.ac.uk/download/pdf/82396223.pdf [4]: https://pdfs.semanticscholar.org/a9c8/7568463a5ce8c2cd15ec17... [5]: https://en.wikipedia.org/wiki/Generalizations_of_the_derivat... [6]: https://arxiv.org/pdf/1902.05465.pdf [7]: https://www.cs.ubc.ca/~fwood/CS532W-539W/ [8]: https://github.com/breandan/kotlingrad/blob/master/latex/the...
In Kotlingrad: A shape-safe DSL for differentiable programming
Hello HN, author here! Been working on this DSL for differentiable programming for a while now. The API is starting to stabilize and it would be great to collect feedback from real users. You can find some toy examples, including the core of our implementation here: https://github.com/breandan/kotlingrad/tree/master/src/main/... Please feel free to reach out if you have any questions or comments. Thanks so much for your feedback!
In Kotlingrad: A shape-safe DSL for differentiable programming

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.