AI inference algorithm