Formula: InfoNCE on dropout-augmented pairs
Details
l_i = -log exp(sim(h_i, h_i+)/tau) / sum_j exp(sim(h_i, h_j+)/tau). The positive is the SAME sentence encoded twice under different dropout masks, so the objective needs no labelled pairs at all. When every similarity is identical the loss is exactly log N, the value it must return on a degenerate batch.
Examples
M <- matrix(c(1, 2, 3, 4, 5, 6), nrow = 2)
Contse(M)
#> $estimate
#> [1] 1.026205
#>
#> $loss
#> [1] 1.026205
#>
#> $per_item
#> [1] 1.4187904 0.6336187
#>
#> $alignment
#> [1] 0.4654775
#>
#> $uniformity
#> [1] -1.633568
#>
#> $n
#> [1] 2
#>
#> $d
#> [1] 3
#>
#> $method
#> [1] "SimCSE contrastive sentence objective"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
