refactor inference functions so that they are faster in parallel
sum tests