土佐藩
Yui was born in Tosa Domain (present day Kōchi Prefecture) in what is now part of the city of Kōchi, where is father was a samurai in the service of the Yamauchi clan. He graduated from the 5th class of the Imperial Japanese Army Academy in 1882 and 7th class of the Army Staff College in 1891 and was assigned to staff positions within the Imperial General Headquarters upon graduation.