Instructions to use leapshared/sciedu-router-kev4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use leapshared/sciedu-router-kev4b with PEFT:
from peft import PeftModel from transformers import AutoModel base_model = AutoModel.from_pretrained("Qwen/Qwen3.5-4B-Base") model = PeftModel.from_pretrained(base_model, "leapshared/sciedu-router-kev4b") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use leapshared/sciedu-router-kev4b with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf leapshared/sciedu-router-kev4b:Q4_K_M # Run inference directly in the terminal: llama cli -hf leapshared/sciedu-router-kev4b:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf leapshared/sciedu-router-kev4b:Q4_K_M # Run inference directly in the terminal: llama cli -hf leapshared/sciedu-router-kev4b:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf leapshared/sciedu-router-kev4b:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf leapshared/sciedu-router-kev4b:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf leapshared/sciedu-router-kev4b:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf leapshared/sciedu-router-kev4b:Q4_K_M
Use Docker
docker model run hf.co/leapshared/sciedu-router-kev4b:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use leapshared/sciedu-router-kev4b with Ollama:
ollama run hf.co/leapshared/sciedu-router-kev4b:Q4_K_M
- Unsloth Desktop
- Pi
How to use leapshared/sciedu-router-kev4b with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf leapshared/sciedu-router-kev4b:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "leapshared/sciedu-router-kev4b:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use leapshared/sciedu-router-kev4b with Docker Model Runner:
docker model run hf.co/leapshared/sciedu-router-kev4b:Q4_K_M
- Lemonade
How to use leapshared/sciedu-router-kev4b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull leapshared/sciedu-router-kev4b:Q4_K_M
Run and chat with the model
lemonade run user.sciedu-router-kev4b-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use leapshared/sciedu-router-kev4b with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf leapshared/sciedu-router-kev4b:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default leapshared/sciedu-router-kev4b:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use leapshared/sciedu-router-kev4b with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf leapshared/sciedu-router-kev4b:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "leapshared/sciedu-router-kev4b:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
sciedu-router-kev4b
한국어 교실 로봇(OpenArm SciEdu)의 대화 라우터: 학생·선생님의 한국어 말 한 마디와 맥락 다섯 칸을 읽어 열한 갈래 가운데 하나로 가른다
(멈춰 pause · 그만 stop · 다음 proceed · 다시 retry · 실험 시작·바꾸기 start_switch · 나뭇잎 쪽 leaf_side · 손 넣기 hands · 질문 question · 대답 answer · 일반 대화 chitchat · 알 수 없음 unclear).
Kev-4B(Qwen3.5-4B-Base + LoRA + 포인터 머리)에서 이어서 미세조정했고, 갈래마다 확률(/v1/systemone의 choice)을 낸다.
이 라우터는 대화층에 기본값 꺼 둠이다. 아래 표처럼 마지막 판정에서 위험한 틀림이 0이 아니어서(통과 기준: 0) 로봇을 움직이는 길에 기본으로 붙이지 않는다. 붙이더라도 "움직임 두 번째 표"(대화 모델의 계획과 라우터가 둘 다 움직임 갈래일 때만 움직인다)와 "멈춤 빠른 길"(낱말 목록과 OR)로만 쓰고, 선생님 화면 버튼은 라우터를 거치지 않는다. 설계와 안전 규칙: 저장소
plan/dialogue-routing.md(5·6절), 측정:docs/measurements/routing-kev.md.
한 줄 결과 (2026-10-13, 자료 414a698/849c15a, 씨앗 0 하나, GGUF Q4_K_M을 llama.cpp로 띄워 잰 값)
통과 판정은 손대지 않은 줄(tuned 꼬리표 없는 줄)의 두 조각에서 읽는다. 인자·온도·문턱은 모두 검증 세트로만 골랐고 시험 줄을 보고 고치지 않았다.
| 조각 | 줄 | 맞음(허용 갈래 포함) | 엄격 맞음 | 위험한 틀림(줄) | 정답 멈춤 줄에서 선 몫 | 정답 그만 줄에서 선 몫 |
|---|---|---|---|---|---|---|
| (가) 마지막 판정 = 시나리오 옮김 + 독립 시험 | 482 | 94.6% | 91.5% | 6(거짓 움직임 6, 그중 1줄은 놓친 멈춤도) | 0.979 | 1.0 |
| (나) 움직임 낱말이 든 일반 대화 포함 덧붙임 | 508 | 96.3% | 2(거짓 움직임 2) | 1.0 | 1.0 | |
| 지연(요청 507토큰, HTTP 포함, RTX 5090이 조용할 때, 불러 본 1,099줄) | 중앙 52.7 ms · p90 55.7 ms · p99 58.6 ms | 오류 0 |
통과 기준(위험 0, (가) 맞음 90%)에서 맞음은 넘지만 위험 0은 넘지 못했다. 검증 세트로 정한 문턱 규칙 {"halt_min": 0.15, "move_min": 0.7}(policy.json)을 얹으면 (가) 맞음 93.6%·위험 5줄, (나) 95.9%·위험 1줄이고
진짜 움직임 말을 되묻기로 막는 몫이 (가) 16.4% → 21.9%로 는다. 그래도 0이 아니다.
갈래별(정답 갈래 기준, 맞음 / 줄 수, 괄호는 위험한 틀림 줄):
| 갈래 | (가) 482줄 | (나) 508줄 |
|---|---|---|
| pause | 46/47 (1) | 49/49 |
| stop | 28/28 | 26/26 |
| proceed | 59/68 | 58/61 |
| retry | 17/17 | 16/16 |
| start_switch | 16/16 | 19/21 |
| leaf_side | 21/27 | 19/21 |
| hands | 79/80 (1) | 17/17 |
| question | 42/44 (2) | 41/43 (1) |
| answer | 43/48 (1) | 52/55 |
| chitchat | 10/10 | 130/134 |
| unclear | 95/97 (1) | 62/65 (1) |
참고(통과 조건 아님): 독립 시험 123줄 맞음 97.6%·위험 2, 시나리오 손대지 않은 359줄 93.6%·위험 4, tuned 109줄 97.2%·위험 3, 덧붙임 전체 610줄 96.4%·위험 5. 검증 428줄(파이썬): 맞음 94.4%. 씨앗은 하나라 위 숫자의 흔들림(씨앗 사이)은 모른다. 시험 줄 수가 적어 한 줄이 0.2~0.3%p다. GGUF Q4_K_M은 파이썬(bf16 체크포인트)과 검증 428줄에서 같은 갈래 425줄(99.3%), 확률 차이 최대 0.21이다.
쓰는 법
- 서버: llama.cpp
server-cuda(빌드 11371, 결정 모델/v1/systemone)에 GGUF를 올린다.-b 1024 -ub 1024가 필요하다(요청 한 건이 중앙 507·최대 535 토큰이라 기본 ubatch 512를 넘는다).
VRAM은 약 4.7 GB(서버 프로세스 증가분 4,663 MiB), GGUF 3.03 GB.ghcr.io/ggml-org/llama.cpp:server-cuda@sha256:f90b9de8baf5244c2c43f9594d7522424470f0d472323fe10405eceae714405b -m sciedu-router-kev4b-Q4_K_M.gguf --host 0.0.0.0 --port 8080 -ngl 99 -c 4096 --parallel 1 -b 1024 -ub 1024 - 요청은
example_request.json과 글자까지 같은 꼴이어야 한다:state는 문자열 한 줄(장면=… | 실험=… | 나뭇잎 활동=… | AI 제안=… | 말한 사람=… || <말>), 질문route는choice, 보기 이름은 열한 갈래 키와 설명이다. 학습 때 쓴 글이라 바꾸면 어긋난다. 만드는 코드는 저장소의dialogue/routing/kev_format.py(request_body)다.state는 객체가 아닌 문자열로 보낸다(객체는 Kev 파이썬과 llama.cpp가 다르게 읽는다). - 응답의
answers.route.choice와probabilities를 쓴다. 확률은 GGUF에 든 온도(3.03)로 맞춰져 있다. 문턱 규칙은policy.json: 멈춤+그만 확률의 합이halt_min이상이면 멈춤 쪽, 움직임 갈래의 확률이move_min밑이면 되묻기(unclear). - 맥락 칸 다섯: 장면(없음·시작 전·움직이는 중·다음 지시 기다림·접지 기다림·일시정지), 실험(산화환원·검전기·나뭇잎·없음), 나뭇잎 활동(학생이 분류·기준 맞히기·없음), AI 제안(있음·아니오),
말한 사람(학생·선생님).
AI 제안은 코드가 정한다(모델이 AI의 말을 읽어 정하지 않는다).
학습
- 시작:
jaredpalmer/kev-4b@6cfce5c2fa4b4bd64026336ab649c5ca78857d52(--init_from), 기저Qwen/Qwen3.5-4B-Base@1001bb4d826a52d1f399e183466143f4da7b741b. Kev 커밋2ecafc49fe1e8945cd600443e6c04c1cf0b3a78f, torch 2.8.0+cu128, transformers 5.17.0, peft 0.21.0. - 인자: 3에폭, lr 1e-4, 배치 4 × 누적 4, bf16, LoRA r16, 기울기 체크포인트, 증강 모두 0(
--p_none --p_none_distract --p_distract --p_none_pair; 기본값은 참 갈래를 지우고 none을 정답으로 삼는 기록을 만들어 열한 갈래 고정 질문을 깬다), 씨앗 0. 741 스텝, 약 42분(RTX 5090, 최대 VRAM 10.1 GiB, 다른 GPU 일과 겹쳤다). - 학습 자료 3,947줄(손 시드 1,955 · 템플릿 846 · LLM 합성 1,108(두 모델이 따로 갈래를 골라 모두 맞은 것만) · 수업 촬영 기록의 사람 말을 사람이 라벨한 줄 38). 일반 대화 31.8%. 검증 428줄로 온도(날 로짓의 평균 로그손실 최소, 3.03)와 문턱을 정했다. 자료와 만드는 도구는 저장소에 있고 이 모델 저장소에는 올리지 않았다.
- 인자 고르기(검증 282줄 시기의 1차 훑기): 4B lr 1e-4·3에폭 94.3%, lr 5e-5 93.3%, 0.8B 91.8%. Kev 문서의 시작값(lr 2e-5, 2에폭)은 덜 학습돼 85%였다. 자세한 표는
docs/measurements/routing-kev.md.
한계
- 위험 0을 넘지 못했다(위 표). 위험한 틀림 8줄을 정답 갈래 → 읽은 갈래로 세면(마지막 판정의 혼동표 집계이고, 틀린 줄의 말은 보지 않았다):
(가) 6줄은
question→proceed1 ·question→retry1 ·answer→retry1 ·pause→retry1(놓친 멈춤도) ·hands→proceed1 ·unclear→proceed1, (나) 2줄은question→retry1 ·unclear→leaf_side1이다. 읽은 갈래별로 합치면retry4 ·proceed3 ·leaf_side1이다. 이 집계로는 어떤 말이 그렇게 읽히는지 알 수 없다. - 학습 말이 실제 음성보다 짧고 선생님 말투가 적다. 받아쓰기 오류 꼴은 흉내 낸 것이다.
- 시험 줄의 일부는 학습 보강을 만들 때 보았다(tuned 꼬리표). 통과 판정은 손대지 않은 줄로만 읽는다.
- 씨앗이 하나다.
파일
sciedu-router-kev4b-Q4_K_M.gguf(서빙용) · adapter_model.safetensors · adapter_config.json · head.pt(포인터 머리 + 온도 3.03; kev.serve --run이나 GGUF 변환에 쓴다) · training_config.json · training_metrics.json ·
policy.json · example_request.json · eval/(검증 보정, 파이썬↔GGUF 견주기, 통과 판정 요약).
- Downloads last month
- 85
4-bit
Model tree for leapshared/sciedu-router-kev4b
Base model
Qwen/Qwen3.5-4B-Base