The loss of VAE is negative. is it normal?

the function loss of VAE is :

def vae_loss(y_true, y_pred):
reconstruction_loss = binary_crossentropy(y_true, y_pred)
kl_loss= -0.5 * K.sum(1 + z_log_var - K.square(z_mean) - K.exp(z_log_var), axis=-1)
kl_loss *= self.beta
return K.mean(reconstruction_loss + kl_loss)


but the loss is negative as shown below:

Epoch 117/10000
45514/45514 [==============================] - 2s 35us/sample -
loss: -55757529.5688

Epoch 118/10000
45514/45514 [==============================] - 2s 35us/sample -
loss: -51309290.7953

Epoch 119/10000
45514/45514 [==============================] - 2s 35us/sample -
loss: -60928112.1458

Epoch 120/10000
44200/45514 [============================>.] - ETA: 0s -
loss: -65729846.4140

Restoring model weights from the end of the best epoch: 115.
45514/45514 [==============================] - 2s 37us/sample -
loss: -66230075.0281

Epoch 120: early stopping

With beta= 0.0001.
$$$$
`
• Quick reminder: what is the goal of a loss function? Answer: The lower you make it, the better the function operates. Explanation: it doesn’t matter if it’s negative. You’re not aiming for zero. You’re aiming for negative infinity. As long as the relationship where decreasing the loss makes the function operate better, whatever it is that you’ve made better to mean, then it’s doing its job. Commented Oct 31, 2023 at 10:55

$$L(x; \theta,\varphi) = E_{z∼q_\varphi(z|x)}[\log p_\theta(x|z)] − D_{KL}(q_\varphi(z|x)\Vert p(z))$$
In it, KL divergence (subtracted term) has range $$[0, \infty]$$. Cross entropy, i.e. the expected value of $$\log p_\theta(x|z)$$, is the sum of weighted values of $$\log p_\theta(x|z)$$, hence it lies in $$[-\infty, 0]$$. Therefore, the term is always negative. There are different expressions that you can find here.