{"title":"情境学习的旋转玻璃模型","authors":"Yuhao Li, Ruoran Bai, Haiping Huang","doi":"arxiv-2408.02288","DOIUrl":null,"url":null,"abstract":"Large language models show a surprising in-context learning ability -- being\nable to use a prompt to form a prediction for a query, yet without additional\ntraining, in stark contrast to old-fashioned supervised learning. Providing a\nmechanistic interpretation and linking the empirical phenomenon to physics are\nthus challenging and remain unsolved. We study a simple yet expressive\ntransformer with linear attention, and map this structure to a spin glass model\nwith real-valued spins, where the couplings and fields explain the intrinsic\ndisorder in data. The spin glass model explains how the weight parameters\ninteract with each other during pre-training, and most importantly why an\nunseen function can be predicted by providing only a prompt yet without\ntraining. Our theory reveals that for single instance learning, increasing the\ntask diversity leads to the emergence of the in-context learning, by allowing\nthe Boltzmann distribution to converge to a unique correct solution of weight\nparameters. Therefore the pre-trained transformer displays a prediction power\nin a novel prompt setting. The proposed spin glass model thus establishes a\nfoundation to understand the empirical success of large language models.","PeriodicalId":501520,"journal":{"name":"arXiv - PHYS - Statistical Mechanics","volume":"44 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-08-05","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Spin glass model of in-context learning\",\"authors\":\"Yuhao Li, Ruoran Bai, Haiping Huang\",\"doi\":\"arxiv-2408.02288\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Large language models show a surprising in-context learning ability -- being\\nable to use a prompt to form a prediction for a query, yet without additional\\ntraining, in stark contrast to old-fashioned supervised learning. Providing a\\nmechanistic interpretation and linking the empirical phenomenon to physics are\\nthus challenging and remain unsolved. We study a simple yet expressive\\ntransformer with linear attention, and map this structure to a spin glass model\\nwith real-valued spins, where the couplings and fields explain the intrinsic\\ndisorder in data. The spin glass model explains how the weight parameters\\ninteract with each other during pre-training, and most importantly why an\\nunseen function can be predicted by providing only a prompt yet without\\ntraining. Our theory reveals that for single instance learning, increasing the\\ntask diversity leads to the emergence of the in-context learning, by allowing\\nthe Boltzmann distribution to converge to a unique correct solution of weight\\nparameters. Therefore the pre-trained transformer displays a prediction power\\nin a novel prompt setting. The proposed spin glass model thus establishes a\\nfoundation to understand the empirical success of large language models.\",\"PeriodicalId\":501520,\"journal\":{\"name\":\"arXiv - PHYS - Statistical Mechanics\",\"volume\":\"44 1\",\"pages\":\"\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2024-08-05\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"arXiv - PHYS - Statistical Mechanics\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/arxiv-2408.02288\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - PHYS - Statistical Mechanics","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2408.02288","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
Large language models show a surprising in-context learning ability -- being
able to use a prompt to form a prediction for a query, yet without additional
training, in stark contrast to old-fashioned supervised learning. Providing a
mechanistic interpretation and linking the empirical phenomenon to physics are
thus challenging and remain unsolved. We study a simple yet expressive
transformer with linear attention, and map this structure to a spin glass model
with real-valued spins, where the couplings and fields explain the intrinsic
disorder in data. The spin glass model explains how the weight parameters
interact with each other during pre-training, and most importantly why an
unseen function can be predicted by providing only a prompt yet without
training. Our theory reveals that for single instance learning, increasing the
task diversity leads to the emergence of the in-context learning, by allowing
the Boltzmann distribution to converge to a unique correct solution of weight
parameters. Therefore the pre-trained transformer displays a prediction power
in a novel prompt setting. The proposed spin glass model thus establishes a
foundation to understand the empirical success of large language models.