A free-energy function for binary polycrystalline solid solutions is developed based on pairwise nearestneighbor interactions. The model permits intergranular regions to exhibit unique energetics and compositions from grain interiors, under the assumption of random site occupation in each region. For a given composition, there is an equilibrium grain size, and the alloy configuration in equilibrium generally involves solute segregation. The present approach reduces to a standard model of grain boundary segregation in the limit of infinite grain size, but substantially generalizes prior thermodynamic models for nanoscale alloy systems. In particular, the present model allows consideration of weakly segregating systems, systems away from the dilute limit, and is derived for structures of arbitrary dimensionality. A series of solutions for the equilibrium alloy configuration and grain size are also presented as a function of simple input parameters, including temperature, alloy interaction energies, and component grain boundary energies.