Live data from Hacker News

I made a transformer to predict a simple sequence manually

vgel.me

31–40 of 104 posts

Re: I made a transformer to predict a simple sequence manually

#31
post #59

[stub for offtopicness]

Minor request: can we have 'neural network' or something in the title? This is related to the machine learning 'transformer' architecture, rather than the bundle of coils that couples two circuits electromagnetically.

Funny how even though I studied EE, it didn't cross my mind it could be an electrical transformer.

Re: I made a transformer to predict a simple sequence manually

#32

It's some kind of abstract machine, like a turing machine or the machine that parses regexes, isn't it?

It's kind of hard to interpret these things as "automata" in the sense that one might usually think of them.

Everything is usually a little fuzzy in a neural network. There's rarely anything like an if/else statement, although (as in the transformer example) you have some cases of "masking" values with 0 or -∞. The output is almost always fuzzy as well, being a collection of scores or probabilities. For example, a model that distinguishes cat pictures and dog pictures might emit a result like "dog:0.95 cat:0.05", and we say that it predicted a cat because the dog score is higher than the cat score.

In fact, the core of the transformer, the attention mechanism, is based on a kind of "soft lookup" operation. In a non-fuzzy system, you might want to do something like loop through each token in the sequence, check if that token is relevant to the current token, and take some action if it's relevant. But in a transformer, relevance is not a binary decision. Instead, the attention mechanism computes a continuous relevance score between each pair of tokens in the sequence, and uses those scores to take further action.

But some things are not easily generalized directly from a system based on of binary decisions. For example, those relevance scores are used as weights to compute a weighted average over tokens in the vocabulary, and thereby obtain an "average token" for the current position in the sequence. I don't think there's an easy way to interpret this as an extension of some process based on branching logic.

Re: I made a transformer to predict a simple sequence manually

#33
post #16

> maybe even feel inspired to make your own model by hand as well! Other then a learning exercise to satisfy your curiosity what are you doing with this? I'm starting to get the feeling that anything complex with ml models is unreasonable for a at home blog reader?

It's an excellent learning exercise, not just to satisfy curiosity but to develop and deepen understanding.

Re: I made a transformer to predict a simple sequence manually

#34
post #16

> maybe even feel inspired to make your own model by hand as well! Other then a learning exercise to satisfy your curiosity what are you doing with this? I'm starting to get the feeling that anything complex with ml models is unreasonable for a at home blog reader?

Author states in the first paragraph of their blog post:

"I've been wanting to understand transformers and attention better for awhile now—I'd read The Illustrated Transformer, but still didn't feel like I had an intuitive understanding of what the various pieces of attention were doing. What's the difference between q and k? And don't even get me started on v!"

Re: I made a transformer to predict a simple sequence manually

#35
post #26

Earlier quoted context omitted.

I misinterpreted that as "I have no training; I am a beginner" rather than "I am not going to train this thing" :)

That's how I interpreted as well. "Electrical transformer without any formal training in electric engineering" is basically how the title read to me. Followed by a lot of confusion when the article was not that. Good on him, it's just... an odd way to phrase it :)

Heh, I went a step further and thought "ooh, a novice EE project, but titling it like that everyone's going to be confused about it involving machine learning" until I realized I was the one that got it backwards...

Re: I made a transformer to predict a simple sequence manually

#36
post #3

Earlier quoted context omitted.

"no training" gave it away for me.

I misinterpreted that as "I have no training; I am a beginner" rather than "I am not going to train this thing" :)

I didn't even consider that it COULD be about LLMs until I saw the comment above.

Re: I made a transformer to predict a simple sequence manually

#37
I've been kicking around a similar idea for awhile. Why can't we have an intuitive interface to the weights of a model, that a domain expert can tweak by hand to accelerate training? For example, in a vision model, they can increase the "orangeness" collection of weights when detecting traffic cones. That way, instead of requiring thousands/millions more examples to calibrate "orangeness" right, it's accelerated by a human expert. The difficulty is obviously having this interface map to the collections of weights that mean different things, but is there a technical reason this can't be done?

Re: I made a transformer to predict a simple sequence manually

#38

I've been kicking around a similar idea for awhile. Why can't we have an intuitive interface to the weights of a model, that a domain expert can tweak by hand to accelerate training? For example, in a vision model, they can increase the "orangeness" collection of weights when detecting traffic cones. That way, instead of requiring thousands/millions more examples to calibrate "orangeness" right, it's accelerated by a…

The technical reason it can't be done (or would be very difficult to do) is that weights are typically very uninterpretable. There aren't specific clusters of neurons that map to one concept or another, everything kind of does everything.

Re: I made a transformer to predict a simple sequence manually

#39

I've been kicking around a similar idea for awhile. Why can't we have an intuitive interface to the weights of a model, that a domain expert can tweak by hand to accelerate training? For example, in a vision model, they can increase the "orangeness" collection of weights when detecting traffic cones. That way, instead of requiring thousands/millions more examples to calibrate "orangeness" right, it's accelerated by a…

The attention mechanisms present in transformers don’t seem easy to map to semantics that humans can understand. There are too many parameters involved

Re: I made a transformer to predict a simple sequence manually

#40

I've been kicking around a similar idea for awhile. Why can't we have an intuitive interface to the weights of a model, that a domain expert can tweak by hand to accelerate training? For example, in a vision model, they can increase the "orangeness" collection of weights when detecting traffic cones. That way, instead of requiring thousands/millions more examples to calibrate "orangeness" right, it's accelerated by a…

The number of layers and weights is really not at a scale we can handle updating manually, and even if we could the downstream effects of modifying weights are way too hard to manage. Say you are updating the picture to be better at orange, but unless you can monitor all the other colours for correctness at the same time you probably are creating issues for other colours without realizing it
Post reply on HN