So it's a device compact enough to be implanted. It has a controller, sensors, and a stimulus unit.
The sensors are implanted around the Student's sphincter and can sense if it's tightened or relaxed. The controller reads the sensors and if it detects the sphincter tightening, it activates the stimulus unit to send out a gradually increasing sensation of mild pain or discomfort around the sphincter. The tighter the sphincter is held, the more painful it becomes.
When the controller senses the sphincter relaxing, it has the stimulus unit to stop sending pain signals.
The Student quickly learn consciously and consciously to relax the sphincter. Over time, the sphincter loses tone and the Student becomes functionally incontinent.