At the Advanced Photon Source (APS), each insertion-device (ID) beamline front end has two X-ray beam position monitors (XBPMs) to monitor the X-ray beam position for both vertical and horizontal directions. Performance challenges for a conventional photoemission-type XBPM during operations are contamination of the signal from the neighbouring bending-magnet sources and the sensitivity of the XBPM to the insertion-device gap variations. Problems are exacerbated because users change the ID gap during their operations, and hence the percentage level of the contamination in the front-end XBPM signals varies. A smart XBPM system with a high-speed digital signal processor has been built at the Advanced Photon Source for the ID beamline front ends. The new version of the software, which uses an artificial-intelligence method, provides a self-learning and self-calibration capability to the smart XBPM system. The structure of and recent test results with the system are presented in this paper.