A novel connectionist model accounting for cognitive dissonance is described, in which the concepts of self and attention are considered. The model makes it possible to use mathematical formulas to represent the cognitive-dissonance process. Analysis reveals that the model fits experimental data of major paradigms in cognitive dissonance theory and that attention-focus switching causes building-up of cognitive dissonance and retardation of its reduction.