Skip to content

[Bug]: Vast.ai spot offers are filtered by their on-demand price, and spot bids are always min_bid #4516

Open

Description

@mempirate

Steps to reproduce

  1. Enable the vastai backend.
  2. Plan a task with:
    resources:
      gpu: B300:4
      disk: 1TB..
    spot_policy: spot
    max_price: 25
  3. dstack apply reports No matching instance offers available.
  4. dstack offer --gpu B300:4 --disk 1TB.. --backend vastai --spot lists offer 61833100 (us-georgia) at $21.52 spot. The same machine is $44.96 on-demand.
  5. Raise max_price and plan again:
max_price Plan result
25 No offers
30 Only offers from other backends
44 Vast offer 61833100, spot, $21.5167

Actual behaviour

1. max_price is checked against the on-demand price, even for spot. A spot offer only appears once max_price is above the machine's on-demand price, even though its spot price is far below the cap.

make_filters() sends the cap to Vast's search as dph_total <= max_price, and dph_total is the on-demand price. So the machine is excluded server-side before get() can create its spot variant (min_bid + disk_cost). satisfies_filters() re-checks the same dph_total bound locally.

2. Spot instances are always created with a bid of exactly min_bid. run_job() bids the offer's min_bid, and the run's max_price doesn't affect the bid. The minimum bid loses to anyone bidding more: a B200:4 instance of ours was outbid about 10 minutes after it started.

3. Minor: offer order. With the default offer_order (Vast's score), raising the cap to work around (1) can rent a ~$44 spot host before the $21.52 one unless offer_order: price is set.

Expected behaviour

  • For spot offers, max_price is compared with the spot price (min_bid + disk_cost), so max_price: 25 finds the $21.52 offer.
  • The bid can be set higher than min_bid, up to max_price, so that a spot instance isn't outbid immediately.

dstack version

0.22.6 (gpuhunt 0.1.35). The same code is on dstack master (78ad042) and gpuhunt main (02bce82).

Server logs

Additional information

Possible fixes

  1. gpuhunt: don't send dph_total bounds when spot items can be returned (q.spot is None or True), and drop dph_total from the local satisfies_filters() check.
    • Catalog._get_online_provider_items() already re-filters every item with constraints.matches() against item.price, which is the right price for each variant.
    • To keep the search result limit from filling with offers over budget, a server-side min_bid <= max_price bound would be a superset for both variants, if Vast accepts min_bid as a search filter and still returns machines that have no min_bid.
  2. dstack: add a Vast backend option for the bid, for example spot_bid: min | <markup such as 1.2x> | max_price.
    • Default min, so current behaviour is unchanged.
    • The bid is clamped to [min_bid, max_price].
    • The bid is recorded as the instance price.
    • Whether bidding up to max_price is a sensible default depends on whether Vast bills interruptible instances at the bid or at the market rate.

Workaround for (1): set max_price above the on-demand price and add offer_order: price. dstack still bids min_bid. There is no workaround for (2) short of spot_policy: on-demand.

Related: #4025 (Vast.ai spot support).

Activity

  1. added
    bug
    on Nov 23, 2026
  2. r4victor commented on Nov 24, 2026

    @r4victor
    Collaborator

    @mempirate, agreed on the fix for filtering here. When max_price is set, we need separate Vast search requests: dph_total <= max_price for on-demand offers and min_bid <= max_price for spot offers. A single bound doesn't work for both: with dph_total, cheap spot offers on machines with expensive on-demand are dropped (this issue); with min_bid, and machines affordable only as spot can crowd out the ones affordable on-demand. Vast's search has no OR. With spot_policy: auto, that's two requests, each keeping only its own variant. Passing allocated_storage set to the requested disk size makes dph_total include the actual storage cost (it prices only 8 GB by default).

    I'd keep bidding min_bid as we do now. Vast bills interruptible instances at the bid, not at the market rate. Bidding up to max_price would make every spot run cost the cap, and a markup such as 1.2x would add a fixed premium to every hour while only protecting against bids within that margin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions