46 points by alxmrs 3 hours ago | 11 comments
sixdimensional 18 minutes ago
In the past platforms have integrated ML algorithms into relational databases and SQL through extensions (both commercial and open source). A famous open source one was MADlib [1], which has an implementation of neural networks. Even the commercial ones were similar, I used ML algorithms in SQL Server many years ago around 2005 I think.

I am wondering about.. SQL as a declarative structured query language that can be optimized into essentially any kind of distributed, directed acyclic graph of processing - vs the special characteristics of relational databases (relational algebra, relvars, etc. etc.) is an important distinction as - of yet, I see the author linking both together so I'm trying to understand what it is about relational structures that specifically helped here (just not seeing it yet, not that it isn't there).

Also, wondering if ISO/IEC 9075-15:2023 SQL standard for multidimensional arrays (MDA) is of any use here? Paper describing SQL/MDA here [2].

[1] https://madlib.apache.org/documentation.html

[2] https://www.ifis.uni-luebeck.de/~moeller/Lectures/WS-19-20/N...

alxmrs 1 minute ago
I need to better understand your first question before I can comment. In theory, we could work with MADlib too -- what we do is port scientific data, which typically is a "tensor" or Nd array, into a tabular view. I believe you know relational theory better than I do, I am still fairly new to the field.

WRT ISO/IEC 9075-15:2023: This is the standard established from rasdaman, IIUC. I reject this approach (which treats arrays as a column type), and instead adopt one inspired by Michael Stonebraker's SciDB (which treats arrays as tables themselves). For an in depth review of the topic, I recommend this NSF paper: https://par.nsf.gov/servlets/purl/10545560

sporkl 1 hour ago
I've been working on something similar, implementing a relational language on top of a tensor library[0].

Mathematically, einsum and database joins are the same thing, just over different semirings (real numbers for einsum, booleans for databases). A lot of papers about datalog explore this sort of thing in more depth. In particular, Dyna[1] might be interesting.

[0]: https://arxiv.org/abs/2509.22614 [1]: https://dyna.org/

HPsquared 2 hours ago
Somewhat more reliable than implementing SQL in neural networks.
2 hours ago
1 hour ago
tommica 3 hours ago
I'm just going to go back to making my CRUD endpoints...

Jokes aside, sounds really impressive, though I only understood about 10% :D

0xnyn 2 hours ago
initially rolled my eyes at "neural networks in SQL," but after reading the code I came away impressed

basically it comes down to using relational algebra as the IR, letting a database optimizer reason about tensor programs

alxmrs 2 hours ago
I would have had the same gut reaction as you lol.

You’re spot on. I think that SQL, as a data oriented and logic PL, might be ideal for writing tensor programs.

soupspaces 1 hour ago
Neat! Feels analogous to "X runs Doom" demos (but NN).
simonw 1 hour ago
Just today I saw this implementation of DOOM in SQLite using a recursive CTE for a simple ray tracer: https://github.com/petergpt/doomql
alxmrs 1 hour ago
Totally. I can’t wait to take this to https://hytradboi.com
iqbal1980 2 hours ago
Why? lol
throwaway613746 1 hour ago
[dead]
slipperybeluga 3 hours ago
[dead]