Equilibrium geometries and cohesion energies of Ag0.94Cd0.06, Ag0.94In0.06, Au0.94Cd0.06, and Au0.94In0.06 solid alloys have been studied from the first principles within the Density Functional Theory using ab initio pseudopotentials. Equilibrium geometries are obtained by total energy minimization method using the Local Density Approximation and Generalized Gradient Approximation methods. Optical functions are calculated within the independent particles picture. We report essentially different behavior of Cd and In impurity atoms in Au- and Ag-based alloys: the aggregated (or quasi aggregated) phases in In-containing alloys are expected in contrast to the alloys with Cd atom where homogeneous impurity distribution over the bulk should dominate. Study of optical spectra in Ag0.94Cd0.06 and Au0.94Cd0.06 alloys indicate that optical losses in visible and near ultraviolet spectral range remarkably increase at bigger Cd concentrations. In ultraviolet spectral region redistribution of optical oscillator strengths results in both increase and decrease of optical losses in selected spectral regions.