Galaxy models predict a tight relation between the clustering of galaxies and dark matter on cosmological scales, but predictions differ notably in the details. We used this opportunity and tested two semi-analytic models by the Munich and Durham groups with data from the Canada-France-Hawaii Telescope Lensing Survey (CFHTLenS). For the test we measured the scale-dependent galaxy bias factor b(k) and correlation factor r(k) from linear to non-linear scales of k ≈ 10 h Mpc −1 at two redshiftsz = 0.35, 0.51 for galaxies with stellar mass between 5 × 10 9 and 3 × 10 11 h −2 70 M. Our improved gravitational lensing technique accounts for the intrinsic alignment of sources and the magnification of lens galaxies for better constraints for the galaxy-matter correlation r(k). Galaxy bias in CFHTLenS increases with k and stellar mass; it is colour-dependent, revealing the individual footprints of galaxy types. Despite a reasonable model agreement for the relative change with both scale and galaxy properties, there is a clear conflict for b(k) with no model preference: the model galaxies are too weakly clustered. This may flag a model problem at z 0.3 for all stellar masses. As in the models, however, there is a high correlation r(k) between matter and galaxy density on all scales, and galaxy bias is typically consistent with a deterministic bias on linear scales. Only our blue and low-mass galaxies of about 7 × 10 9 h −2 70 M atz = 0.51 show, contrary to the models, a weak tendency towards a stochastic bias on linear scales where r ls = 0.75 ± 0.14 (stat.) ± 0.06 (sys.). This result is of interest for cosmological probes, such as E G , that rely on a deterministic galaxy bias. We provide Monte Carlo realisations of posterior constraints for b(k) and r(k) in CFHTLenS for every galaxy sample in this paper as online material.