Skip to content

👻 Smart Proxy Group

The Smart proxy group type uses adaptive weight-based node selection. Instead of simple round-robin or manual ordering, it continuously tracks each node’s real-world performance — latency, connection success rate, traffic volume — and automatically routes connections to the best available node.


The smart group type comes from vernesong/mihomo. The group picks a node by weights computed from how the nodes actually perform: latency, connection success rate and traffic. Weight prediction by a LightGBM model can be enabled.

Since v1.19.33 the group also learns where each node leads and which sites refuse it:

  • Node exit. The group finds out the country and network (ASN) where a node’s traffic comes out. To do that it sends a request through the node to cloudflare.com/cdn-cgi/trace, api.ip.sb or ipwho.is, the next one if the previous does not answer.
  • Site responses. If a site refuses a node (blocked for its region, an error page, 403, a connection without any answer), the group remembers it and sends this site through other nodes.
  • No hasty verdicts. A region or a network is marked as refused only after several independent nodes from it fail. One refusal decides nothing, and a node that answers again clears the record.

# Optional: global LightGBM settings (top-level in config)
lgbm-auto-update: true
lgbm-update-interval: 72
lgbm-url: "https://github.com/vernesong/mihomo/releases/download/LightGBM-Model/Model.bin"
proxy-groups:
- name: Smart Group
type: smart
proxies:
- Proxy A
- Proxy B
- Proxy C
policy-priority: "Premium:0.9;SG:1.3"
uselightgbm: false
collectdata: false
sample-rate: 1
prefer-asn: true
tolerance: 50

ParameterTypeDefaultDescription
typestring—Must be smart
policy-prioritystring""Priority multipliers by node name, see policy-priority
uselightgbmboolfalseEnable ML-based weight prediction via LightGBM
collectdataboolfalseCollect training data to CSV for custom model training
sample-ratefloat1Share of connections recorded by collectdata, in (0, 1]. Values outside this range (including 0) mean 1, i.e. 100%
prefer-asnboolfalsePrioritise ASN lookup during node selection
toleranceint0Latency difference in ms within which nodes count as equal when the group falls back to latency order; see tolerance

These keys sit at the top level of the config; they are also described on the General page.

ParameterTypeDefaultDescription
lgbm-auto-updateboolfalseAutomatically refresh the LightGBM model
lgbm-update-intervalint72Model refresh interval in hours
lgbm-urlstringthe vernesong LightGBM-Model/Model.bin releaseURL to download the Model.bin file from

See also smart-collector-size on the General page.

ParameterTypeDefaultDescription
profile.smart-collector-sizefloat100Max size of smart_weight_data.csv in MB. It is a key of the top-level profile block, not of the group: in a group it is ignored

Adjusts the selection weight of nodes whose names match a regex pattern. Values below 1 lower priority; values above 1 raise it.

policy-priority: "Premium:0.9;SG:1.3"

In this example, nodes matching Premium have their weight multiplied by 0.9 (lower priority), while nodes matching SG get a 1.3 multiplier (higher priority). Multiple rules are separated by ;. A pattern is tried as a regex first; a pattern that does not compile as a regex is matched as a plain substring. The first matching rule wins. A colon inside a pattern is escaped as \: (the last unescaped colon separates the pattern from the multiplier).


Latency tolerance in milliseconds, from 0 to 65535. Not set or 0 means no tolerance.

The group normally picks nodes by the weights it has learned for a site. When it has too few such nodes, for example for a site it has not seen yet, it adds the remaining nodes in order of their latency from the health check (url / interval of the group). tolerance affects only this order:

  • nodes whose latency differs by no more than tolerance count as equal and keep their order from the proxies list;
  • without it, nodes are sorted strictly by latency, so two nodes with 41 and 43 ms can swap places after every check.

policy-priority is applied first: a node with a higher priority stays ahead regardless of tolerance. Nodes the group suspects of being blocked for the site always go last.

# strictly by latency (default)
tolerance: 0
# nodes within 50 ms of each other are equal, the order in proxies decides
tolerance: 50
# a larger margin: the first nodes of the list are kept unless they are much slower
tolerance: 150

The group continuously scores each node using five factors:

  • Connection success rate — successful vs. failed attempts; recent failures carry more weight.
  • Connection performance — connection establishment time and round-trip latency.
  • Usage statistics — upload/download volume and session duration.
  • Time decay — weights decay for nodes that haven’t been used recently.
  • Connection type — separate scoring tracks for UDP and TCP connections.

All metrics are normalised into a base weight, then adjusted by policy-priority rules and ASN-specific tables. Weights are updated using weighted averaging.

Selection follows this priority order:

  1. Domain-based history — if the destination domain has been seen before, the node with the best historical performance for that domain is preferred.
  2. ASN-based history — if no domain history exists, the node’s past performance for the destination’s Autonomous System is used.
  3. Pre-calculated cache — hot domains are pre-scored in memory (LRU) and on disk for fast lookup.
  4. Round-robin fallback — used when historical data is insufficient; random exploration prevents local optima.

Historical data is retained for 7 days. Expired entries are pruned automatically.

When a node exceeds its failure threshold, its weight is penalised. A node the group suspects of being blocked for a site is set aside for that site for a limited time — 5 minutes for a transient failure, 10 minutes by default, up to 30 minutes for a regional block — and then tried again, so a temporary outage does not blacklist a node for good.


When uselightgbm: true, the group uses a pre-trained LightGBM model to predict node weights instead of the rule-based system.

Model file location:

  • Model.bin in the core’s working directory (the -d folder; the name is matched case-insensitively)

Enable collectdata: true to write connection metrics to smart_weight_data.csv in the core’s working directory.

Use sample-rate to reduce collection overhead — e.g. sample-rate: 0.1 records 10% of connections.

The collected CSV can be used to train a custom model with LightGBM 3.3.5.