All LGDs will roam in an attempt to expand their territory. It's how they lived and worked for centuries on the open mountain pastures, steppes, and highlands. You can't change that at all. They are just doing their job, marking and patrolling their territory in order to protect it. They aren't like some other breeds of dogs that might learn a boundary. It's true a rare
LGD will learn to stay home after they reach adulthood, but it's just that - rare. You need a
fence to set boundaries unless your dog is working on open range or huge pastureland. If it's not robot
enough, it will need electric or invisible
fence backup. This is the only way to protect your dog from being hit by a car or shot for roaming. I have suggestions for fencing options in my book. Neutering also helps. Fencing also protects your dog from other roaming dogs, especially if she is intact.