News for hackers. Stuff that matters.
Re:The APL Challenge by whitten on Tuesday February 04, 2025 @10:40PM (#42943413)
Has anyone tried to recreate LLMs in APL ? Matrix multiplication is common in both of them. If LLAMA.C is only a few hundred lines then I would be surprised if the APL is more than a page of code.
Re:The APL Challenge by ChanderG on Tuesday February 04, 2025 @11:45PM (#42943919)
People have done it. For eg, https://github.com/BobMcDear/trap and few others that I can't find the links of right now.

When I got into BQN recently, I had the same thought and tried my hand at recreating LLM building blocks and saw the compactness APL-likes afford first-hand: https://www.chandergovind.org/blog/5126/aipasi/Array-program...

Re:The APL Challenge by xelxebar on Wednesday February 05, 2025 @12:19AM (#42944146)
A page? I sure hope not. The whole training and inference code for a U-Net architecture in APL is only about 30 lines, with inference direction only taking up 4 or so lines. Assuming you know APL, the code is actually really straightforward and readable, too! Not to mention that it's only ~2.5x slower than a comparable PyTorch implementation.

[0]:https://www.dyalog.com/uploads/conference/dyalog22/presentat...

Re:The APL Challenge by upghost on Wednesday February 05, 2025 @07:01PM (#42957179)
Conversely, after many years of dabbling I still consider myself a complete novice at APL and array programming. However, my studying of array langs made learning LLMs fairly trivial. In particular, studying APL's inner product from the Mastering Dyalog book was the key to understanding the self-attention mechanism from Attention is All You Need and how it communicates semantic information across the positionally encoded tokens.

I'd still probably struggle to do anything mildly complex in APL, though, sadly. It hasn't fully clicked yet, but maybe one day!