Upload folder using huggingface_hub
Browse files- .gitattributes +10 -0
- Arch-Router-1.5B-Q2_K.gguf +3 -0
- Arch-Router-1.5B-Q3_K_L.gguf +3 -0
- Arch-Router-1.5B-Q3_K_M.gguf +3 -0
- Arch-Router-1.5B-Q3_K_S.gguf +3 -0
- Arch-Router-1.5B-Q4_K_M.gguf +3 -0
- Arch-Router-1.5B-Q4_K_S.gguf +3 -0
- Arch-Router-1.5B-Q5_K_M.gguf +3 -0
- Arch-Router-1.5B-Q5_K_S.gguf +3 -0
- Arch-Router-1.5B.gguf +3 -0
- Arch-Router-Q6_K.gguf +3 -0
- LICENSE +77 -0
- README.md +165 -0
.gitattributes
CHANGED
@@ -33,3 +33,13 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
Arch-Router-1.5B-Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
|
37 |
+
Arch-Router-1.5B-Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
|
38 |
+
Arch-Router-1.5B-Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
39 |
+
Arch-Router-1.5B-Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
40 |
+
Arch-Router-1.5B-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
41 |
+
Arch-Router-1.5B-Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
42 |
+
Arch-Router-1.5B-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
43 |
+
Arch-Router-1.5B-Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
44 |
+
Arch-Router-1.5B.gguf filter=lfs diff=lfs merge=lfs -text
|
45 |
+
Arch-Router-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
|
Arch-Router-1.5B-Q2_K.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cd68f063804bc3a18cfbc6af2e46686c98ae96cbcbae3d861149f0676a40bbf6
|
3 |
+
size 676304320
|
Arch-Router-1.5B-Q3_K_L.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:07cd34508d7b91660b291f2feb76edba02a99c2f74204326fa0e3ddcb6b9cf1f
|
3 |
+
size 880162240
|
Arch-Router-1.5B-Q3_K_M.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8870132d79e824dd2039edf4fcd145243b1af4ba72cc6b856930d45c6f5289d6
|
3 |
+
size 824178112
|
Arch-Router-1.5B-Q3_K_S.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9cd467cf2de36d0c8cd35b91e9a8a8ce5bfb8678125c274ef233e706d52ee083
|
3 |
+
size 760944064
|
Arch-Router-1.5B-Q4_K_M.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b55666691f14089cf4422b443431e2b783033d99dce6c7df147565192b4deb76
|
3 |
+
size 986047936
|
Arch-Router-1.5B-Q4_K_S.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a135240351dfeb50555a6e779b25d1d1e9917ecd8ee499ca94457d24eadce13b
|
3 |
+
size 940312000
|
Arch-Router-1.5B-Q5_K_M.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:866fd984ec7a4e59449f34f7d2fbf160875281733b0c7d313213de9b95f43245
|
3 |
+
size 1125049792
|
Arch-Router-1.5B-Q5_K_S.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6fb3f313139f00b54deb2823d99de8cb4809357b4a81fc367d56ee171e607798
|
3 |
+
size 1098728896
|
Arch-Router-1.5B.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ece850eba74acbf864baddccfd78278ae2178c8460e15c3b60dbf1ac73dbeee8
|
3 |
+
size 3093668800
|
Arch-Router-Q6_K.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:29c06d7ade24db29c11996f15bbc6333e401b8ddad8669d310846c1b2267aff1
|
3 |
+
size 1272739264
|
LICENSE
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Katanemo Labs, Inc. COMMUNITY LICENSE AGREEMENT
|
2 |
+
**Version Release Date:** September 30th, 2024
|
3 |
+
|
4 |
+
This Katanemo Labs, Inc. COMMUNITY LICENSE AGREEMENT is based on the Llama 3.2 Community License, Copyright © Meta Platforms, Inc. The terms and conditions have been adapted to reflect the proprietary nature of Katanemo Labs' materials.
|
5 |
+
|
6 |
+
---
|
7 |
+
|
8 |
+
1.Definitions
|
9 |
+
a. "Agreement": The terms and conditions for use, reproduction, distribution, and modification of the Katanemo Materials set forth herein.
|
10 |
+
b. "Documentation": The specifications, manuals, and documentation accompanying Katanemo LLMs v1.
|
11 |
+
c. "Licensee" or "you: The individual or entity entering into this Agreement, including your employer if you are acting on their behalf.
|
12 |
+
d. "Katanemo": The foundational large language models and software provided by Katanemo Labs, Inc., available at https://huggingface.co/katanemolabs.
|
13 |
+
e. "Katanemo Materials": Collectively, Katanemo's proprietary models and Documentation. Some Materials are derived from the Qwen language models licensed under the Qwen RESEARCH LICENSE AGREEMENT.
|
14 |
+
f. "Katanemo Labs" or "we": Katanemo Labs Inc., a Delaware, USA Corporation.
|
15 |
+
|
16 |
+
---
|
17 |
+
|
18 |
+
2.
|
19 |
+
By clicking "I Accept" or using any part of the Katanemo Materials, you agree to be bound by this Agreement.
|
20 |
+
|
21 |
+
---
|
22 |
+
|
23 |
+
3. License Rights and Redistribution
|
24 |
+
a. Grant of Rights
|
25 |
+
You are granted a non-exclusive, worldwide, non-transferable, and royalty-free license to:
|
26 |
+
- Use, reproduce, distribute, and modify the Katanemo Materials.
|
27 |
+
- Create derivative works based on the Katanemo Materials.
|
28 |
+
|
29 |
+
4. Redistribution and Use
|
30 |
+
a. Distribution:
|
31 |
+
If you distribute the Katanemo Materials or a derivative work:
|
32 |
+
- Include a copy of this Agreement.
|
33 |
+
- Prominently display "Built with Katanemo" on a related website or documentation.
|
34 |
+
|
35 |
+
b. Attribution:
|
36 |
+
Include the following attribution notice:
|
37 |
+
"Katanemo is licensed under the Katanemo Labs Community License, Copyright © Katanemo Labs, Inc. All Rights Reserved."_
|
38 |
+
|
39 |
+
c. Compliance:
|
40 |
+
Your use must adhere to the Acceptable Use Policy, available at https://katanemolabs.com/katanemo/use-policy.
|
41 |
+
|
42 |
+
---
|
43 |
+
|
44 |
+
5. Additional Commercial Terms
|
45 |
+
If you are commercially using the Materials, you shall request a license from us.
|
46 |
+
|
47 |
+
---
|
48 |
+
|
49 |
+
6. Disclaimer of Warranty
|
50 |
+
The Katanemo Materials are provided "AS IS" without warranties of any kind, either express or implied, including but not limited to warranties of title, non-infringement, or fitness for a particular purpose.
|
51 |
+
|
52 |
+
---
|
53 |
+
|
54 |
+
7. Limitation of Liability
|
55 |
+
Katanemo Labs is not liable for any indirect, special, or consequential damages arising out of the use of the Katanemo Materials, even if advised of the possibility of such damages.
|
56 |
+
|
57 |
+
---
|
58 |
+
|
59 |
+
8. Intellectual Property
|
60 |
+
a. Trademarks
|
61 |
+
No trademark licenses are granted, except as required for attribution as described in Section 1.b. You may use the “Katanemo” mark according to Katanemo Labs' brand guidelines.
|
62 |
+
|
63 |
+
b. Ownership
|
64 |
+
You own any derivative works or modifications you create, except for portions owned by Katanemo Labs.
|
65 |
+
|
66 |
+
c. Litigation
|
67 |
+
If you file a lawsuit against Katanemo Labs regarding intellectual property, your license under this Agreement terminates.
|
68 |
+
|
69 |
+
---
|
70 |
+
|
71 |
+
9. Term and Termination
|
72 |
+
This Agreement continues until terminated. Katanemo Labs may terminate the Agreement if you breach any terms. Upon termination, you must cease using the Katanemo Materials.
|
73 |
+
|
74 |
+
---
|
75 |
+
|
76 |
+
10. Governing Law and Jurisdiction
|
77 |
+
This Agreement is governed by the laws of the State of Washington, USA. Any disputes will be resolved in the courts of California.
|
README.md
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
license_name: katanemo-research
|
4 |
+
license_link: >-
|
5 |
+
https://huggingface.co/katanemo/Arch-Router-1.5B.gguf/blob/main/LICENSE
|
6 |
+
base_model:
|
7 |
+
- Qwen/Qwen2.5-1.5B-Instruct
|
8 |
+
language:
|
9 |
+
- en
|
10 |
+
pipeline_tag: text-generation
|
11 |
+
library_name: transformers
|
12 |
+
---
|
13 |
+
|
14 |
+
# katanemo/Arch-Router-1.5B
|
15 |
+
|
16 |
+
## Overview
|
17 |
+
Arch-Router is a **preference-based routing model** designed to intelligently select the most appropriate large language model (LLM) for a given prompt by leveraging a structured **domain–action taxonomy**. This framework enables fine-grained control over model selection by aligning user-defined preferences with model capabilities across a wide range of tasks and subject areas.
|
18 |
+
|
19 |
+
### How It Works
|
20 |
+
|
21 |
+
To support effective routing, Arch-Router introduces two key concepts:
|
22 |
+
- **Domain** – the high-level thematic category or subject matter of a request (e.g., legal, healthcare, programming).
|
23 |
+
- **Action** – the specific type of operation the user wants performed (e.g., summarization, code generation, booking appointment, translation).
|
24 |
+
|
25 |
+
Both domain and action configs are associated with preferred models or model variants. At inference time, Arch-Router analyzes the incoming prompt to infer its domain and action using semantic similarity, task indicators, and contextual cues. It then applies the user-defined routing preferences to select the model best suited to handle the request.
|
26 |
+
|
27 |
+
### Key Features
|
28 |
+
|
29 |
+
- **Structured Preference Routing**: Aligns prompt request with model strengths using explicit domain–action mappings.
|
30 |
+
- **Transparent and Controllable**: Makes routing decisions transparent and configurable, empowering users to customize system behavior.
|
31 |
+
- **Flexible and Adaptive**: Supports evolving user needs, model updates, and new domains/actions without retraining the router.
|
32 |
+
- **Production-Ready Performance**: Optimized for low-latency, high-throughput applications in multi-model environments.
|
33 |
+
|
34 |
+
|
35 |
+
Arch-Router powers the open-source [Arch Gateway](https://github.com/katanemo/arch), enabling seamless, preference-based prompt routing in multi-LLM systems.
|
36 |
+
|
37 |
+
|
38 |
+
# Requirements
|
39 |
+
The code of Arch-Router-1.5B has been in the Hugging Face `transformers` library and we advise you to install latest version:
|
40 |
+
```bash
|
41 |
+
pip install transformers>=4.37.0
|
42 |
+
```
|
43 |
+
|
44 |
+
|
45 |
+
# How to use
|
46 |
+
We use the following example to illustrate how to use our model to perform routing tasks. Please note that, our model works best with our provided prompt format.
|
47 |
+
### Quickstart
|
48 |
+
````python
|
49 |
+
import json
|
50 |
+
from typing import Any, Dict, List
|
51 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
52 |
+
|
53 |
+
model_name = "katanemo/Arch-Router-1.5B"
|
54 |
+
model = AutoModelForCausalLM.from_pretrained(
|
55 |
+
model_name, device_map="auto", torch_dtype="auto", trust_remote_code=True
|
56 |
+
)
|
57 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
58 |
+
|
59 |
+
# Please use our provided prompt for best performance
|
60 |
+
TASK_INSTRUCTION = """
|
61 |
+
You are a helpful assistant designed to find the best suited route.
|
62 |
+
You are provided with route description within <routes></routes> XML tags:
|
63 |
+
<routes>
|
64 |
+
\n{routes}\n
|
65 |
+
</routes>
|
66 |
+
|
67 |
+
<conversation>
|
68 |
+
\n{conversation}\n
|
69 |
+
</conversation>
|
70 |
+
"""
|
71 |
+
|
72 |
+
FORMAT_PROMPT = """
|
73 |
+
Your task is to decide which route is best suit with user intent on the conversation in <conversation></conversation> XML tags. Follow the instruction:
|
74 |
+
1. If the latest intent from user is irrelevant or user intent is full filled, response with other route {"route": "other"}.
|
75 |
+
2. You must analyze the route descriptions and find the best match route for user latest intent.
|
76 |
+
3. You only response the name of the route that best matches the user's request, use the exact name in the <routes></routes>.
|
77 |
+
|
78 |
+
Based on your analysis, provide your response in the following JSON formats if you decide to match any route:
|
79 |
+
{"route": "route_name"}
|
80 |
+
"""
|
81 |
+
|
82 |
+
|
83 |
+
# Define route config
|
84 |
+
route_config = [
|
85 |
+
{
|
86 |
+
"name": "code_generation",
|
87 |
+
"description": "Generating new code snippets, functions, or boilerplate based on user prompts or requirements",
|
88 |
+
},
|
89 |
+
{
|
90 |
+
"name": "bug_fixing",
|
91 |
+
"description": "Identifying and fixing errors or bugs in the provided code across different programming languages",
|
92 |
+
},
|
93 |
+
{
|
94 |
+
"name": "performance_optimization",
|
95 |
+
"description": "Suggesting improvements to make code more efficient, readable, or scalable",
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"name": "api_help",
|
99 |
+
"description": "Assisting with understanding or integrating external APIs and libraries",
|
100 |
+
},
|
101 |
+
{
|
102 |
+
"name": "programming",
|
103 |
+
"description": "Answering general programming questions, theory, or best practices",
|
104 |
+
},
|
105 |
+
]
|
106 |
+
|
107 |
+
|
108 |
+
# Helper function to create the system prompt for our model
|
109 |
+
def format_prompt(
|
110 |
+
route_config: List[Dict[str, Any]], conversation: List[Dict[str, Any]]
|
111 |
+
):
|
112 |
+
return (
|
113 |
+
TASK_INSTRUCTION.format(
|
114 |
+
routes=json.dumps(route_config), conversation=json.dumps(conversation)
|
115 |
+
)
|
116 |
+
+ FORMAT_PROMPT
|
117 |
+
)
|
118 |
+
|
119 |
+
|
120 |
+
# Define conversations
|
121 |
+
|
122 |
+
conversation = [
|
123 |
+
{
|
124 |
+
"role": "user",
|
125 |
+
"content": "fix this module 'torch.utils._pytree' has no attribute 'register_pytree_node'. did you mean: '_register_pytree_node'?",
|
126 |
+
}
|
127 |
+
]
|
128 |
+
|
129 |
+
route_prompt = format_prompt(route_config, conversation)
|
130 |
+
|
131 |
+
messages = [
|
132 |
+
{"role": "user", "content": route_prompt},
|
133 |
+
]
|
134 |
+
|
135 |
+
input_ids = tokenizer.apply_chat_template(
|
136 |
+
messages, add_generation_prompt=True, return_tensors="pt"
|
137 |
+
).to(model.device)
|
138 |
+
|
139 |
+
# 2. Generate
|
140 |
+
generated_ids = model.generate(
|
141 |
+
input_ids=input_ids, # or just positional: model.generate(input_ids, …)
|
142 |
+
max_new_tokens=32768,
|
143 |
+
)
|
144 |
+
|
145 |
+
# 3. Strip the prompt from each sequence
|
146 |
+
prompt_lengths = input_ids.shape[1] # same length for every row here
|
147 |
+
generated_only = [
|
148 |
+
output_ids[prompt_lengths:] # slice off the prompt tokens
|
149 |
+
for output_ids in generated_ids
|
150 |
+
]
|
151 |
+
|
152 |
+
# 4. Decode if you want text
|
153 |
+
response = tokenizer.batch_decode(generated_only, skip_special_tokens=True)[0]
|
154 |
+
print(response)
|
155 |
+
````
|
156 |
+
|
157 |
+
Then you should be able to see the following output string in JSON format:
|
158 |
+
````python
|
159 |
+
{"route": "bug_fixing"}
|
160 |
+
````
|
161 |
+
|
162 |
+
To better understand how to create the route descriptions, please take a look at our [Katanemo API](https://docs.archgw.com/guides/llm_router.html).
|
163 |
+
|
164 |
+
# License
|
165 |
+
Katanemo Arch-Router model is distributed under the [Katanemo license](https://huggingface.co/katanemo/Arch-Router-1.5B.gguf/blob/main/LICENSE).
|