How is it possible that validation loss is increasing while validation accuracy is increasing as well I am training a simple neural network on the CIFAR10 dataset. After some time, validation loss started to increase, whereas validation accuracy is also increasing. The test loss and test accuracy continue to improve.
How is this possible? It seems that if validation loss increase, accuracy should decrease. 
P.S. There are several similar questions, but nobody explained what was happening there.
 A: Let's say a label is horse and a prediction is:
cat   (25%)
dog   (35%)
horse (40%)

So, your model is predicting correct, but it's less sure about it. This is how you get high accuracy and high loss
A: Other answers explain well how accuracy and loss are not necessarily exactly (inversely) correlated, as loss measures a difference between raw prediction (float) and class (0 or 1), while accuracy measures the difference between thresholded prediction (0 or 1) and class. So if raw predictions change, loss changes but accuracy is more "resilient" as predictions need to go over/under a threshold to actually change accuracy.
However, accuracy and loss intuitively seem to be somewhat (inversely) correlated, as better predictions should lead to lower loss and higher accuracy, and the case of higher loss and higher accuracy shown by OP is surprising. I have myself encountered this case several times, and I present here my conclusions based on the analysis I had conducted at the time. There may be other reasons for OP's case.

Let's consider the case of binary classification, where the task is to predict whether an image is a cat or a horse, and the output of the network is a sigmoid (outputting a float between 0 and 1), where we train the network to output 1 if the image is one of a cat and 0 otherwise. I believe that in this case, two phenomenons are happening at the same time.

*

*Some images with borderline predictions get predicted better and so their output class changes (eg a cat image whose prediction was 0.4 becomes 0.6). This is the classic "loss decreases while accuracy increases" behavior that we expect.


*Some images with very bad predictions keep getting worse (eg a cat image whose prediction was 0.2 becomes 0.1). This leads to a less classic "loss increases while accuracy stays the same".  Note that when one uses cross-entropy loss for classification as it is usually done, bad predictions are penalized much more strongly than good predictions are rewarded. For a cat image, the loss is $log(1-prediction)$, so even if many cat images are correctly predicted (low loss), a single misclassified cat image will have a high loss, hence "blowing up" your mean loss. See this answer for further illustration of this phenomenon. (Getting increasing loss and stable accuracy could also be caused by good predictions being classified a little worse, but I find it less likely because of this loss "asymmetry").
So I think that when both accuracy and loss are increasing, the network is starting to overfit, and both phenomena are happening at the same time. The network is starting to learn patterns only relevant for the training set and not great for generalization, leading to phenomenon 2, some images from the validation set get predicted really wrong, with an effect amplified by the "loss asymmetry". However, it is at the same time still learning some patterns which are useful for generalization (phenomenon one, "good learning") as more and more images are being correctly classified.
I sadly have no answer for whether or not this "overfitting" is a bad thing in this case: should we stop the learning once the network is starting to learn spurious patterns, even though it's continuing to learn useful ones along the way?
Finally, I think this effect can be further obscured in the case of multi-class classification, where the network at a given epoch might be severely overfit on some classes but still learning on others.
A: Accuracy of a set is evaluated by just cross-checking the highest softmax output and the correct labeled class.It is not depended on how high is the softmax output.
To make it clearer, here are some numbers.
Suppose there are 2 classes - horse and dog. For our case, the correct class is horse . Now, the output of the softmax is [0.9, 0.1].
For this loss ~0.37. The classifier will predict that it is a horse.
Take another case where softmax output is [0.6, 0.4]. Loss ~0.6.
The classifier will still predict that it is a horse.
But surely, the loss has increased.
So, it is all about the output distribution.
A: Many answers focus on the mathematical calculation explaining how is this possible. But they don't explain why it becomes so. And they cannot suggest how to digger further to be more clear. 
I have 3 hypothesis. And suggest some experiments to verify them. Hopefully it can help explain this problem.


*

*Label is noisy. Compare the false predictions when val_loss is minimum and val_acc is maximum. Check whether these sample are correctly labelled.

*[Less likely] The model doesn't have enough aspect of information to be certain. Experiment with more and larger hidden layers.

*[A very wild guess] This is a case where the model is less certain about certain things as being trained longer. Such situation happens to human as well. When someone started to learn a technique, he is told exactly what is good or bad, what is certain things for (high certainty). When he goes through more cases and examples, he realizes sometimes certain border can be blur (less certain, higher loss), even though he can make better decisions (more accuracy). And he may eventually gets more certain when he becomes a master after going through a huge list of samples and lots of trial and errors (more training data). So in this case, I suggest experiment with adding more noise to the training data (not label) may be helpful. 


Don't argue about this by just saying if you disagree with these hypothesis. It will be more meaningful to discuss with experiments to verify them, no matter the results prove them right, or prove them wrong.
A: From Ankur's answer, it seems to me that:

Accuracy measures the percentage correctness of the prediction i.e. $\frac{correct-classes}{total-classes}$

while

Loss actually tracks the inverse-confidence (for want of a better word) of the prediction. A high Loss score indicates that, even when the model is making good predictions, it is $less$ sure of the predictions it is making...and vice-versa.

So...

High Validation Accuracy + High Loss Score vs High Training Accuracy + Low Loss Score suggest that the model may be over-fitting on the training data.

A: A model can overfit to cross entropy loss without over overfitting to accuracy. 
There is a key difference between the two types of loss:


*

*Accuracy measures whether you get the prediction right

*Cross entropy measures how confident you are about a prediction


For example, if an image of a cat is passed into two models. Model A predicts {cat: 0.9, dog: 0.1} and model B predicts {cat: 0.6, dog: 0.4}. Both model will score the same accuracy, but model A will have a lower loss. 
Because of this the model will try to be more and more confident to minimize loss. It works fine in training stage, but in validation stage it will perform poorly in term of loss. For example, for some borderline images, being confident e.g. {cat: 0.9, dog: 0.1} will give higher loss than being uncertain e.g. {cat: 0.6, dog: 0.4}
In short, cross entropy loss measures the calibration of a model. Mis-calibration is a common issue to modern neuronal networks. They tend to be over-confident. On Calibration of Modern Neural Networks talks about it in great details.
