Blyx Nest Blyx language
Registry / Framework
framework · v0.1.1

Flightdeck pairwise-rank

Train a pairwise ranker on preferred and rejected scores and return both gradients.

Source repository · Package JSON

Use Flightdeck pairwise-rank

use vendor::fd_pairwise_rank::pairwise_rank;

Run the example

nest demo fd_pairwise_rank@0.1.1
blyxc native-run fd_pairwise_rank-demo/main.blyx
Example source and expected output
use vendor::fd_pairwise_rank::pairwise_rank;
fn main() { fd_pairwise_rank(2, 7); }

Expected output

module {
  func.func @main(%winner: tensor<2x7xf32>, %loser: tensor<2x7xf32>) -> (tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>) {
    %v0 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<2x7xf32>
    %v1 = stablehlo.subtract %loser, %winner : tensor<2x7xf32>
    %v2 = stablehlo.logistic %v1 : tensor<2x7xf32>
    %v3 = stablehlo.maximum %v1, %v0 : tensor<2x7xf32>
    %v4 = stablehlo.abs %v1 : tensor<2x7xf32>
    %v5 = stablehlo.negate %v4 : tensor<2x7xf32>
    %v6 = stablehlo.exponential %v5 : tensor<2x7xf32>
    %v7 = stablehlo.log_plus_one %v6 : tensor<2x7xf32>
    %v8 = stablehlo.add %v3, %v7 : tensor<2x7xf32>
    %v9 = stablehlo.negate %v2 : tensor<2x7xf32>
    return %v8, %v9, %v2 : tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>
  }
}

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d5003957546765ada57e9e9b05a146784f5ba49c704e1cee4f10c0f8d6e04e57b515b
0.1.0Download ZIP · Browse filesd5835c5109ea7abc3abad0466ce76c5003706cfc947e390299f034f9dc87f82b22e1abfa29