  Continuous-variable quantum key distribution (CV QKD) with discrete
modulation has attracted increasing attention due to its experimental
simplicity, lower-cost implementation and compatibility with classical optical
communication. Correspondingly, some novel numerical methods have been proposed
to analyze the security of these protocols against collective attacks, which
promotes key rates over one hundred kilometers of fiber distance. However,
numerical methods are limited by their calculation time and resource
consumption, for which they cannot play more roles on mobile platforms in
quantum networks. To improve this issue, a neural network model predicting key
rates in nearly real time has been proposed previously. Here, we go further and
show a neural network model combined with Bayesian optimization. This model
automatically designs the best architecture of neural network computing key
rates in real time. We demonstrate our model with two variants of CV QKD
protocols with quaternary modulation. The results show high reliability with
secure probability as high as $99.15\%-99.59\%$, considerable tightness and
high efficiency with speedup of approximately $10^7$ in both cases. This
inspiring model enables the real-time computation of unstructured quantum key
distribution protocols' key rate more automatically and efficiently, which has
met the growing needs of implementing QKD protocols on moving platforms.
