Drug discovery requires a significant amount of time and money, as it takes an average of 10 to 15 years and $2.6 billion to produce a new drug. Drug discovery research is initiated because there is a disease or medical condition for which no suitable drug is available. The hypothesis that inhibiting or activating a certain protein or pathway will have a therapeutic effect on a certain disease is formulated and verified. In general, hit-to-lead is an intensive SAR investigation around the structure of each core compound with measurements to establish the activity and selectivity of each compound while using methodologies such as molecular modeling, X-ray crystallography, and NMR to establish the magnitude of activity and selectivity of each compound. The optimization of lead compounds yields candidate compounds that undergo nonclinical and clinical trials, and are finally marketed after obtaining government approval. Lead optimization involves modifying known molecular structures to improve various parameters such as biological effects, physicochemical properties, toxicity, and stability. Typically, 200,000 to 1 million compounds are screened first. Then, more than 100 compounds are screened in hit-to-lead and lead optimization to narrow the molecules down to one or two candidates. Subsequently, it was shown that approximately 1 in 10 (10.4%, n=5,820) of the lead and all indications that entered Phase 1 were approved by the FDA. Thus, the project often fails and has a low success rate. If even a portion of these processes could be assisted by in silico methods, it would save a tremendous amount of time and expense. With recent developments of computers and algorithms, the application of computer science technology to drug discovery has been studied, and the efficiency and quality of the drug discovery processes have been improved. Molecular generative models are computer-based methods related to hit compound discovery and lead optimization. Molecular generative models have the advantage of being able to efficiently explore a huge chemical space and generate novel compounds with desirable properties using machine learning. They also have the advantage of avoiding explicitly dealing with complex chemical knowledge by using large compound datasets to train machine learning models. Several methods have been proposed to optimize molecules according to evaluation functions. The variational autoencoder can be used to generate molecules by modeling in the latent space. Then, optimization can be performed with the gradient method, leveraging the fact that the latent variables are continuous with the model that predicts the evaluation value from the latent variables. Such approximate models of the evaluation function are generally used in molecular optimization. String representation of molecules (SMILES) can be generated by long short-term memories (LSTMs) of recurrent neural networks . In this case, optimization is performed by retraining the generative model using the dataset in which molecules without the target property are removed from the generated molecules by the approximate model of the evaluation function.