On the example of glasses of the K 2 O - TiO 2 - P 2 O 5 system near the stoichiometry of potassium titanyl phosphate by methods small-angle scattering of synchrotron radiation, vibrational spectroscopy, and second harmonic generation, it is shown that at the initial stage of phase separation, at which the glass remains X-ray amorphous and transparent, it can have a quadratic optical nonlinearity. The onset of nonlinearity is facilitated by the formation of nanoinhomogeneities in glass, the structure of which is similar to the structural motif of a nonlinear optical crystal. The discovery of correlations between the features of the structure of X-ray amorphous glass and its quadratic optical nonlinearity indicates the expediency of describing the short-range and average orders of glasses of compositions at the boundaries of the regions of glass formation from the standpoint of quasicrystalline models. Il. 6, bibliography: 13 titles.