refactor gradient model selection