The inner silicon detector of the Compact Muon Solenoid experiment (CMS) at CERN’s LHC consists of 16 588 modules. Charged-particle tracks in the detector are used to improve the accuracy to which the position and orientation of the modules is known. This contribution focuses on the Millepede-II algorithm, one of the two alignment algorithms used by CMS. Recently an advanced track model has been introduced into the CMS alignment procedure, which is based on the “Broken Lines” model and is able to take multiple Coulomb scattering in the detector material properly into account. We show the unique approach needed for solving the alignment problem in a reasonable amount of time. Emphasis is given to the mathematical treatment of the problem. Presented at CCP2010: 2010 Conference on Computational Physics