Article on neural nets on orbital for python - #382
Merged
Conversation
✅ Deploy Preview for posit-open-source canceled.
|
EmilHvitfeldt
approved these changes
Aug 18, 2026
|
|
||
| Orbital's whole pitch is that a trained model becomes SQL, so a database can run predictions on its own, with no Python process anywhere near it. Until 0.6.0, "trained model" meant scikit-learn: pipelines, trees, linear models, all `.fit()` in Python and then turned into a `SELECT` statement. It never covered what a lot of teams are actually training now: PyTorch models, not scikit-learn pipelines. | ||
|
|
||
| Orbital 0.6.0 closes that gap. A `torch.nn.Sequential` network, trained exactly the way you already train it, now compiles to the same kind of SQL a linear regression would. |
Contributor
There was a problem hiding this comment.
Very good tying this back to linear regression!
Comment on lines
+55
to
+57
| Scikit-learn and PyTorch are both real and shipping today, which is enough on its own to call this "multiple frameworks." But the dependency story is already moving that direction: [issue #113](https://github.com/posit-dev/orbital/issues/113) proposes turning scikit-learn itself into an optional dependency, the same way PyTorch already is, so the core stops assuming any particular framework at all. | ||
|
|
||
| There are more frameworks already in the works. I won't name them here, only that the architecture was built for exactly this. |
Contributor
There was a problem hiding this comment.
I think this section is getting a little long, instead i think we would get a lot more bang for our buck if we move this to the end of the post as a "hope you like what you see, look forward to more expansions in the future"
|
|
||
| The fix, `Optimizer.preserve_referenced_outputs()`, runs after every single node in the translation loop, for every translator, not just `MatMul` and `Add`, and checks how many times that node's output is actually referenced downstream. Referenced more than once, it gets materialized as a named column. Referenced once or not at all, it stays inlined, no extra column, no extra noise. | ||
|
|
||
| None of this is new machinery either. Tree ensembles already lean on the same trick: `preserve()` materializes per-tree votes, or the whole ensemble's aggregated vote so it isn't re-emitted everywhere it's read, as real SQL columns. `preserve_referenced_outputs()` just applies that same idea automatically, after every step, instead of leaving it to each translator to do it by itself. |
Contributor
There was a problem hiding this comment.
The same idea is used in a pipeline, instead of inlining everything we create the intermediary values
Contributor
Author
|
@EmilHvitfeldt applied your feedback, let me know if it looks good to you |
Contributor
Blog YAML Checks
|
Contributor
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Article on the newly released Orbital for Python 0.6.0 with support for PyTorch neural networks.