You have to manually apportion between the two.
For example, if you consolidated learn is for $100,000
$25,000 for undergrad, $75,000 is for grad.
You would apportion interest paid 25% to undergrad and 75% to graduate
Massachusetts does accept approximations for this deduction.