In-context learning and Occam's razor
The goal of machine learning is generalization. While the No Free Lunch
Theorem states that we cannot obtain theoretical guarantees for generalization
without further assumptions, in practice we observe that simple models which
explain the training data generalize best: a principle called Occam's razor.
Despite the need for simple models, most current approaches in machine learning
only minimize the training error, and at best indirectly promote simplicity
through regularization or architecture design. Here, we draw a connection
between Occam's razor and in-context learning: an emergent ability of certain
sequence models like Transformers to learn at inference time from past
observations in a sequence. In particular, we show that the next-token
prediction loss used to train in-context learners is directly equivalent to a
data compression technique called prequential coding, and that minimizing this
loss amounts to jointly minimizing both the training error and the complexity
of the model that was implicitly learned from context. Our theory and the
empirical experiments we use to support it not only provide a normative account
of in-context learning, but also elucidate the shortcomings of current
in-context learning methods, suggesting ways in which they can be improved. We
make our code available at https://github.com/3rdCore/PrequentialCode.
6717ac81ee30e9f032308982
Eric Elmoznino
admin_assigned
2024-10-22T13:54:21.298Z
64fd0dc89ecd05d5bf77d331
/avatars/1087b977ebbafc89dba1cfb1084df6aa.svg
Eric Elmoznino
user
EricElmoznino
6717ac81ee30e9f032308983
Tom Marty
claimed_verified
2024-10-22T13:47:06.100Z
646402a6a5af935cfe7226a5
/avatars/98655f52a05259a5f6478588aa15bda6.svg
Tom Marty
user
3rdCore
6717ac81ee30e9f032308984
Tejas Kasetty
admin_assigned
2024-10-22T13:54:26.971Z
65b2f64d54fa188a2f2a7132
/avatars/95f218fe0f525f56d12238330a68e593.svg
Tejas Kasetty
user
tejaskasetty
6717ac81ee30e9f032308985
Leo Gagnon
admin_assigned
2024-10-22T13:54:32.102Z
669580c8643c258b90be7497
/avatars/19fc666b4d56f71020fa646ca2f173de.svg
Léo Gagnon
user
leogagnon
6717ac81ee30e9f032308986
Sarthak Mittal
6717ac81ee30e9f032308987
Mahan Fathi
admin_assigned
2024-10-22T13:54:53.891Z
64903c2d9b1aaa0738286323
/avatars/9c4d0734b6f779d0f138951998f1d7b5.svg
Mahan Fathi
user
mahanfathi
6717ac81ee30e9f032308988
Dhanya Sridhar
6717ac81ee30e9f032308989
Guillaume Lajoie
admin_assigned
2024-10-22T13:55:02.206Z
64909d1d6f217a26d91c6d9b
/avatars/28eeff49dd5c2f01b576e4a050551e17.svg
guillaume lajoie
user
glajoie
In-context learning and Occam's razor
The goal of machine learning is generalization. While the No Free Lunch
Theorem states that we cannot obtain theoretical guarantees for generalization
without further assumptions, in practice we observe that simple models which
explain the training data generalize best: a principle called Occam's razor.
Despite the need for simple models, most current approaches in machine learning
only minimize the training error, and at best indirectly promote simplicity
through regularization or architecture design. Here, we draw a connection
between Occam's razor and in-context learning: an emergent ability of certain
sequence models like Transformers to learn at inference time from past
observations in a sequence. In particular, we show that the next-token
prediction loss used to train in-context learners is directly equivalent to a
data compression technique called prequential coding, and that minimizing this
loss amounts to jointly minimizing both the training error and the complexity
of the model that was implicitly learned from context. Our theory and the
empirical experiments we use to support it not only provide a normative account
of in-context learning, but also elucidate the shortcomings of current
in-context learning methods, suggesting ways in which they can be improved. We
make our code available at https://github.com/3rdCore/PrequentialCode.
In-context learning in sequence models like Transformers is theoretically grounded in minimizing next-token prediction loss, which aligns with data compression through prequential coding, promoting simplicity and better generalization.
Transformers in-context learning next-token prediction prequential coding