Skip to main content
. 2023 Feb 2;25(2):282. doi: 10.3390/e25020282
Algorithm 1 Model extraction attack algorithm. Given a data set X, a substitute model Fθ with initial parameters θ, and a target model G, return a substitute model Fθ with similar functionality to G. Notice that the update of Z and z˜ can also be placed in the inner loop; here, it is placed outside for the sake of brevity:
  • 1:

    XInstanceselection(X)

  • 2:

    θθ

  • 3:

    repeat

  • 4:

        DSelect(X,step)

  • 5:

        stepstep+Δ

  • 6:

        H1,LFθ(D)

▹ Query substitute model
  • 7:

        Z0H1×C

▹ Initialize the consistency regularization
  • 8:

        z˜0H1×C

  • 9:

        H2G(L)

▹ Leave high confidence data
  • 10:

      for t in [1, epochs] do

  • 11:

            ziFθxiH1H2

▹ Train substitute model
  • 12:

            loss1H2xiH2logziyi

▹ supervised loss
  • 13:

            +w(t)1CH1xiH1ziz˜i2

▹ unsupervised loss
  • 14:

            update θ using, e.g., ADAM

  • 15:

        end for

  • 16:

        ZαZ+(1α)Z

▹ accumulate ensemble predictions
  • 17:

        Z˜Z/1αt

▹ bias correction
  • 18:

    until  FθG

  • 19:

    return  Fθ