This paper presents a novel continuous pretraining framework , MachineLearningLM , to address the challenge of large-scale language models (LLMs) learning from a large number of contextual examples in traditional machine learning (ML) tasks . MachineLearningLM pretrains LLMs using ML tasks generated from millions of structured causal models (SCMs). Specifically, it uses random forests to infuse tree-based decision-making strategies into LLMs, enhancing the robustness of numerical modeling. It also uses token-efficient prompts to increase the number of examples per context window by a factor of 3-6 and improves throughput by up to 50x through batch inference. Despite its small Qwen-2.5-7B-Instruct-based setup, it outperforms existing robust LLM baseline models by an average of 15% on out-of-distribution tabular data classification across various domains (finance, physics, biology, and medicine), demonstrating a monotonic increase in accuracy as the number of contextual examples increases. Furthermore, it achieves a performance of 75.4% on MMLU, maintaining general conversational competence.