Regression with LLMs is definitely possible. Assuming you use a GPT-like model, you can either
- train the transformer from scratch on the regression task, or
- first pre-train the transformer on a general task, and then transfer learn the regression task by replacing the final linear layer.
Which option is more appropriate depends on the kind of regression task and how well that task is generalizable. For example, if you want to assess how positive a text is, you can better do that using option 2. However, a super-specific regression task is likely easier to do through option 1.
Check out this post for more general knowledge on transformers, and a bit of context about 'pretraining' and 'transfer learning'.