In training regression models with the text package in R, the model's size increases with the number of training datapoints, resulting in unnecessarily large model objects. The models are created using the parsnip package with the glmnet engine. R's memory handling system, which prevents data duplication, makes it difficult to distinguish what components/attributes of the model that take up space; for instance: object_size(model) shows 700 MB, but object_size(model$final_recipe) and object_size(model$final_model) are nearly the same at 698 MB respectively, and thus doesn’t show the actual size of the components.
How can I efficiently identify and remove the memory-heavy components of the model to reduce its size, while maintaining its predictive ability?