AI memory optimization