In this paper, we define the SMARTBASEG architecture and show the preliminary results we have obtained in some experiments. Our proposal considers that the domain of Data Mining (DM) can be represented in terms of an ontology containing the definition of the main concepts involved in its algorithms. We also use ontology to describe some characteristics of a computational grid. This declarative feature of the architecture enables its dynamic optimization layer to decide how to transform procedures of DM applications into Grid-adapted tasks and submit them to the Grid layer, aiming at resulting in efficient load balancing. To do that, the optimization layer uses knowledge base that makes heuristics explicit based on DM and Grid knowledge. SMARTBASEG also offers components that facilitate the development of DM applications for Grids.