optimizing model generation for strings