gcp.vertex-ai-tuning-job

GCP Vertex AI Tuning Job Resource

Vertex AI Tuning Jobs fine-tune foundation models (e.g. supervised fine-tuning or preference optimization of Gemini models). They are distinct from Hyperparameter Tuning Jobs, which run automated hyperparameter search over custom training workloads.

example:

List all Tuning Jobs in specific locations:

policies:
  - name: vertexai-tuning-jobs-inventory
    resource: gcp.vertex-ai-tuning-job
    query:
      - location: us-central1
      - location: europe-west4
example:

Find Tuning Jobs that have been running for more than 24 hours:

policies:
  - name: gcp-vertex-ai-tuning-jobs-long-running
    resource: gcp.vertex-ai-tuning-job
    query:
      - filter: 'state="JOB_STATE_RUNNING"'
    filters:
      - type: value
        key: startTime
        value_type: age
        op: greater-than
        value: 1
example:

Find Tuning Jobs not using an approved service account:

policies:
  - name: gcp-vertex-ai-tuning-jobs-unapproved-service-account
    resource: gcp.vertex-ai-tuning-job
    filters:
      - type: value
        key: serviceAccount
        op: not-in
        value:
          - tuning@my-project.iam.gserviceaccount.com
example:

Find Tuning Jobs missing a valid data-classification label:

policies:
  - name: gcp-vertex-ai-tuning-jobs-data-classification
    resource: gcp.vertex-ai-tuning-job
    filters:
      - not:
        - type: value
          key: labels."data-classification"
          op: in
          value: [public, private, confidential, restricted]

Filters

metrics

Supports metrics filters on resources.

All resources that have cloud watch metrics are supported.

Docs on cloud watch metrics

- name: firewall-hit-count
  resource: gcp.firewall
  filters:
    - type: metrics
      name: firewallinsights.googleapis.com/subnet/firewall_hit_count
      aligner: ALIGN_COUNT
      days: 14
      value: 1
      op: greater-than

The period-start key allows you to align the metric window in two ways. By default, using auto, the window is computed relative to the current time. Alternatively, setting it to start-of-day aligns the window to full UTC calendar days, beginning at 00:00:00 UTC and ending at current day 00:00:00 UTC.

- name: instance-low-cpu-last-full-day
  resource: gcp.instance
  filters:
    - type: metrics
      name: compute.googleapis.com/instance/cpu/utilization
      aligner: ALIGN_MEAN
      days: 1
      value: 0.05
      op: less-than
      period-start: start-of-day

Cloud Monitoring returns a DISTRIBUTION-typed metric as a histogram rather than a number. The distribution key chooses how to reduce one to a scalar: count, mean, or sum (the default), reconstructed as count * mean since a histogram carries no total. Scalar metrics ignore the key. Either way the filter compares the most recent point in the window, so a metric left on the default ALIGN_NONE is read on its latest sample, not its total.

- name: tuned-model-chatty-responses
  resource: gcp.vertex-ai-endpoint
  filters:
    - type: metrics
      name: aiplatform.googleapis.com/tuned_model/online_serving/tokens
      aligner: ALIGN_SUM
      reducer: REDUCE_SUM
      group-by-fields: ["resource.labels.endpoint_id"]
      distribution: mean
      days: 1
      value: 100
      op: greater-than
properties:
  aligner:
    enum:
    - ALIGN_NONE
    - ALIGN_DELTA
    - ALIGN_RATE
    - ALIGN_INTERPOLATE
    - ALIGN_MIN
    - ALIGN_MAX
    - ALIGN_MEAN
    - ALIGN_COUNT
    - ALIGN_SUM
    - REDUCE_COUNT_FALSE
    - ALIGN_STDDEV
    - ALIGN_COUNT_TRUE
    - ALIGN_COUNT_FALSE
    - ALIGN_FRACTION_TRUE
    - ALIGN_PERCENTILE_99
    - ALIGN_PERCENTILE_95
    - ALIGN_PERCENTILE_50
    - ALIGN_PERCENTILE_05
    - ALIGN_PERCENT_CHANG
    type: string
  days:
    type: number
  distribution:
    enum:
    - count
    - mean
    - sum
    type: string
  filter:
    type: string
  group-by-fields:
    items:
      type: string
    type: array
  metric-key:
    type: string
  missing-value:
    type: number
  name:
    type: string
  op:
    enum:
    - eq
    - equal
    - ne
    - not-equal
    - gt
    - greater-than
    - ge
    - gte
    - le
    - lte
    - lt
    - less-than
    - glob
    - regex
    - regex-case
    - in
    - ni
    - not-in
    - contains
    - difference
    - intersect
    - mod
    type: string
  period-start:
    enum:
    - auto
    - start-of-day
    type: string
  reducer:
    enum:
    - REDUCE_NONE
    - REDUCE_MEAN
    - REDUCE_MIN
    - REDUCE_MAX
    - REDUCE_MEAN
    - REDUCE_SUM
    - REDUCE_STDDEV
    - REDUCE_COUNT
    - REDUCE_COUNT_TRUE
    - REDUCE_COUNT_FALSE
    - REDUCE_FRACTION_TRUE
    - REDUCE_PERCENTILE_99
    - REDUCE_PERCENTILE_95
    - REDUCE_PERCENTILE_50
    - REDUCE_PERCENTILE_05
    type: string
  type:
    enum:
    - metrics
  value:
    type: number
required:
- value
- name
- op

Permissions - monitoring.timeSeries.list

Actions

cancel

Cancel Vertex AI Tuning Jobs

Cancels a running Vertex AI Tuning Job. This is useful for cost control when fine-tuning jobs run longer than expected or were submitted without approval.

Note: Only jobs in a non-terminal state can be cancelled; jobs in any other state are logged and skipped.

example:

Cancel tuning jobs that have been running for more than 24 hours:

policies:
  - name: cancel-long-running-tuning-jobs
    resource: gcp.vertex-ai-tuning-job
    query:
      - filter: 'state="JOB_STATE_RUNNING"'
    filters:
      - type: value
        key: startTime
        value_type: age
        op: greater-than
        value: 1
    actions:
      - type: cancel

https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.tuningJobs/cancel

properties:
  type:
    enum:
    - cancel
required:
- type

Permissions - aiplatform.tuningJobs.cancel