Discussion summary

A recent study shows that a single transformer layer can match full-parameter RL training performance, sparking discussions on model efficiency and layer utilization.

What the discussion says

  • Some believe most performance gains are in middle layers, suggesting potential compute savings.
  • Others compare this to fine-tuning in encoder-decoder architectures.
  • There is curiosity about the lack of recurrent connections and layer duplication as a fix.
Most performance gains are hidden in a few middle layers.
tribal808
This is very similar to fine-tuning a downstream task.
soleveloper

Comments

Hacker News

I still can't believe that LLM encoders aren't unsupervised learned.

So much left on the table

by vatsachak

They are using Qwen, so this is decoder only.

by d3m0t3p

Really good work here, bravo

by khalic

If most of the performance gains are hidden in a few middle layers, you can save a massive amount of compute by freezing the rest

by tribal808

Hi I am the author. I am very happy to discuss with you about my paper. Feel free to contact me via email or just add comments here

by ZijianZhang

Makes sense - This is very similar to fine tuning a down stream task in encoder-decoder architecture (~Bert style)

by soleveloper

I'm reminded of this dude who was sitting at or near the top of some kaggle leaderboard simply[0] splicing together some duplicated middle layers and applying a bit of fine tuning

[0] not simply

by baq

I'm wondering if the big problem is just the lack of recurrent connections in the standard Transformer design, and selective layer duplication is just a weird way to fix the same problem. I have to wonder if it would be possible to deliberately architecture a model to discover and exploit layers worth duplicating at training time.

The current model architectures we use have a fixed routing of residuals per layer, from the first to the last. I'm imagining replacing this with a matrix of routing weights[0] that determines how "strong" the connection is between each Transformer layer. We still evaluate each layer "in order", but now instead of just giving the layer the last layer's residuals, it gets the sum of all prior layers times their weight in the routing matrix. Recurrent connections (i.e. output of layer 9 to input of layer 3) could be handled by doing a second pass and using the first pass's recurrent residuals as inputs. You could then "loop" the model as many times as desired per token, or even have it do parallel decoding with each token communicating with the others while also recurring on itself.

You'd probably need some kind of normalization akin to what Deepseek did with Manifold Hyper Connections (mHC). Hell, mHC might also be useful in combination with this kind of layer routing, so the model could grow different recurrent loops for various bits of it's thought-space.

EDIT: if anyone uses it please call it "neuralese recurrence" just to scare the AI safety bros

[0] I'm not sure how you'd initialize these weights. Maybe each row/column is a narrow gaussian centered around the prior layer, with some random or constant weighting everywhere else?

by kmeisthax

Good work! I wonder if meta-learning can play a better role here compared to heuristics or hindsight. MAML requires hessians, but first-order MAML or Reptile variants could help apply layer-wise adjustments to learning rates.

by hazrmard

This is interesting theoretically, but in practical terms it’s hard to apply.

RL is already hard. There are many things which can go wrong. You have all of the problems with regular LLM SFT, plus now you have a reward model which can be hacked or too hard. Or KL collapse because the outputs are repetitive. Or maybe your groups in GRPO aren’t producing advantages. Or the rollouts are OOD for your reward model. Or maybe you’re running the rollout at a different precision as the trained weights. Or maybe your importance sampling should be clipping when it’s not, or should be clipping at the token level rather than sequence level.

Maybe after reading the above you think that the above are not problems because smart people wouldn’t make those mistakes. Fair enough. But I would prefer RL people like myself who are not geniuses.

Now, this is adding another variable into the mix: choosing a single layer to train. If it doesn’t work is it because there’s a problem with your RL setup? Or did you just choose the wrong layer? Or maybe there’s no problem with your setup but you chose a suboptimal layer to train.

Also note that we already have LoRA, which is a more established method for low memory parameter updates.

by janalsncm

I guess the practical implication is probably just train on middle layers or increase the corresponding learning rate

by redpig_hongzhou

If you think about it for some time then you’ll come to realise transformers are autoencoders on steroids. A small input space is expanded onto a big manifold and contracted again. Now, suppose you want to impose a function to regulate the output of an autoencoder. It’s actually pretty obvious that you need exactly one layer to do so… f(manifold).

by usernametaken29

Took me a short time to understand what you mean with "autoencoders on steroids", but I believe you mean they are autoencoders with an inverse bottleneck - an intermediate representation that isn't smaller, but that's much larger than the input space. Is my understanding of your comment correct?

by earthnail

I might be misunderstanding your point but this conflates the distinguishing features of each. you mention expansion but autoencoders canonically compress their inputs. autoencoders have an explicit encoder and decoder. most transformers we interact with these days (LLMs) are decoder only. the manifold isn't typically something the model is applied to directly. we apply the function/model to the latent representations. those are what live on the manifold.

by soraki_soladead

What you're suggesting seems to go implausibly far beyond what the paper says.

RL post-training alters the parameters of the transformer, while your f(manifold) idea seems to suggest that a new layer on top would suffice, no need to alter the transformer itself at all.

It would be extremely handy if that were so, but I'm guessing it isn't, or it would be the prevailing approach.

by getnormality

Everything can be represented as f(), a full scale SotA transformer model is also just f(context). That does not mean one layer is sufficient. It all depends on the level of expressivity required by this f to be a good model.

by sailingparrot

The authors have some inconsistencies with training token length…

Most errors are probably responses that didn’t finish before their 3K token limit. They’ve measured how well RL is able to shorten the response to their limit.

by olliepro

This result feels very intuitive. The early layers of a transformer can be thought of as understanding surface level things like syntax, how tokens group, which groups are entities and how to disambiguate them, etc. The last layers are in a sense decoding ideas into a selection of words, ensuring the grammar makes sense, that the text flows and is structured correctly, etc. The middle layers are where the abstract thought and manipulation of concepts is happening.

But for the tasks this paper uses for RL training, it's all about improving the way the net is manipulating concepts. So the middle layers are where the focus should be.

Note: RL is also used for tasks that aren't about conceptual manipulation, like instruct training. I bet that their result doesn't hold for that because the delta vs the foundation model is all about the selection of words and flow of the text, not the core understanding.

by mike_hearn

I've often thought about how rich a machine language could be that communicates machine to machine on an interface that is really really close to those middle layers. I imagine a standardize meta interface that each model 'grows' a connection to with RL.

by idiotsecant

I keep thinking of the RYS (Repeat Yourself) experiment of simply looping some of the inner layers of LLMs for better results and wonder if any progress was made on it.

https://dnhkng.github.io/posts/rys/

Feels it should be straightforward to integrate in LLMs a network to control the looping. Or just duplicate entire blocks of layers after the initial training.

by throw310822

It's interesting that it's the middle layers of the Transformer that are affected most by RL post-training, but it perhaps makes some intuitive sense given that RL is being used to shape high level planning-type direction of the output.

It seems that the input layers to a Transformer are necessarily going to be doing the most low level work of syntax -> semantic augmentation starting with things like tagging parts of speech etc. Similarly the output layers are by necessity going to be concerned with mapping high level representations back into surface level word sequence form. This leaves the middle layers to do the work of first recognizing deep enough patterns to support good quality prediction, then do the high level predication itself which is what RL is typically going to be trying to shape.

by HarHarVeryFunny

this is explicitly why qwen opted to use recurrent layers as the middle layers of their hybrid model.

by FuckButtons

  > the middle layers of the Transformer that are affected most by RL post-training
This is where you should expect most change in models. The beginning layers need to embed while the later layers will reform the result to the final conditions. The middle is what does all the untangling.

by godelski

Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • I still can't believe that LLM encoders aren't unsupervised learned.

    So much left on the table

    by vatsachak
  • They are using Qwen, so this is decoder only.
    by d3m0t3p
  • Really good work here, bravo
    by khalic
  • If most of the performance gains are hidden in a few middle layers, you can save a massive amount of compute by freezing the rest
    by tribal808
  • Hi I am the author. I am very happy to discuss with you about my paper. Feel free to contact me via email or just add comments here
    by ZijianZhang
  • Makes sense - This is very similar to fine tuning a down stream task in encoder-decoder architecture (~Bert style)
    by soleveloper
  • I'm reminded of this dude who was sitting at or near the top of some kaggle leaderboard simply[0] splicing together some duplicated middle layers and applying a bit of fine tuning

    [0] not simply

    by baq
  • I'm wondering if the big problem is just the lack of recurrent connections in the standard Transformer design, and selective layer duplication is just a weird way to fix the same problem. I have to wonder if it would be possible to deliberately architecture a model to discover and exploit layers worth duplicating at training time.

    The current model architectures we use have a fixed routing of residuals per layer, from the first to the last. I'm imagining replacing this with a matrix of routing weights[0] that determines how "strong" the connection is between each Transformer layer. We still evaluate each layer "in order", but now instead of just giving the layer the last layer's residuals, it gets the sum of all prior layers times their weight in the routing matrix. Recurrent connections (i.e. output of layer 9 to input of layer 3) could be handled by doing a second pass and using the first pass's recurrent residuals as inputs. You could then "loop" the model as many times as desired per token, or even have it do parallel decoding with each token communicating with the others while also recurring on itself.

    You'd probably need some kind of normalization akin to what Deepseek did with Manifold Hyper Connections (mHC). Hell, mHC might also be useful in combination with this kind of layer routing, so the model could grow different recurrent loops for various bits of it's thought-space.

    EDIT: if anyone uses it please call it "neuralese recurrence" just to scare the AI safety bros

    [0] I'm not sure how you'd initialize these weights. Maybe each row/column is a narrow gaussian centered around the prior layer, with some random or constant weighting everywhere else?

    by kmeisthax
  • by deflator
  • Good work! I wonder if meta-learning can play a better role here compared to heuristics or hindsight. MAML requires hessians, but first-order MAML or Reptile variants could help apply layer-wise adjustments to learning rates.
    by hazrmard
  • This is interesting theoretically, but in practical terms it’s hard to apply.

    RL is already hard. There are many things which can go wrong. You have all of the problems with regular LLM SFT, plus now you have a reward model which can be hacked or too hard. Or KL collapse because the outputs are repetitive. Or maybe your groups in GRPO aren’t producing advantages. Or the rollouts are OOD for your reward model. Or maybe you’re running the rollout at a different precision as the trained weights. Or maybe your importance sampling should be clipping when it’s not, or should be clipping at the token level rather than sequence level.

    Maybe after reading the above you think that the above are not problems because smart people wouldn’t make those mistakes. Fair enough. But I would prefer RL people like myself who are not geniuses.

    Now, this is adding another variable into the mix: choosing a single layer to train. If it doesn’t work is it because there’s a problem with your RL setup? Or did you just choose the wrong layer? Or maybe there’s no problem with your setup but you chose a suboptimal layer to train.

    Also note that we already have LoRA, which is a more established method for low memory parameter updates.

    by janalsncm
  • I guess the practical implication is probably just train on middle layers or increase the corresponding learning rate
    by redpig_hongzhou
  • If you think about it for some time then you’ll come to realise transformers are autoencoders on steroids. A small input space is expanded onto a big manifold and contracted again. Now, suppose you want to impose a function to regulate the output of an autoencoder. It’s actually pretty obvious that you need exactly one layer to do so… f(manifold).
    by usernametaken29
  • Took me a short time to understand what you mean with "autoencoders on steroids", but I believe you mean they are autoencoders with an inverse bottleneck - an intermediate representation that isn't smaller, but that's much larger than the input space. Is my understanding of your comment correct?
    by earthnail
  • I might be misunderstanding your point but this conflates the distinguishing features of each. you mention expansion but autoencoders canonically compress their inputs. autoencoders have an explicit encoder and decoder. most transformers we interact with these days (LLMs) are decoder only. the manifold isn't typically something the model is applied to directly. we apply the function/model to the latent representations. those are what live on the manifold.
    by soraki_soladead
  • What you're suggesting seems to go implausibly far beyond what the paper says.

    RL post-training alters the parameters of the transformer, while your f(manifold) idea seems to suggest that a new layer on top would suffice, no need to alter the transformer itself at all.

    It would be extremely handy if that were so, but I'm guessing it isn't, or it would be the prevailing approach.

    by getnormality
  • Everything can be represented as f(), a full scale SotA transformer model is also just f(context). That does not mean one layer is sufficient. It all depends on the level of expressivity required by this f to be a good model.
    by sailingparrot
  • The authors have some inconsistencies with training token length…

    Most errors are probably responses that didn’t finish before their 3K token limit. They’ve measured how well RL is able to shorten the response to their limit.

    by olliepro
  • This result feels very intuitive. The early layers of a transformer can be thought of as understanding surface level things like syntax, how tokens group, which groups are entities and how to disambiguate them, etc. The last layers are in a sense decoding ideas into a selection of words, ensuring the grammar makes sense, that the text flows and is structured correctly, etc. The middle layers are where the abstract thought and manipulation of concepts is happening.

    But for the tasks this paper uses for RL training, it's all about improving the way the net is manipulating concepts. So the middle layers are where the focus should be.

    Note: RL is also used for tasks that aren't about conceptual manipulation, like instruct training. I bet that their result doesn't hold for that because the delta vs the foundation model is all about the selection of words and flow of the text, not the core understanding.

    by mike_hearn
  • I've often thought about how rich a machine language could be that communicates machine to machine on an interface that is really really close to those middle layers. I imagine a standardize meta interface that each model 'grows' a connection to with RL.
    by idiotsecant
  • I keep thinking of the RYS (Repeat Yourself) experiment of simply looping some of the inner layers of LLMs for better results and wonder if any progress was made on it.

    https://dnhkng.github.io/posts/rys/

    Feels it should be straightforward to integrate in LLMs a network to control the looping. Or just duplicate entire blocks of layers after the initial training.

    by throw310822
  • It's interesting that it's the middle layers of the Transformer that are affected most by RL post-training, but it perhaps makes some intuitive sense given that RL is being used to shape high level planning-type direction of the output.

    It seems that the input layers to a Transformer are necessarily going to be doing the most low level work of syntax -> semantic augmentation starting with things like tagging parts of speech etc. Similarly the output layers are by necessity going to be concerned with mapping high level representations back into surface level word sequence form. This leaves the middle layers to do the work of first recognizing deep enough patterns to support good quality prediction, then do the high level predication itself which is what RL is typically going to be trying to shape.

    by HarHarVeryFunny
  • this is explicitly why qwen opted to use recurrent layers as the middle layers of their hybrid model.
    by FuckButtons
  •   > the middle layers of the Transformer that are affected most by RL post-training
    
    This is where you should expect most change in models. The beginning layers need to embed while the later layers will reform the result to the final conditions. The middle is what does all the untangling.
    by godelski

Related stories