Skip to main content
. 2025 Jul 24;27(8):784. doi: 10.3390/e27080784
Algorithm 3 Bayesian Multi-Hypothesis Detection Framework
Require: text, LLM_models = [GPT, LLaMA, PaLM, Claude], watermark_params, usage_priors
Ensure: most_likely_source, confidence_score, is_ai_generated
  •   1:

    // Stage 1: Curvature-Based Screening

  •   2:

    fcurveExtractCurvatureFeatures(text)      ▹ Algorithm 2

  •   3:

    pai_curveClassifyByCurvature(fcurve)

  •   4:

    // Stage 2: Multi-Model Watermark Testing

  •   5:

    hypotheses[H0:human]

  •   6:

    likelihoods[P(X|H0)]      ▹ From curvature classifier

  •   7:

    for each modeli in LLM_models do

  •   8:

        for each watermark_paramj in watermark_params do

  •   9:

              Hijhypothesis(modeli,watermark paramsj)

  •   10:

            fwatermarkExtractWatermarkFeatures(text,modeli,watermark_paramj)

  •   11:

            ΛijComputeLikelihoodRatio(fwatermark)      ▹ Equation (8)

  •   12:

            P(X|Hij)CombineLikelihoods(pai_curve,Λij)

  •   13:

            hypotheses.append(Hij)

  •   14:

            likelihoods.append(P(X|Hij))

  •   15:

        end for

  •   16:

    end for

  •   17:

    // Stage 3: Bayesian Model Selection

  •   18:

    posteriors[]

  •   19:

    for each hypothesis Hi in hypotheses do

  •   20:

        P(Hi|X)P(X|Hi)·P(Hi)jP(X|Hj)·P(Hj)      ▹ Bayes’ theorem

  •   21:

        posteriors.append(P(Hi|X))

  •   22:

    end for

  •   23:

    best_idxargmaxiposteriors[i]

  •   24:

    confidence_scoremax(posteriors)

  •   25:

    most_likely_sourcehypotheses[best_idx]

  •   26:

    is_ai_generatedmost_likely_sourceH0

  •   27:

    return most_likely_source, confidence_score, is_ai_generated