Explanation: The loss of a model goes to very small numbers and the accuracy to the very high ones very fast, within a few epochs. But these numbers are illusory; the results, in reality, are far from perfect.
Because of that, I added another level of calculating accuracy. Instead of relying on the model one and I calculate it with NumPy cosine similarity function. In reality, the accuracy after a few epochs is just 30-60% using the above function, not 95%>. In the previous version of the problem I, fortunately, was able to achieve 98% accuracy using cosine similarity after ~25 epochs.

Additional comment on the matter: I’m nooby in terms of ML. The newest problem I am trying to solve is far more complex than the previous one. It pushes me to create a custom loss function (LF). I think it should behave similarly to the binary cross-entropy LF as it so far did but, at the same time, it should somewhat be similar to cosine similarity to further punish the model for worse accuracy and to eliminate the necessity of calculating NumPy cosine similarity. Unfortunately, calculating them both together in one LF (with sums, multiplications, substractions) doesn’t provide good results, as I am not able to achieve even ~75% of the model’s accuracy.
I am not sure what direction I should go anymore. I think I am lacking some basic knowledge of how loss functions operate, how to point a model to the direction I want it to go rather than it, the problem, being a computational one.
I’ll be grateful for any advice.