Usually these values are not computed alone: the entire collection of $v_i$ and $\log(1 - \exp(v_i))$ is needed. That changes the analysis of computational effort.
To this end, let
$$\bar x = \log\left(\sum_{j} e^{x_j}\right) = x_k + \log\left(1 + \sum_{j\ne k} e^{x_j-x_k}\right)$$
for any index $k.$ The right hand expression shows how $\bar x - x_k$ can be computed in a numerically stable way when $k$ is the index of the largest argument, for then the argument of the logarithm is between $1$ and $n$ (the number of the $x_i$) and the sum can be accurately computed using exp
(especially when the $x_j$ are ordered from smallest to largest in the sum).
The relation
$$\eqalign{
\log\left(1 - \frac{e^{x_i}}{\sum_{j} e^{x_j}}\right) &= \log\left(\frac{\sum_{j\ne i} e^{x_j}}{\sum_{j} e^{x_j}}\right) \\
&= \log\left(\sum_{j\ne i} e^{x_j}\right) - x_k + \log\left(\frac{e^{x_k}}{\sum_{j} e^{x_j}}\right) \\
&= \log\left(-e^{x_i} + \sum_{j} e^{x_j}\right) - x_k + v_k \\
&= \log\left(1 - e^{x_i - \bar x}\right) + (\bar x - x_k) + v_k
}$$
reduces the problem to finding that last logarithm, which is accomplished by applying a log1mexp
function to the difference $x_i - \bar x.$
For $n$ arguments $x_i,$ $i=1,2,\ldots, n,$ the total effort to compute all $2n$ values is
$n$ computations of the $v_i$ using logsoftmax
.
One computation of $\bar x - x_k$ (using $n-1$ exponentials and a logarithm).
$n$ invocations of log1mexp
.