Repository navigation
Description
Steps to reproduce
- Enable the
vastaibackend. - Plan a task with:
resources: gpu: B300:4 disk: 1TB.. spot_policy: spot max_price: 25
dstack applyreportsNo matching instance offers available.dstack offer --gpu B300:4 --disk 1TB.. --backend vastai --spotlists offer61833100(us-georgia) at $21.52 spot. The same machine is $44.96 on-demand.- Raise
max_priceand 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_priceis compared with the spot price (min_bid + disk_cost), somax_price: 25finds the $21.52 offer. - The bid can be set higher than
min_bid, up tomax_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
- gpuhunt: don't send
dph_totalbounds when spot items can be returned (q.spotisNoneorTrue), and dropdph_totalfrom the localsatisfies_filters()check.Catalog._get_online_provider_items()already re-filters every item withconstraints.matches()againstitem.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_pricebound would be a superset for both variants, if Vast acceptsmin_bidas a search filter and still returns machines that have nomin_bid.
- 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_priceis a sensible default depends on whether Vast bills interruptible instances at the bid or at the market rate.
- Default
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
r4victor commentedon Nov 24, 2026
@mempirate, agreed on the fix for filtering here. When
max_priceis set, we need separate Vast search requests:dph_total <= max_pricefor on-demand offers andmin_bid <= max_pricefor spot offers. A single bound doesn't work for both: withdph_total, cheap spot offers on machines with expensive on-demand are dropped (this issue); withmin_bid, and machines affordable only as spot can crowd out the ones affordable on-demand. Vast's search has no OR. Withspot_policy: auto, that's two requests, each keeping only its own variant. Passingallocated_storageset to the requested disk size makesdph_totalinclude the actual storage cost (it prices only 8 GB by default).I'd keep bidding
min_bidas we do now. Vast bills interruptible instances at the bid, not at the market rate. Bidding up tomax_pricewould 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.