Abstract: Sol-gel technology excels in tailoring catalysts, electrocatalysts, sensors and biosensors, as well as membrane and other separation technologies, which require accurate control of the structure and chemical affinity of gels and xerogels. One of the most successful techniques for achieving controlled porosity is by introduction of inorganic, organic, or even biological agents during the polymerization step. Subsequent removal of the agents leaves stable vacant imprints of the template agent. However, still today template design and molecular imprinting are largely guided by experimental achievements and qualitative perceptions rather than by comprehensive theories. In this paper we review our recent theoretical efforts based on statistical mechanics models aimed at understanding and generalizing the conditions that are likely to result in successful template formation. However, the current models are still coarse-grained and consider the average size of cavities while disregarding their shape, structure, and chemical functionality. We studied three generic ways for the introduction of pore forming agents: (1) Cross- linking of functional monomers in the presence of non- covalently bonded rigid templates. (2) Polymerization of silicon species and organic monomers which are removed after gel formation using chemical treatment. (3) Polycondensation of a monomer containing a pendant group that is released during or after polymerization and cross-linking