commit 2b42cf07fd47cd281e97eeac3ef6aa0d00d4a3c0 Author: ModelHub XC Date: Sat Nov 14 11:25:18 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: mkd-ai-dev/Keural-Cortex-8B-v1.0 Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..5ff42fe --- /dev/null +++ b/.gitattributes @@ -0,0 +1,40 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +assets/keural-cortex-foundation-cover.png filter=lfs diff=lfs merge=lfs -text +tokenizer.json filter=lfs diff=lfs merge=lfs -text +assets/keural-cortex-keural-logo.png filter=lfs diff=lfs merge=lfs -text +assets/keural-cortex-agentic-logo.gif filter=lfs diff=lfs merge=lfs -text + diff --git a/README.md b/README.md new file mode 100644 index 0000000..9256838 --- /dev/null +++ b/README.md @@ -0,0 +1,125 @@ +--- +language: +- en +- ko +license: apache-2.0 +library_name: transformers +pipeline_tag: text-generation +tags: +- text-generation +- conversational +- korean +- english +- function-calling +- agent +--- + +# Keural Cortex Foundation Model (8B) — v1.0 + +

Keural symbol at the Cortex neural core with animated orbital energy

+ +Keural Cortex is MKD's local-first Korean-English language-model program for Keural applications. This release is an 8B-parameter, instruction- and preference-aligned checkpoint with a structured tool-calling layer for enterprise workflows. + +It is designed to run in customer-controlled infrastructure through an OpenAI-compatible vLLM endpoint. The host application—not the model—executes tools, enforces permissions, retrieves live data, and owns user data handling. + +> **Release status:** Public v1.0. Evaluate on your own data, workflows, safety requirements, and target serving configuration before production deployment. + +

Cortex 8B architecture overview

+ +## introduction + +**English.** Keural Cortex is a locally deployable AI foundation-model capability built for Korean-English enterprise interaction. It combines efficient 8B-scale inference, controllable OpenAI-compatible serving, and structured tool-call generation so that Keural can connect users to approved enterprise workflows while retaining application-level control of data, permissions, and execution. + +**한국어.** Keural Cortex는 한국어·영어 기반의 엔터프라이즈 AI 상호작용을 위해 설계된 로컬 배포형 파운데이션 모델 역량입니다. 8B 규모의 효율적인 추론, OpenAI 호환 서빙, 구조화된 Tool Call 생성을 결합하여 Keural이 승인된 업무 워크플로와 연동할 수 있도록 지원합니다. 데이터·권한·실행 통제는 모델이 아닌 Keural 애플리케이션 계층에서 관리합니다. + +## Key strengths + +| Strength | What it enables | +|---|---| +| **Local-first deployment** | On-premise or customer-controlled serving patterns; the application controls networking, credentials, access, and retention. | +| **Korean-English interaction** | Direct bilingual chat behavior for Keural user experiences. | +| **Structured tool calls** | Generates OpenAI-compatible calls for `search_web`, `fetch_web_urls`, `retrieve_documents`, and `ask_clarification` when those tools are provided. | +| **Agent-ready architecture** | Separates model decision-making from tool execution, allowing the product layer to apply authorization, auditing, retrieval, and real-time data policies. | +| **Long-context design** | Configuration supports a 65,536-token maximum position length. Serving limits should be set according to available GPU memory and workload. | +| **Efficient serving** | Tested with vLLM using an OpenAI-compatible `/v1/chat/completions` interface. | + + +

Private local deployment pattern

+ +## Model details + +| Item | Value | +|---|---| +| Architecture | Decoder-only transformer language model | +| Transformer layers | 36 | +| Hidden size | 4,096 | +| Attention heads / KV heads | 32 / 8 | +| Vocabulary size | 151,936 | +| Maximum position length | 65,536 tokens | +| Weights | BF16 SafeTensors, ~16 GB | +| Alignment path | Continued training, supervised instruction tuning, preference optimization, and Keural agent/tool-contract tuning | + +## Verified serving smoke tests + +The following were verified through vLLM's OpenAI-compatible API in the release environment: + +- Plain Korean chat returned a direct answer without emitting a tool call. +- A current-information request generated a structured `search_web` call. +- An exhaustive document request generated `retrieve_documents` with `exhaustive: true`. +- An underspecified revision request generated `ask_clarification` with a question and checklist. + +These are smoke tests, not a substitute for domain-specific benchmarking or safety evaluation. + +## Quick start: vLLM + +```bash +vllm serve \ + --served-model-name keural-cortex-8b-v1.0 \ + --tool-call-parser hermes \ + --enable-auto-tool-choice +``` + +For text-only chat, send a normal OpenAI Chat Completions request **without** `tools` or `tool_choice`. For agent workflows, provide only the tools your application authorizes, validate all tool arguments server-side, and execute calls outside the model process. + +## Example tool contract + +```json +{ + "type": "function", + "function": { + "name": "retrieve_documents", + "description": "Search content in the user's available documents.", + "parameters": { + "type": "object", + "properties": { + "query": {"type": "string"}, + "file_ids": {"type": "array", "items": {"type": "string"}}, + "exhaustive": {"type": "boolean"} + }, + "required": ["query"] + } + } +} +``` + +## Limitations and responsible use + +- Outputs can be inaccurate, incomplete, or inconsistent across prompts and serving configurations. Verify important information. +- The model has no inherent live-web access, private-document access, or authority to take external actions. These capabilities must be supplied and governed by the host application. +- Tool calls are model suggestions. Validate schemas, authorization, user intent, and side effects before execution. +- Do not use this preview as the sole basis for high-stakes medical, legal, financial, safety, employment, credit, or access-control decisions. + +## Certification, license, and attribution + +**Certification note.** Keural Cortex Foundation Model (8B) v1.0 is based on Qwen3-8B-Base and is released under Apache-2.0. Please retain applicable upstream notices and comply with the license terms. + +## Citation + +```bibtex +@misc{keural-cortex-8b-v1.0, + title={Keural Cortex Foundation Model (8B) — v1.0}, + author={MKD AI}, + year={2026}, + publisher={Hugging Face} +} +``` diff --git a/assets/architecture.svg b/assets/architecture.svg new file mode 100644 index 0000000..1b0dbf4 --- /dev/null +++ b/assets/architecture.svg @@ -0,0 +1,14 @@ + + + + Keural Cortex Foundation Model (8B) + Local deployment · bilingual chat · tool-call capable + + User contextKorean + English + + Cortex 8BLocal bilingual language model36 layers · 4,096 hidden65,536-token design context + + OutputsPlain chatStructured tool callsGrounded follow-up + + Public release: v1.0 · evaluate for your deployment and safety requirements. + diff --git a/assets/deployment.svg b/assets/deployment.svg new file mode 100644 index 0000000..dc2fb3d --- /dev/null +++ b/assets/deployment.svg @@ -0,0 +1,6 @@ + + + Private, local-first deployment pattern + Keural applicationChat · workflow · agent UICortex 8BvLLM / OpenAI-compatible APIOn-premise inferenceEnterprise toolsSearch · documents · approvals + The model selects structured calls; the host application owns tool execution, access controls, and live-data retrieval. + diff --git a/assets/keural-cortex-agentic-logo.gif b/assets/keural-cortex-agentic-logo.gif new file mode 100644 index 0000000..2b22cf4 --- /dev/null +++ b/assets/keural-cortex-agentic-logo.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea6322b85f142feba70d1541f7105589f39de5d47d66ffd8ba280f416f415405 +size 12286307 diff --git a/assets/keural-cortex-foundation-cover.png b/assets/keural-cortex-foundation-cover.png new file mode 100644 index 0000000..a076f17 --- /dev/null +++ b/assets/keural-cortex-foundation-cover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd8ad6ebf3b492b4e1a9e98423726e3e38611f6908e824b8927f823eb9b6719c +size 1739545 diff --git a/assets/keural-cortex-hero.svg b/assets/keural-cortex-hero.svg new file mode 100644 index 0000000..77c2eae --- /dev/null +++ b/assets/keural-cortex-hero.svg @@ -0,0 +1,39 @@ + + Keural Cortex Foundation Model + Keural logo over a violet neural-core visual representing an AI agent foundation model. + + + + + + + + + + + + + + + + + + + + + + + + + CORTEX FOUNDATION MODEL · 8B + + + + + + + + LOCAL AI · AGENT READY + BILINGUAL CHAT · STRUCTURED TOOL CALLS + + diff --git a/assets/keural-cortex-keural-logo.png b/assets/keural-cortex-keural-logo.png new file mode 100644 index 0000000..67253aa --- /dev/null +++ b/assets/keural-cortex-keural-logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f766d7885be20d07a3055ca403e5f4f1d34b52502f123659682be420c605ce91 +size 2708456 diff --git a/assets/keural-logo.svg b/assets/keural-logo.svg new file mode 100644 index 0000000..05299a8 --- /dev/null +++ b/assets/keural-logo.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..0148f36 --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,87 @@ +{%- if tools %} + {{- '<|im_start|>system\n' }} + {%- if messages[0].role == 'system' %} + {{- messages[0].content + '\n\n' }} + {%- endif %} + {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within XML tags:\n" }} + {%- for tool in tools %} + {{- "\n" }} + {{- tool | tojson }} + {%- endfor %} + {{- "\n\n\nFor each function call, return a json object with function name and arguments within XML tags:\n\n{\"name\": , \"arguments\": }\n<|im_end|>\n" }} +{%- else %} + {%- if messages[0].role == 'system' %} + {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }} + {%- endif %} +{%- endif %} +{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %} +{%- for message in messages[::-1] %} + {%- set index = (messages|length - 1) - loop.index0 %} + {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('') and message.content.endswith('')) %} + {%- set ns.multi_step_tool = false %} + {%- set ns.last_query_index = index %} + {%- endif %} +{%- endfor %} +{%- for message in messages %} + {%- if (message.role == "user") or (message.role == "system" and not loop.first) %} + {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }} + {%- elif message.role == "assistant" %} + {%- set content = message.content %} + {%- set reasoning_content = '' %} + {%- if message.reasoning_content is defined and message.reasoning_content is not none %} + {%- set reasoning_content = message.reasoning_content %} + {%- else %} + {%- if '' in message.content %} + {%- set content = message.content.split('')[-1].lstrip('\n') %} + {%- set reasoning_content = message.content.split('')[0].rstrip('\n').split('')[-1].lstrip('\n') %} + {%- endif %} + {%- endif %} + {%- if loop.index0 > ns.last_query_index %} + {%- if loop.last or (not loop.last and reasoning_content) %} + {{- '<|im_start|>' + message.role + '\n\n' + reasoning_content.strip('\n') + '\n\n\n' + content.lstrip('\n') }} + {%- else %} + {{- '<|im_start|>' + message.role + '\n' + content }} + {%- endif %} + {%- else %} + {{- '<|im_start|>' + message.role + '\n' + content }} + {%- endif %} + {%- if message.tool_calls %} + {%- for tool_call in message.tool_calls %} + {%- if (loop.first and content) or (not loop.first) %} + {{- '\n' }} + {%- endif %} + {%- if tool_call.function %} + {%- set tool_call = tool_call.function %} + {%- endif %} + {{- '\n{"name": "' }} + {{- tool_call.name }} + {{- '", "arguments": ' }} + {%- if tool_call.arguments is string %} + {{- tool_call.arguments }} + {%- else %} + {{- tool_call.arguments | tojson }} + {%- endif %} + {{- '}\n' }} + {%- endfor %} + {%- endif %} + {{- '<|im_end|>\n' }} + {%- elif message.role == "tool" %} + {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %} + {{- '<|im_start|>user' }} + {%- endif %} + {{- '\n\n' }} + {{- message.content }} + {{- '\n' }} + {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %} + {{- '<|im_end|>\n' }} + {%- endif %} + {%- endif %} +{%- endfor %} +{%- if add_generation_prompt %} + {{- '<|im_start|>assistant\n' }} + {%- if enable_thinking is defined and enable_thinking is false %} + {{- '\n\n\n\n' }} + {%- else %} + {{- '\n' }} + {%- endif %} +{%- endif %} \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..29289b4 --- /dev/null +++ b/config.json @@ -0,0 +1,73 @@ +{ + "architectures": [ + "Qwen3ForCausalLM" + ], + "attention_bias": false, + "attention_dropout": 0.0, + "bos_token_id": 151643, + "dtype": "bfloat16", + "eos_token_id": 151645, + "head_dim": 128, + "hidden_act": "silu", + "hidden_size": 4096, + "initializer_range": 0.02, + "intermediate_size": 12288, + "layer_types": [ + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention" + ], + "max_position_embeddings": 65536, + "max_window_layers": 36, + "model_type": "qwen3", + "num_attention_heads": 32, + "num_hidden_layers": 36, + "num_key_value_heads": 8, + "pad_token_id": null, + "rms_norm_eps": 1e-06, + "rope_parameters": { + "factor": 2.0, + "original_max_position_embeddings": 32768, + "rope_theta": 1000000, + "rope_type": "yarn" + }, + "sliding_window": null, + "tie_word_embeddings": false, + "transformers_version": "5.17.0", + "use_cache": true, + "use_sliding_window": false, + "vocab_size": 151936 +} diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..b1f1d18 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,15 @@ +{ + "bos_token_id": 151643, + "do_sample": true, + "eos_token_id": [ + 151645, + 151643 + ], + "max_new_tokens": 2048, + "pad_token_id": 151643, + "repetition_penalty": 1.05, + "temperature": 0.7, + "top_k": 20, + "top_p": 0.8, + "transformers_version": "5.17.0" +} diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..0386318 --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce1121bc9b9ed11dc9abbf834206884ce5b38662de39dca73f740ddcf3a5c995 +size 16381517208 diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..c7afbed --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506 +size 11422650 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..b16d617 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,16 @@ +{ + "add_prefix_space": false, + "backend": "tokenizers", + "bos_token": null, + "clean_up_tokenization_spaces": false, + "eos_token": "<|endoftext|>", + "errors": "replace", + "is_local": true, + "local_files_only": false, + "model_max_length": 131072, + "pad_token": "<|endoftext|>", + "split_special_tokens": false, + "tokenizer_class": "Qwen2Tokenizer", + "unk_token": null, + "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within XML tags:\\n\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n\\n\\nFor each function call, return a json object with function name and arguments within XML tags:\\n\\n{\\\"name\\\": , \\\"arguments\\\": }\\n<|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and not(message.content.startswith('') and message.content.endswith('')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set content = message.content %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is defined and message.reasoning_content is not none %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '' in message.content %}\n {%- set content = message.content.split('')[-1].lstrip('\\n') %}\n {%- set reasoning_content = message.content.split('')[0].rstrip('\\n').split('')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n\\n' + reasoning_content.strip('\\n') + '\\n\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n\\n' }}\n {{- message.content }}\n {{- '\\n' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '\\n\\n\\n\\n' }}\n {%- else %}\n {{- '\\n' }}\n {%- endif %}\n{%- endif %}" +}