HNHacker News
TopNewBestAskShowJobs

taliesinb

2,464 karma · joined July 25, 2010

Category theory and AI @ symbolica.ai

https://tali.link

https://twitter.com/taliesinb

submissionscomments
taliesinb··on Sonnet 5.5
What are your half dozen active projects? And did AI use make you more ambitious about what those projects could be?
taliesinb··on Two studies in compiler optimisations
Interesting. It all seems very brittle, though. And that something has gone very wrong with our ecosystem of tools, languages, and processes when it becomes advisable to massage source until specific passes in a specific version LLVM don't mess things up for other passes.

Not picking on the OA in the slightest; just thinking in terms of holistic system design. If you know what you want to happen, and you are smart enough to introspect the behavior of the tool and decide that it didnt happen, you are more than smart enough to just write it correctly in the first place.

Perhaps that is unrealistic, perhaps there is a hidden iceberg of necessary but convolutive optimizations no human could realistically or legibly write. But ok, where do you really need to engage in this kind of optimization golf? Inlined functions?

Ok, what about this targeted language feature for a future-day Zig:

1. Write an ordinary zig function 2. Write inline assembly version of that function 3. Write a "comptime assert" that first compiles to second, which only "runs" for the relevant arch. 4. What should that assert mean? That the compiler just uses your assembly version instead, but _also_ uses existing compiler machinery or an external theorem prover to verify they "behave the same up to X", for customizable values of X

That has the right feel, maybe. You are "pinning" specific, vetted, optimizations without compromising the intent, readability, or correctness of your code. And easy iteration is possible, because a failing comptime assert will just dump the assembly; you can even start with an empty manual impl.

taliesinb··on Show HN: Duplicate 3 layers in a 24B LLM, logical deduction .22→.76. No training
Amusingly, you need only have circuits of prime depth, though you should probably adjust their widths using something principled, perhaps Euler's totient function.
taliesinb··on Show HN: Duplicate 3 layers in a 24B LLM, logical deduction .22→.76. No training
And i bet these would be useful in initial and final parts of transformer too. Because syntactic parsing and unparsing of brackets, programming language ASTs, etc is highly recursive; no doubt current models are painfully learning "unrolled" versions of the relevant recursive circuits, unrolled to some fixed depth that must compete for layers with other circuits, since your total budget is 60 or whatever. Incredibly duplicative and by definition unable to generalize to arbitrary depth!
taliesinb··on Show HN: Duplicate 3 layers in a 24B LLM, logical deduction .22→.76. No training
There is an obvious implication: since the initial models were trained without loops, it is exceedingly unlikely that a single stack of consecutive N layers represents only a single, repeatable circuit that can be safely looped. It is much more likely that the loopable circuits are superposed across multiple layers and have different effective depths.

That you can profitably loop some say 3-layer stack is likely a happy accident, where the performance loss from looping 3/4 of mystery circuit X that partially overlaps that stack is more than outweighed by the performance gain from looping 3/3 of mystery circuit Y that exactly aligns with that stack.

So, if you are willing to train from scratch, just build the looping in during training and let each circuit find its place, in disentangled stacks of various depths. Middle of transformer is:

(X₁)ᴹ ⊕ (Y₁∘Y₂)ᴺ ⊕ (Z₁∘Z₂∘Z₃)ᴾ ⊕ …

Notation: Xᵢ is a layer (of very small width) in a circuit of depth 1..i..D, ⊕ is parallel composition (which sums the width up to rest of transformer), ∘ is serial composition (stacking), and ᴹ is looping. The values of ᴹ shouldnt matter as long as they are > 1, the point is to crank them up after training.

Ablating these individual circuits will tell you whether you needed them at all, but also roughly what they were for in the first place, which would be very interesting.

taliesinb··on Unison 1.0
If you could link to where this is implemented I'd be very grateful!
taliesinb··on Unison 1.0
Hello! Yes I am curious, how does one deal with cycles in the code hash graph? Mutually recursive functions for example?
taliesinb··on Mysterious cosmic 'dots' are baffling astronomers. What are they?
I’ve been super interested in these kinds of cosmic turduckens. See also https://en.wikipedia.org/wiki/Thorne%E2%80%93%C5%BBytkow_obj... and https://en.wikipedia.org/wiki/Quasi-star
taliesinb··on Implementing a functional language with graph reduction (2021)
Given that whole name binding thing is ultimately a story of how to describe a graph using a tree, I was primed to look for monoidal category-ish things, and sure enough the S and K combinators look very much like copy and delete operators; counit and comultiplication for a comonoid. That’s very vibe-based, anyone know of a formal version of this observation?
taliesinb··on The algebra and calculus of algebraic data types (2015)
Yes, this is a very cool story.

But, fascinatingly, integration does in fact have a meaning. First, recall from the OP that d/dX List(X) = List(X) * List(X). You punched a hole in a list and you got two lists: the list to the left of the hole and the list to the right of the hole.

Ok, so now define CrazyList(X) to be the anti-derivative of one list: d/dX CrazyList(X) = List(X). Then notice that punching a hole in a cyclic list does not cause it to fall apart into two lists, since the list to the left and to the right are the same list. CrazyList = CyclicList! Aka a ring buffer.

There's a paper on this, apologies I can't find it right now. Maybe Alternkirch or a student of his.

The true extent of this goes far beyond anything I imagined, this is really only the tip of a vast iceberg.

taliesinb··on Show HN: Mandala – Automatically save, query and version Python computations
Cool! Looks pretty professional.

I explored a similar idea once (also implemented in Python, via decorators) to help speed up some neuroscience research that involved a lot of hyperparameter sweeps. It's named after a Borges story about a man cursed to remember everything: https://github.com/taliesinb/funes

Maybe one day we'll have a global version of this, where all non-private computations are cached on a global distributed store somehow via content-based hashing.

taliesinb··on Exploring biphasic programming: a new approach in language design
The end-game is just dissolving any distinction between compile-time and run-time. Other examples of dichotomies that could be partially dissolved by similar kinds of universal acid:

* dynamic typing vs static typing, a continuum that JIT-ing and compiling attack from either end -- in some sense dynamically typed programs are ALSO statically typed -- with all function types are being dependent function types and all value types being sum types. After all, a term of a dependent sum, a dependent pair, is just a boxed value.

* monomorphisation vs polymorphism-via-vtables/interfaces/protocols, which trade roughly speaking instruction cache density for data cache density

* RC vs GC vs heap allocation via compiler-assisted proof of memory ownership relationships of how this is supposed to happen

* privileging the stack and instruction pointer rather than making this kind of transient program state a first-class data structure like any other, to enable implementing your own co-routines and whatever else. an analogous situation: Zig deciding that memory allocation should NOT be so privileged as to be an "invisible facility" one assumes is global.

* privileging pointers themselves as a global type constructor rather than as typeclasses. we could have pointer-using functions that transparently monomorphize in more efficient ways when you happen to know how many items you need and how they can be accessed, owned, allocated, and de-allocated. global heap pointers waste so much space.

Instead, one would have code for which it makes more or less sense to spend time optimizing in ways that privilege memory usage, execution efficiency, instruction density, clarity of denotational semantics, etc, etc, etc.

Currently, we have these weird siloed ways of doing certain kinds of privileging in certain languages with rather arbitrary boundaries for how far you can go. I hope one day we have languages that just dissolve all of this decision making and engineering into universal facilities in which the language can be anything you need it to be -- it's just a neutral substrate for expressing computation and how you want to produce machine artifacts that can be run in various ways.

Presumably a future language like this, if it ever exists, would descend from one of today's proof assistants.

taliesinb··on Zig Goals
An earnest question: can you elaborate on what Zig got wrong in that respect?
taliesinb··on Ask HN: Who is hiring? (June 2024)
In another life!
taliesinb··on Ask HN: Who is hiring? (June 2024)
Yes, get in touch with me.
taliesinb··on Ask HN: Who is hiring? (June 2024)
Symbolica.ai | London, Australia | REMOTE, INTERNS, VISA

We're trying to apply the insights of category theory, dependent type theory, and functional programming to deep learning. How do we best equip neural nets with strong inductive biases from these fields to help them reason in a structured way? Our upcoming ICML paper gives some flavor https://arxiv.org/abs/2402.15332 ; you can also watch https://www.youtube.com/watch?v=rie-9AEhYdY&t=387s ; but there is a lot more to say.

If you are fluent in 2 or more of { category theory, Haskell (/Idris/Agda/...), deep learning }, you'll probably have a lot of fun with us!

Check out our open positions at https://jobs.gusto.com/boards/symbolica-ai-67195a74-31b4-405...

taliesinb··on Einsum for Tensor Manipulation
No worries! Yes, exactly. It's also similar to doing arithmetic with and without units. Sure, you can do arithmetic without units, but when you are actually working with real-world quantities, but you easily get yourself into a muddle. Unit-carrying quantities and algebraic systems built on them prevent you from doing silly things, and in fact guide you to getting what you want.
taliesinb··on Einsum for Tensor Manipulation
Looks interesting, but your link is broken, can you try again or give us a direct PDF or Arxiv link?
taliesinb··on Einsum for Tensor Manipulation
Thanks for highlighting XArray in your other comments. Yup, XArray is great. As are Dex and the various libraries for named axis DL programming within PyTorch and Jax. I never said these things don't exist -- I even mention them in the linked blog series!

But I do think it's fair to say they are in their infancy, and there is a missing theoretical framework to explain what is going on.

I anticipate name-free array programming will eventually be considered a historical curiosity for most purposes, and everyone will wonder how we put up without it for so long.

taliesinb··on Einsum for Tensor Manipulation
While I applaud the OP's exposition, imagine that instead of having axis names live as single-letter variables within einsum, our arrays themselves had these names attached to their axes?

It's almost like when we moved from writing machine code to structured programming: instead of being content to document that certain registers corresponding to certain semantically meaningful quantities at particular times during program execution, we manipulated only named variables and left compilers to figure out how to allocate these to registers? We're at that point now with array programming.

https://nlp.seas.harvard.edu/NamedTensor

https://math.tali.link/rainbow-array-algebra/

https://arxiv.org/abs/2102.13196

taliesinb··on Linear Algebra of Types (2019)
Hey there, a bit late but I've read your other comments and I'd like to get in touch. I happen to be very focused on type derivatives, in the context of applying category theory to AI, having just discovered Conor's original papers. Your comment was extremely helpful. Please email me at tali@tali.link if you see this.
taliesinb··on The Illustrated GPT-2: Visualizing Transformer Language Models (2019)
That is an excellent explanation full of great intuition building!

If anyone is interested in a kind of tensor network-y diagrammatic notation for array programs (of which transformers and other deep neural nets are examples), I wrote a post recently that introduces a kind of "colorful" tensor network notation (where the colors correspond to axis names) and then uses it to describe self-attention and transformers. The actual circuitry to compute one round of self-attention is remarkably compact in this notation:

https://math.tali.link/raster/052n01bav6yvz_1smxhkus2qrik_07...

Here's the full section on transformers: https://math.tali.link/rainbow-array-algebra/#transformers -- for more context on this kind of notation and how it conceptualizes "arrays as functions" and "array programs as higher-order functional programming" you can check out https://math.tali.link/classical-array-algebra or skip to the named axis followup at https://math.tali.link/rainbow-array-algebra

taliesinb··on Watch electricity hit a fork in the road at half a billion frames per second [video]
Amazing, but that's a lot of channels for a cheap oscilloscope. I'm curious how he did that, I don't see any wiring. Also, he missed an opportunity to bring in the rudiments of transmission line theory -- a twisted pair is a continuum limit of tiny coupled capacitors. And these same kinds of waves can propagate in the vacuum, which is a kind of universal 3D grid of coupled harmonic oscillators. In which case we call the waves photons!
taliesinb··on LLM Visualization
Wow, I love the interactive wizzing around and the animation, very neat! Way more explanations should work like this.

I've recently finished an unorthodox kind of visualization / explanation of transformers. It's sadly not interactive, but it does have some maybe unique strengths.

First, it gives array axis semantic names, represented in the diagrams as colors (which this post also uses). So sequence axis is red, key feature dimension is green, multihead axis is orange, etc. This helps you show quite complicated array circuits and get an immediate feeling for what is going on and how different arrays are being combined with each-other. Here's a pic of the the full multihead self-attention step for example:

https://math.tali.link/raster/052n01bav6yvz_1smxhkus2qrik_07...

It also uses a kind of generalization tensor network diagrammatic notation -- if anyone remembers Penrose's tensor notation, it's like that but enriched with colors and some other ideas. Underneath these diagrams are string diagrams in a particular category, though you don't need to know (nor do I even explain that!).

Here's the main blog post introducing the formalism: https://math.tali.link/rainbow-array-algebra

Here's the section on perceptrons: https://math.tali.link/rainbow-array-algebra/#neural-network...

Here's the section on transformers: https://math.tali.link/rainbow-array-algebra/#transformers

taliesinb··on What if money expired?
QE did not lead to historically high levels of inflation. Most of the money stayed in the financial sector, on banks balance sheets.
taliesinb··on What if money expired?
I guess we should distinguish money from commodities, though? For money to mean something different to commodities, it must enjoy a privileged legal and social role, by virtue of its ability to satisfy tax obligations to the state and debt obligations to other private citizens. I guess the "joke" is that we used to think the value of money derived primarily from its commodity backing. Which was maybe true in some particular historical periods but not true whenever state power was durable, as it is today.
taliesinb··on What if money expired?
I've been reading up on MMT recently, and I haven't seen adherents (e.g. Mosler) claim that inflation is good. They do provide a heterodox account of how government spending leads to inflation, a sectoral one that focuses on demand from the public sector outbidding the private sector in areas were the economy is already at or near productive capacity. And they claim the traditional examples of hyperinflation e.g. Weimar are adequately explained by supply-side constraints. They also explain why austerity has been such an abject failure over the last 13 years in the UK.
taliesinb··on Review: 'JFK: What the Doctors Saw' eyewitnesses contradict Warren Commission
This new stuff aside, there's an exhaustive two part series by Sean Munger that sets out the many interlocking lines of evidence that Oswald acted alone. I am pretty convinced at this point:

https://youtu.be/DC8tO16xdrY?si=PgEM8SK44eUoWjdf

taliesinb··on Inside the Matrix: Visualizing Matrix Multiplication, Attention and Beyond
Yeah, I thought exactly the same thing when I watching Contact again a few months ago!

There are all kinds of fascinating places where you can gain mental leverage by thinking in higher dimensions. For example, the definition of a monoidal category, which includes various equivalences (or for a strict monoidal category, equalities), can be seen as telling you about the existence of certain 3-dimensional "sheets", 2-dimensional slices of which are equivalent (or equal) ordinary functorial string diagrams[0]. This is just a higher dimensional extension of the fact that chaining 1-dimensional slices of functorial string diagrams give you particular paths in an ordinary commutative diagram. see Marsden [1] for more on that.

Unfortunately the computer tools for generating and manipulating these kinds of topological constructs are in their infancy, which is probably why they aren't used much by mathematicians.

[0]: https://twitter.com/nathanielvirgo/status/126201964172083200...

[1]: https://arxiv.org/abs/1401.7220v2

taliesinb··on Inside the Matrix: Visualizing Matrix Multiplication, Attention and Beyond
Great to see this kind of visualization gaining prominence! Thinking about matrix algebra in higher dimensions makes everything much more intuitive. I started along this road when I was creating 3D visualizations for the Deep Learning Indaba workshop [1], but I've spent some time since then trying to pin down the algebraic aspects of array manipulation in this blog post series that includes lots of visualizations [2], which I'm hoping to serve as a more fundamental tutorial of what array programming is all about and how to think about it more abstractly -- there is a category theory way of looking at it that is I think really nice, though I'm still working on writing that up.

[1] https://tali.link/projects/edu/indaba-2022/

[2] https://math.tali.link/classical-array-algebra/

Page 1 of 25Next →