From task structures to world models: What do LLMs know?