South Florida roof softit roof ventilation and of insulation batts
The distance to the wall isn't the concern. You need some space for airflow between the insulation and the underside of the roof. There needs to be a path for air to enter in the soffit vents and out the ridge vent, passing under the roof. They make baffles that you can install between the rafters and top plate of the wall if you are concerned about pushing the insulation too far back, these are commonly used with blown insulation. You do want the insulation as far over the wall as possible without blocking the soffit airflow. This creates a continuous insulation envelope around your home and avoids cold/hot spots in the corners.

See this blog post for more details.