Release RouteFM 1.0 model artifacts
Browse files- LICENSE +201 -0
- NOTICE +4 -0
- README.md +120 -0
- THIRD_PARTY_NOTICES.md +19 -0
- bge/config.json +41 -0
- bge/model.safetensors +3 -0
- legacy/routefm_bge.pt +3 -0
- legacy/routefm_qwen.pt +3 -0
- manifest.json +29 -0
- qwen/config.json +69 -0
- qwen/model.safetensors +3 -0
LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
NOTICE
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
RouteFM
|
| 2 |
+
Copyright 2026 RouteFM contributors
|
| 3 |
+
|
| 4 |
+
This product is licensed under the Apache License, Version 2.0.
|
README.md
CHANGED
|
@@ -1,3 +1,123 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
library_name: routefm
|
| 4 |
+
tags:
|
| 5 |
+
- model-routing
|
| 6 |
+
- llm-routing
|
| 7 |
+
- multimodal-routing
|
| 8 |
+
- pytorch
|
| 9 |
+
- safetensors
|
| 10 |
---
|
| 11 |
+
|
| 12 |
+
# RouteFM 1.0
|
| 13 |
+
|
| 14 |
+
RouteFM is a pretrained in-context model router. Given a pool of candidate
|
| 15 |
+
models, observations of their quality and cost on earlier Context queries, and
|
| 16 |
+
the embedding of a new Target query, RouteFM predicts each candidate's quality
|
| 17 |
+
and relative cost. The default decision rule selects the highest predicted
|
| 18 |
+
quality.
|
| 19 |
+
|
| 20 |
+
This repository is the canonical distribution point for the frozen RouteFM
|
| 21 |
+
1.0 weights. Source code, data schemas, training configurations, benchmark
|
| 22 |
+
splits, and evaluation scripts are maintained at
|
| 23 |
+
[LAMDA-Model-Reuse/RouteFM](https://github.com/LAMDA-Model-Reuse/RouteFM).
|
| 24 |
+
|
| 25 |
+
## Released variants
|
| 26 |
+
|
| 27 |
+
| Variant | Compatible query encoder | Dimension | Query modality | Parameters |
|
| 28 |
+
| --- | --- | ---: | --- | ---: |
|
| 29 |
+
| Qwen RouteFM | Qwen3-VL-Embedding-8B | 4096 | Joint text and image | 12,781,059 |
|
| 30 |
+
| BGE RouteFM | BAAI/bge-base-en-v1.5, CLS pooling | 768 | Text | 11,070,467 |
|
| 31 |
+
|
| 32 |
+
The query encoders are frozen external feature extractors. They are not
|
| 33 |
+
included here, and RouteFM is not a fine-tune of either encoder. Users must
|
| 34 |
+
obtain the encoders or a compatible embedding service separately and follow
|
| 35 |
+
their licenses and access terms.
|
| 36 |
+
|
| 37 |
+
## Files and integrity
|
| 38 |
+
|
| 39 |
+
Each variant contains a canonical `model.safetensors` and `config.json`.
|
| 40 |
+
`legacy/` contains the exact PyTorch checkpoint bytes distributed in the
|
| 41 |
+
GitHub v1.0.0 release. `manifest.json` records sizes and SHA-256 digests for
|
| 42 |
+
all artifacts. The safetensors files contain the same model tensors as their
|
| 43 |
+
legacy checkpoints; optimizer state is not distributed.
|
| 44 |
+
|
| 45 |
+
The RouteFM package downloads the safetensors artifact from an immutable Hub
|
| 46 |
+
revision, validates its SHA-256 digest, and caches it through
|
| 47 |
+
`huggingface_hub`:
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
python -m pip install git+https://github.com/LAMDA-Model-Reuse/RouteFM.git
|
| 51 |
+
|
| 52 |
+
routefm-predict --encoder qwen --input my_episode.npz \
|
| 53 |
+
--output predictions.json --device cpu
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
The complete custom-data schema and embedding instructions are documented in
|
| 57 |
+
[`docs/CUSTOM_DATA.md`](https://github.com/LAMDA-Model-Reuse/RouteFM/blob/v1.0.0/docs/CUSTOM_DATA.md).
|
| 58 |
+
|
| 59 |
+
## Training
|
| 60 |
+
|
| 61 |
+
Both variants were trained from random initialization in one continuous
|
| 62 |
+
10,000-update run. All router modules were trained jointly. The external query
|
| 63 |
+
encoders were frozen. The configured pretraining mixture is LLMRouterBench
|
| 64 |
+
45%, RouterBench 25%, RouterEval 25%, and MixInstruct 5%.
|
| 65 |
+
|
| 66 |
+
The exact configurations and preprocessing contract are available in
|
| 67 |
+
[`docs/PRETRAINING.md`](https://github.com/LAMDA-Model-Reuse/RouteFM/blob/v1.0.0/docs/PRETRAINING.md).
|
| 68 |
+
The underlying third-party datasets and embedding models are not
|
| 69 |
+
redistributed by this repository.
|
| 70 |
+
|
| 71 |
+
## MMR-Bench V1 evaluation
|
| 72 |
+
|
| 73 |
+
The following results use 6,223 Target queries and the published seed-31010
|
| 74 |
+
within-dataset 40% Context / 60% Target split. Quality is target-count weighted
|
| 75 |
+
across benchmark datasets.
|
| 76 |
+
|
| 77 |
+
| Context protocol | Qwen RouteFM | BGE RouteFM | Context-mean baseline |
|
| 78 |
+
| --- | ---: | ---: | ---: |
|
| 79 |
+
| K=8 | 0.7463 | 0.7413 | 0.7156 |
|
| 80 |
+
| K=16 | 0.7527 | 0.7422 | 0.7458 |
|
| 81 |
+
| K=32 | 0.7546 | 0.7469 | 0.7496 |
|
| 82 |
+
| K=64 | 0.7585 | 0.7487 | 0.7482 |
|
| 83 |
+
| Complete 40% Context pool | 0.7614 | 0.7492 | 0.7577 |
|
| 84 |
+
|
| 85 |
+
These results are retrospective. MMR-Bench was inspected during the broader
|
| 86 |
+
research process, and seed 31010 was selected after a ten-seed split
|
| 87 |
+
sensitivity sweep. They must be described as a post-selected illustrative
|
| 88 |
+
split, not an unbiased multi-seed estimate or untouched holdout. No MMR-Bench
|
| 89 |
+
score or cost cell enters the included pretraining recipe. The complete
|
| 90 |
+
protocol and exact IDs are in
|
| 91 |
+
[`docs/MMRBENCH_V1.md`](https://github.com/LAMDA-Model-Reuse/RouteFM/blob/v1.0.0/docs/MMRBENCH_V1.md).
|
| 92 |
+
|
| 93 |
+
## Intended use and limitations
|
| 94 |
+
|
| 95 |
+
RouteFM is intended for research on routing among a user-supplied candidate
|
| 96 |
+
pool with observed Context outcomes. It does not call candidate models,
|
| 97 |
+
generate query embeddings, or establish that a candidate is safe or suitable.
|
| 98 |
+
|
| 99 |
+
- Candidate order and embedding family must remain consistent within an episode.
|
| 100 |
+
- Each candidate needs at least one valid Context observation.
|
| 101 |
+
- Predicted cost is relative and is not a calibrated monetary or latency estimate.
|
| 102 |
+
- The default decision rule ignores predicted cost and chooses maximum predicted quality.
|
| 103 |
+
- Performance may change with encoder revisions, embedding services, domains,
|
| 104 |
+
languages, candidate pools, and Context sizes not represented during training.
|
| 105 |
+
- This release does not include a mixture-of-experts router.
|
| 106 |
+
|
| 107 |
+
## License and citation
|
| 108 |
+
|
| 109 |
+
RouteFM source code and released routing weights are licensed under Apache-2.0.
|
| 110 |
+
Third-party assets retain their own licenses and terms. See
|
| 111 |
+
[`THIRD_PARTY_NOTICES.md`](https://github.com/LAMDA-Model-Reuse/RouteFM/blob/v1.0.0/THIRD_PARTY_NOTICES.md).
|
| 112 |
+
|
| 113 |
+
Until a paper citation is published, cite the versioned software artifact:
|
| 114 |
+
|
| 115 |
+
```bibtex
|
| 116 |
+
@software{routefm2026,
|
| 117 |
+
title = {RouteFM: Pretrained In-Context Model Routing},
|
| 118 |
+
author = {{RouteFM Contributors}},
|
| 119 |
+
year = {2026},
|
| 120 |
+
url = {https://github.com/LAMDA-Model-Reuse/RouteFM},
|
| 121 |
+
version = {1.0.0}
|
| 122 |
+
}
|
| 123 |
+
```
|
THIRD_PARTY_NOTICES.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Third-Party Notices
|
| 2 |
+
|
| 3 |
+
RouteFM is distributed under the Apache License, Version 2.0. This license
|
| 4 |
+
applies to the RouteFM source code and the RouteFM routing weights included in
|
| 5 |
+
this repository. It does not replace or modify the licenses, terms of use, or
|
| 6 |
+
access requirements of third-party assets.
|
| 7 |
+
|
| 8 |
+
The repository supports or documents interoperability with the following
|
| 9 |
+
external assets, which are not redistributed here:
|
| 10 |
+
|
| 11 |
+
- Qwen3-VL-Embedding-8B and compatible embedding services;
|
| 12 |
+
- BAAI/bge-base-en-v1.5;
|
| 13 |
+
- MMR-Bench V1, including its records and images;
|
| 14 |
+
- LLMRouterBench, RouterBench, RouterEval, and MixInstruct pretraining data;
|
| 15 |
+
- Python dependencies declared in `pyproject.toml`.
|
| 16 |
+
|
| 17 |
+
Users must obtain these assets from their respective providers and comply with
|
| 18 |
+
the providers' applicable licenses and terms. Names and trademarks are used
|
| 19 |
+
only to identify compatible models, datasets, benchmarks, and software.
|
bge/config.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"encoder": "bge",
|
| 3 |
+
"format": "routefm_safetensors",
|
| 4 |
+
"model_config": {
|
| 5 |
+
"architecture": "profile_context",
|
| 6 |
+
"auxiliary_distribution_head": false,
|
| 7 |
+
"auxiliary_extended_observation_encoder": false,
|
| 8 |
+
"capability_tokens": 24,
|
| 9 |
+
"context_scale_conditioning": false,
|
| 10 |
+
"dropout": 0.1,
|
| 11 |
+
"ffn_dim": 1024,
|
| 12 |
+
"heads": 8,
|
| 13 |
+
"hidden_dim": 256,
|
| 14 |
+
"local_context_gate_hidden": 64,
|
| 15 |
+
"local_context_gate_init": 0.25,
|
| 16 |
+
"local_context_layers": 2,
|
| 17 |
+
"local_context_mode": "parallel_static",
|
| 18 |
+
"local_context_residual_init": 0.1,
|
| 19 |
+
"local_context_semantic_bias": 0.0,
|
| 20 |
+
"local_context_topk": 0,
|
| 21 |
+
"observation_features": 2,
|
| 22 |
+
"observation_schema": "score_cost",
|
| 23 |
+
"outcome_residual_init": 3.0,
|
| 24 |
+
"pool_layers": 3,
|
| 25 |
+
"profile_layers": 4,
|
| 26 |
+
"projection_dim": 512,
|
| 27 |
+
"quality_bins": 21,
|
| 28 |
+
"query_dim": 768,
|
| 29 |
+
"readout_layers": 2,
|
| 30 |
+
"target_query_scale": 1.0,
|
| 31 |
+
"use_pool_transformer": true,
|
| 32 |
+
"utility_cost_weight": 0.0,
|
| 33 |
+
"utility_uncertainty_weight": 0.0
|
| 34 |
+
},
|
| 35 |
+
"model_version": "1.0.0",
|
| 36 |
+
"parameter_count": 11070467,
|
| 37 |
+
"release_version": "RouteFM 1.0",
|
| 38 |
+
"source_checkpoint": "legacy/routefm_bge.pt",
|
| 39 |
+
"source_checkpoint_sha256": "0f7ce1b269499a6938a5722511a489eb1a701e17dfd2605f49d47a19edeffcde",
|
| 40 |
+
"step": 10000
|
| 41 |
+
}
|
bge/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3245698f2f6bd4cb607cc3af8875d63ba04172f33abd25b286d1b2968c679662
|
| 3 |
+
size 44302700
|
legacy/routefm_bge.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0f7ce1b269499a6938a5722511a489eb1a701e17dfd2605f49d47a19edeffcde
|
| 3 |
+
size 44355866
|
legacy/routefm_qwen.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e28d6203e99cf5f10f42293c561b80d17e866bc7bd69a696928ea836e6b7cccc
|
| 3 |
+
size 51199466
|
manifest.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"artifacts": {
|
| 3 |
+
"bge": {
|
| 4 |
+
"config": "bge/config.json",
|
| 5 |
+
"config_sha256": "6cdc9e9d5ccad4ed9e2543e26ea5adf7def5830189a25e3349ae183c5e7535ea",
|
| 6 |
+
"legacy_checkpoint": "legacy/routefm_bge.pt",
|
| 7 |
+
"legacy_checkpoint_sha256": "0f7ce1b269499a6938a5722511a489eb1a701e17dfd2605f49d47a19edeffcde",
|
| 8 |
+
"legacy_checkpoint_size_bytes": 44355866,
|
| 9 |
+
"weights": "bge/model.safetensors",
|
| 10 |
+
"weights_sha256": "3245698f2f6bd4cb607cc3af8875d63ba04172f33abd25b286d1b2968c679662",
|
| 11 |
+
"weights_size_bytes": 44302700
|
| 12 |
+
},
|
| 13 |
+
"qwen": {
|
| 14 |
+
"config": "qwen/config.json",
|
| 15 |
+
"config_sha256": "0a0f63b954fa3e4472fdd8c51abff33bbc6a12bf0ea267eab0a4604ebcaf6231",
|
| 16 |
+
"legacy_checkpoint": "legacy/routefm_qwen.pt",
|
| 17 |
+
"legacy_checkpoint_sha256": "e28d6203e99cf5f10f42293c561b80d17e866bc7bd69a696928ea836e6b7cccc",
|
| 18 |
+
"legacy_checkpoint_size_bytes": 51199466,
|
| 19 |
+
"weights": "qwen/model.safetensors",
|
| 20 |
+
"weights_sha256": "881b648ead20565da38a7f6ee9516dd0a45d3747add41c44d300ac24433b9cb8",
|
| 21 |
+
"weights_size_bytes": 51145068
|
| 22 |
+
}
|
| 23 |
+
},
|
| 24 |
+
"code_repository": "https://github.com/LAMDA-Model-Reuse/RouteFM",
|
| 25 |
+
"license": "Apache-2.0",
|
| 26 |
+
"model_version": "1.0.0",
|
| 27 |
+
"name": "RouteFM",
|
| 28 |
+
"source_code_revision": "v1.0.0"
|
| 29 |
+
}
|
qwen/config.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"encoder": "qwen",
|
| 3 |
+
"format": "routefm_safetensors",
|
| 4 |
+
"model_config": {
|
| 5 |
+
"architecture": "profile_context",
|
| 6 |
+
"auxiliary_distribution_head": false,
|
| 7 |
+
"auxiliary_extended_observation_encoder": false,
|
| 8 |
+
"bilinear_scale": 1.0,
|
| 9 |
+
"capability_tokens": 24,
|
| 10 |
+
"conditional_residual_init": 0.25,
|
| 11 |
+
"conditional_residual_max": 0.5,
|
| 12 |
+
"context_refinement_rounds": 0,
|
| 13 |
+
"context_refinement_shared": false,
|
| 14 |
+
"context_scale_conditioning": false,
|
| 15 |
+
"context_scale_max": 1024,
|
| 16 |
+
"context_scale_residual_init": 0.1,
|
| 17 |
+
"dropout": 0.1,
|
| 18 |
+
"ensemble_adapter_dim": 64,
|
| 19 |
+
"ensemble_branch_mode": "late_residual",
|
| 20 |
+
"ensemble_context_policies": [],
|
| 21 |
+
"ensemble_gate_hidden": 32,
|
| 22 |
+
"ensemble_gate_mode": "none",
|
| 23 |
+
"ensemble_member_weights": [],
|
| 24 |
+
"ensemble_members": 1,
|
| 25 |
+
"ensemble_residual_init": 0.001,
|
| 26 |
+
"ensemble_semantic_topk": 16,
|
| 27 |
+
"ffn_dim": 1024,
|
| 28 |
+
"grid_layers": 2,
|
| 29 |
+
"grid_residual_init": 0.1,
|
| 30 |
+
"heads": 8,
|
| 31 |
+
"hidden_dim": 256,
|
| 32 |
+
"kernel_scale": 4.0,
|
| 33 |
+
"kernel_temperature": 0.1,
|
| 34 |
+
"local_context_gate_hidden": 64,
|
| 35 |
+
"local_context_gate_init": 0.25,
|
| 36 |
+
"local_context_layers": 2,
|
| 37 |
+
"local_context_mode": "parallel_static",
|
| 38 |
+
"local_context_residual_init": 0.1,
|
| 39 |
+
"local_context_semantic_bias": 0.0,
|
| 40 |
+
"local_context_topk": 0,
|
| 41 |
+
"observation_features": 2,
|
| 42 |
+
"observation_schema": "score_cost",
|
| 43 |
+
"outcome_residual_init": 3.0,
|
| 44 |
+
"pool_layers": 3,
|
| 45 |
+
"profile_layers": 4,
|
| 46 |
+
"projection_dim": 512,
|
| 47 |
+
"quality_bins": 21,
|
| 48 |
+
"query_dim": 4096,
|
| 49 |
+
"readout_layers": 2,
|
| 50 |
+
"ridge_feature_dim": 16,
|
| 51 |
+
"ridge_lambda": 1.0,
|
| 52 |
+
"similarity_adapter_hidden": 32,
|
| 53 |
+
"similarity_logit_scale": 0.75,
|
| 54 |
+
"similarity_sigma": 0.12,
|
| 55 |
+
"similarity_temperature": 0.1,
|
| 56 |
+
"target_profile_feedback_residual_init": 0.1,
|
| 57 |
+
"target_profile_feedback_rounds": 0,
|
| 58 |
+
"target_query_scale": 1.0,
|
| 59 |
+
"use_pool_transformer": true,
|
| 60 |
+
"utility_cost_weight": 0.0,
|
| 61 |
+
"utility_uncertainty_weight": 0.0
|
| 62 |
+
},
|
| 63 |
+
"model_version": "1.0.0",
|
| 64 |
+
"parameter_count": 12781059,
|
| 65 |
+
"release_version": "RouteFM 1.0",
|
| 66 |
+
"source_checkpoint": "legacy/routefm_qwen.pt",
|
| 67 |
+
"source_checkpoint_sha256": "e28d6203e99cf5f10f42293c561b80d17e866bc7bd69a696928ea836e6b7cccc",
|
| 68 |
+
"step": 10000
|
| 69 |
+
}
|
qwen/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:881b648ead20565da38a7f6ee9516dd0a45d3747add41c44d300ac24433b9cb8
|
| 3 |
+
size 51145068
|