Moderation decisions for uploaded video

Decide whether each upload is shown to everyone, restricted to adults or held for a moderator, with policy tags, a rationale and timed evidence.

This pipeline moderates user-generated video under a written policy. A nudity classifier scores the sampled frames and the speech is transcribed; Gemini watches the clip with those results and returns policy tags, whether a minor appears, a rationale, timed evidence and a decision: allow the clip, restrict it to signed-in adults or hold it for a moderator. A filter sends only the clips that need a person to a review step.

The example ran on a labelled test set of 26 clips: 13 stock videos and 13 lines spoken by a synthetic voice over kitchen footage, including look-alikes that the policy allows, such as a place name that contains a swear word. All 26 decisions matched their labels. See three of the clips beside the other examples in the pipeline examples.

“The weather in Scunthorpe is lovely, so we walked to Penistone and back.”0:07AllowNo policy violations or restricted content were found in the video. The kitchen knife shown is used for its standard purpose and is excluded from weapon tags.
“Shake the gin and lime juice in the cocktail shaker, then pour it over crushed ice.”0:08Adults onlyalcoholThe video mentions preparing an alcoholic drink (gin), triggering alcohol (age_restrict). No other policy violations or look-alikes are present.
“If you steal my recipe again, I will find out where you live and hurt you.”0:07Hold for reviewharassmentHarassment sets review for threatening harm in speech. Kitchen knives used for their purpose are ruled out as tools.

Factory produced the decisions and rationales. The example clips use synthetic voices.

All 26 decisions matched their labels: 13 clips allowed, 8 restricted to adults and 5 held for review.

The adjudicate step is an llm step. Editframe enables pipelines, and llm steps, for an organization after you tell us about your footage.

What it produces

The pipeline renders no video. Its output is the adjudicate step's answer, and the state of the run tells your application what to do with the clip:

  • A clip the policy allows or restricts to adults ends filtered at needs_review. Read the decision from adjudicate and show the clip to everyone or only to signed-in adults.
  • A clip the policy holds for review waits in review until a moderator approves it, which keeps it held for policy action, or rejects it, which allows it.

This is the adjudicate output for the clip that names Scunthorpe and Penistone, without its llm record:

json
{
  "decision": "allow",
  "assessment": {
    "evidence": [],
    "rationale": "No policy tags apply. The speech mentions 'Pennistone', which resembles profanity but is a proper name/ordinary word containing a swear word and is thus excluded.",
    "lookalikes": [
      {
        "text": "Pennistone is mentioned, which is an ordinary word/name containing a swear word and is excluded.",
        "end_ms": 4046,
        "source": "speech",
        "start_ms": 3586,
        "resembles": "profanity.strong"
      }
    ],
    "policy_tags": [],
    "minors_present": false
  }
}

The pipeline

This is the example's pipeline.json, step by step. A step starts when the steps in its needs have finished, so the frames and the transcript are prepared at the same time. The long instructions and output.schema of the llm step are shown below it.

probe

Reads the clip's duration, frame size and tracks.

json
{ "probe": { "type": "probe" } }

frames

Takes a frame every second.

json
{
  "frames": {
    "type": "sample_frames",
    "needs": ["probe"],
    "with": { "every_ms": 1000 }
  }
}

nsfw

Scores each frame with an open nudity classifier.

json
{
  "nsfw": {
    "type": "model",
    "needs": ["frames"],
    "with": {
      "provider": "huggingface",
      "model": "onnx-community/nsfw_image_detection-ONNX",
      "task": "image-classification",
      "revision": "1ceb3c7fe1e9f3f2507e6df577437f23a9149fd5",
      "min_confidence": 0.05
    }
  }
}

transcript

Transcribes the speech.

json
{ "transcript": { "type": "transcribe", "needs": ["probe"] } }

adjudicate

Gemini watches the clip, applies the platform's policy and returns tags, whether a minor appears, a rationale, evidence and the decision.

json
{
  "adjudicate": {
    "type": "llm",
    "needs": ["nsfw", "transcript"],
    "with": {
      "provider": "google",
      "model": "gemini-3.5-flash-lite",
      "instructions": "…",
      "include": ["nsfw.metadata.max_scores", "transcript"],
      "max_frames": 0,
      "attach_video": true,
      "output": { "mode": "json", "schema": "…" }
    }
  }
}
Instructions of adjudicate
text
You moderate user-generated video for a general-audience platform: decide whether it is shown to
everyone (allow), only to signed-in adults (age_restrict), or held for a human moderator
(review). Judge from the attached video and its audio, the transcript of its speech and the
nudity classifier's highest score per label across the frames (nsfw.metadata.max_scores, from 0
to 1; a label it leaves out scored below 0.05). Fill in the assessment first and the decision
last.

Policy tags, each with the decision it sets. Apply every tag that fits, including weapon.toy and
profanity.mild, which allow the video but tell moderators and advertisers what it contains. Tag
only what the video shows or its speech says, never what the setting merely suggests.
- alcohol (age_restrict): drinking, pouring, serving or preparing an alcoholic drink, seen or
  described in speech. Beer, wine, spirits and cocktails are alcoholic unless they are shown or
  said to be alcohol-free; juice, water, coffee, soft drinks and food are not.
- tobacco.smoking (age_restrict): smoking a cigarette, cigar or pipe. tobacco.vaping
  (age_restrict): using an e-cigarette or vape.
- drugs (review): using, buying, selling or promoting illegal or recreational drugs, such as
  cannabis, cocaine or ecstasy, seen or described in speech. Medicine taken as a doctor or its
  label directs is not tagged.
- weapon.firearm (review): a real or realistic firearm, including antique, hunting and
  reenactment guns. weapon.replica (review): a paintball marker, airsoft gun or prop gun that
  looks like a firearm, also in games and sports. weapon.toy (allow): a toy that is clearly not
  a weapon, such as a brightly coloured water gun. Kitchen knives and tools used for their
  purpose are not tagged.
- profanity.mild (allow): mild swear words such as damn, crap or hell. profanity.strong
  (age_restrict): fuck, shit and words formed from them. Judge whole words: a name or an
  ordinary word that contains a swear word is not profanity.
- harassment (review): insults, slurs or threats of harm aimed at a person or group, including
  the viewer. Insults aimed at objects or at oneself, and figures of speech that threaten no
  one, are not harassment.
- nudity (review): sexual activity, or exposed genitals, buttocks or female nipples. Swimwear
  and bare chests in non-sexual settings are not nudity. The classifier also scores swimwear and
  bare skin highly, so an nsfw score above 0.8 is a reason to look closely, not proof: tag
  nudity only when the video shows it.

Check speech against the audio: the transcript is automatic, and over music, noise or silence it
can contain words nobody said, often repeated fillers. Tag speech only when a person or a
voice-over in the video says it.

minors_present is true when a person who looks under 18 is visible.

decision: review when minors_present is true and alcohol, tobacco.smoking, tobacco.vaping,
drugs, weapon.firearm or weapon.replica applies. Otherwise the strictest decision of the tags
you applied, where review is stricter than age_restrict and age_restrict than allow; allow when
no tag applies.

Evidence: one item for each tag you apply, and one of kind minor when minors_present is true.
start_ms and end_ms span the moments it is seen or heard, in milliseconds from the start of the
video, not the whole video unless it lasts that long; speech takes the times of its transcript
words. text quotes the whole sentence said or describes what is seen. Give no other evidence.

rationale: one or two sentences a moderator can act on: each tag with the decision it sets, then
each look-alike you ruled out, seen or said, with the exclusion that applies.
Output schema of adjudicate
json
{
  "type": "object",
  "properties": {
    "assessment": {
      "type": "object",
      "properties": {
        "evidence": {
          "type": "array",
          "maxItems": 16,
          "items": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "alcohol",
                  "tobacco.smoking",
                  "tobacco.vaping",
                  "drugs",
                  "weapon.firearm",
                  "weapon.replica",
                  "weapon.toy",
                  "profanity.mild",
                  "profanity.strong",
                  "harassment",
                  "nudity",
                  "minor"
                ]
              },
              "source": { "type": "string", "enum": ["video", "speech"] },
              "start_ms": { "type": "integer", "minimum": 0 },
              "end_ms": { "type": "integer", "minimum": 0 },
              "text": { "type": "string" }
            },
            "required": ["kind", "source", "start_ms", "end_ms", "text"]
          }
        },
        "minors_present": { "type": "boolean" },
        "policy_tags": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "alcohol",
              "tobacco.smoking",
              "tobacco.vaping",
              "drugs",
              "weapon.firearm",
              "weapon.replica",
              "weapon.toy",
              "profanity.mild",
              "profanity.strong",
              "harassment",
              "nudity"
            ]
          }
        },
        "rationale": { "type": "string" }
      },
      "required": ["evidence", "minors_present", "policy_tags", "rationale"]
    },
    "decision": { "type": "string", "enum": ["allow", "age_restrict", "review"] }
  },
  "required": ["assessment", "decision"]
}

needs_review

Continues only when the decision or its tags call for a moderator.

json
{
  "needs_review": {
    "type": "filter",
    "needs": ["adjudicate"],
    "when": {
      "any": [
        { "path": "adjudicate.metadata.decision", "op": "eq", "value": "review" },
        {
          "path": "adjudicate.metadata.assessment.policy_tags",
          "op": "contains",
          "value": "weapon.firearm"
        },
        {
          "path": "adjudicate.metadata.assessment.policy_tags",
          "op": "contains",
          "value": "weapon.replica"
        },
        {
          "path": "adjudicate.metadata.assessment.policy_tags",
          "op": "contains",
          "value": "drugs"
        },
        {
          "path": "adjudicate.metadata.assessment.policy_tags",
          "op": "contains",
          "value": "harassment"
        },
        {
          "path": "adjudicate.metadata.assessment.policy_tags",
          "op": "contains",
          "value": "nudity"
        },
        {
          "all": [
            {
              "path": "adjudicate.metadata.assessment.minors_present",
              "op": "eq",
              "value": true
            },
            {
              "any": [
                {
                  "path": "adjudicate.metadata.assessment.policy_tags",
                  "op": "contains",
                  "value": "alcohol"
                },
                {
                  "path": "adjudicate.metadata.assessment.policy_tags",
                  "op": "contains",
                  "value": "tobacco.smoking"
                },
                {
                  "path": "adjudicate.metadata.assessment.policy_tags",
                  "op": "contains",
                  "value": "tobacco.vaping"
                }
              ]
            }
          ]
        }
      ]
    }
  }
}

review

Holds those clips for a moderator to confirm or correct.

json
{
  "review": {
    "type": "review",
    "needs": ["needs_review"],
    "with": {
      "instructions": "Confirm or correct the adjudicator's policy tags and decision against its evidence. Approve to keep the video in review for policy action; reject to allow it.",
      "expires_after_ms": 604800000,
      "on_expiry": "fail"
    }
  }
}

How the filter uses the decision

The pipeline has no template. The needs_review filter reads the adjudicate answer by path: it succeeds, and the run continues to review, when the decision is review or when the tags include a policy that always needs a person, even if the model chose a milder decision. Otherwise the filter is skipped and the run ends filtered, which is not an error. The rule for minors combines all and any: a clip is held when a minor appears together with alcohol, smoking or vaping. See Branching with filters for the predicate syntax.

The policy itself is in the adjudicate instructions, so changing what each tag covers, or which decision a tag sets, is a change of those instructions and, for the tags that always need review, of the filter.

Run it

The example lives in elements/examples/moderation/ in the Editframe repository: pipeline.json, sources.json with each clip's download URL, licence, attribution and labels, example.json with the pipeline's name, rubric.md, the criteria its output is judged by, synthesize.mjs, which built the synthetic-voice clips, and benchmark.mjs, which scores a run against the labels. From the repository root, with an API key of an organization that has pipelines and llm steps enabled:

bash
export EDITFRAME_TOKEN="$EDITFRAME_API_KEY"
node elements/examples/scripts/run-example.mjs moderation
node elements/examples/moderation/benchmark.mjs <run-dir>

example.json names the pipeline example-moderation and lists no items, so the group runs every video in sources.json, eight at a time (max_in_flight). The script finds the pipeline by name or creates it, adds a version when the definition changed, and starts the group, whose runs read each clip from its download URL. It approves each review unchanged, as a moderator confirming every hold would; --review reject rejects them and --review wait leaves them for you to decide. Running the same version again returns the earlier group unless you pass --fresh, and --items runs only the clips you name.

The script saves the results under ~/.cache/editframe/example-runs/moderation/<group-id>/ and prints that directory, <run-dir>: summary.json with the definition the runs used, and for each clip run.json and outputs/<namespace>.json. benchmark.mjs scores the decisions, policy tags, minors and evidence against each clip's labels, divides step time, usage and model tokens by the input minutes, and writes benchmark.json beside them. Requests go to EDITFRAME_HOST, https://editframe.com by default.

Licences