Accurate prediction of etching profiles is essential for optimizing semiconductor manufacturing processes. In this work, we present a novel approach to etch process optimization using the EtchAttnCVAE model, which combines conditional variational autoencoders (CVAE) with the attention mechanism to improve the precision of profile predictions. By leveraging three-dimensional plasma etching simulations and real process data, our model captures intricate details of etching profiles, ensuring high structural fidelity under varying conditions. The EtchAttnCVAE model enhances both forward and inverse optimization capabilities. In forward prediction, it accurately generates etching profiles from process conditions, while in inverse optimization, it efficiently identifies optimal recipes from target profiles. This dual capability is part of a comprehensive workflow, which begins with a neural network-based surrogate model for rapid predictions, followed by inverse model calibration and process optimization. Our results demonstrate that the EtchAttnCVAE model significantly outperforms traditional methods by accelerating recipe generation and improving prediction accuracy, making it an ideal solution for smart manufacturing in the semiconductor industry.