A neural network can do new things outside the training data. Random initialization sees to that.
Whether those things are useful is a different question, but it turns out that yes, some of those things are useful. It also turns out that in a large-enough LLM if you give it some kind of idea of what you see as useful then yes, it can pick out the newly useful things.
The second thing you said is basically what's called fine-tuning.
For the second: No, not fine tuning at all.
For one thing in-context learning is enough for learning novel tasks[1].
Secondly, it can do new things outside that data. LLMs build models of the world[2]. That means it can model novel behavior based on that internal representation.
Maybe it can generalize outside of some learning task you gave it, but still it comes from the training data.
"Generalization" also comes with some luck, since these models most of the time output complete non-sense when it comes to tasks it "didn't learn" specifically. Just because you got lucky with the neuron connections doesn't mean it has what it takes to generalize anything.
I think it can patch together components of tasks represented in its training data to do demonstrably new things, yes, which does count as "perform tasks not in its training data" with the limitation that some form of the task must be present. Example: writing an ode to a sales lead for a job well done in 2032 for the first quarter. Odes exist, the concept of sales performance exist, good job performance, and notions of time. Stringing those together are good examples of interpolation but not extrapolation, as it were.
The surface for "interpolation" is fairly broad for LLMs but it isn't infinite -- extrapolation still exists!
figuring out what is and isnt in distribution is quite difficult though given that theres so much data passed in, and transformers have some amount of combining it together
theres some really obvious things though, like picking nonsense tokens together, or things outside of the tokenspace entirely
you could also construct a string that is a series of the least likely tokens in a row. you wont get it to output the next token, despite it being quite clear how you did it