diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..bfa174a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,58 @@ +# Contributing to Mortdecai + +Mortdecai improves through player interactions. Every prayer, sudo command, and bug report becomes training data for the next version. + +## How to Contribute + +### Play on the Server + +The simplest way to contribute: join the Minecraft server and interact with the AI. + +**Join:** [minecraft.mortdec.ai](https://minecraft.mortdec.ai) + +Things that generate valuable training data: +- **Edge cases** — unusual items, complex enchantments, multi-step requests +- **Natural language variety** — typos, slang, sarcasm, multiple languages +- **Bug reports** — type `bug_log ` when something goes wrong +- **Boundary testing** — try requesting things the AI shouldn't do + +### Submit Training Data (API) + +When the public API launches, you'll be able to submit training examples directly and earn inference credits. See the [API concept](https://git.mortdec.ai/Mortdecai/mortdecai-api). + +A training example is a prompt + expected output: + +```json +{ + "prompt": "sudo give me a trident with riptide 3 and loyalty 3", + "expected_output": { + "commands": [], + "reasoning": "Riptide and loyalty are mutually exclusive" + } +} +``` + +Valuable contributions: +- Commands the model gets wrong +- Modded server commands +- Non-English prompts +- Negative examples ("this should fail because...") + +### Report Issues + +- In-game: `bug_log ` +- Gitea: Open an issue on the relevant repo + +## What NOT to Submit + +- Commands containing real player data or personal information +- Deliberately adversarial training data designed to make the model unsafe +- Copyrighted content +- Anything that violates the Minecraft EULA + +## Code of Conduct + +- Be respectful in all interactions +- Report safety issues responsibly +- Don't attempt to bypass the risk hierarchy +- Have fun — this is a game, after all diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c21a021 --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +Copyright (c) 2026 Mortdecai Project. All rights reserved. + +This software, model weights, training data, and associated documentation +("Mortdecai") are proprietary and confidential. + +No part of Mortdecai may be reproduced, distributed, modified, or used in +any form without prior written consent from the copyright holder. + +This includes but is not limited to: +- Model weights and GGUF files +- Training data and datasets +- Fine-tuning configurations +- System prompts and soul documents + +For licensing inquiries: contact via mortdec.ai diff --git a/MODEL_CARD.md b/MODEL_CARD.md new file mode 100644 index 0000000..b6bc8e4 --- /dev/null +++ b/MODEL_CARD.md @@ -0,0 +1,106 @@ +# Model Card: Mortdecai + +## Model Details + +| Field | Value | +|-------|-------| +| **Name** | Mortdecai | +| **Version** | 0.4.0 | +| **Base Model** | Qwen3.5-9B (Apache 2.0) | +| **Adaptation** | QLoRA (4-bit base + LoRA adapters in FP16) | +| **Parameters** | 9.4B total, 29M trainable (0.31%) | +| **Training Hardware** | RTX 3090 Ti (24GB VRAM) | +| **Inference Hardware** | RTX 4000 (16GB), RTX 2080 Ti (11GB), or any GPU with 6GB+ VRAM | +| **Quantization** | Q4_K_M (5.3GB GGUF) | +| **Context Length** | 4096 tokens (training), 262K tokens (model capability) | +| **License** | Proprietary (adapter + training data). Base model: Apache 2.0 | + +## Intended Use + +Mortdecai is designed for **Minecraft Java Edition 1.21.x server operations**: + +- Translating natural language to valid Minecraft commands +- Controlling an AI God character that responds to player prayers +- Server administration via chat (gamerules, effects, world editing) +- Error correction (self-corrects failed RCON commands) + +**Not intended for:** +- General-purpose chat or reasoning +- Other games or non-Minecraft domains +- Safety-critical applications +- Use without the validator safety layer + +## Training Data + +| Source | Count | Description | +|--------|-------|-------------| +| Hand-curated examples | 966 | Command syntax, recipes, enchantments, entities, effects | +| Player interactions | 654 | Real prayers from live server players | +| Sudo translations | 525 | Natural language → command pairs | +| Tool-calling sequences | 1,159 | Multi-turn RCON execution with error correction | +| Self-play | 5,000+ | Model-generated prompts validated via RCON | +| API distillation | 344 | Claude Haiku gold-standard responses | +| Error corrections | 150+ | Wrong → right command pairs | + +**Total: ~8,400+ examples** + +### Data Collection Methods + +1. **Manual curation** — Minecraft Wiki, command reference, recipe databases +2. **Live server logs** — Real player interactions on Paper 1.21.x servers +3. **Bot collection** — Mineflayer bots with Gemini/Dolphin prompt generation +4. **API distillation** — Claude Haiku and Gemini Flash responses +5. **Self-play** — Model generates edge cases, attempts via RCON, learns from results +6. **RCON validation** — Every command tested against a live Minecraft server + +### Known Biases + +- Training data skewed toward English (~97%) with limited multilingual coverage (3%) +- Command distribution favors `give` and `effect` over complex `execute` chains +- God persona training reflects a specific dramatic character — not neutral +- Player interaction data comes from a small group of testers (< 10 players) +- Self-play data may overrepresent patterns the model is already good at + +## Evaluation + +### Bake-off Results (0.4.0, 2,397 test cases) + +| Metric | Score | +|--------|-------| +| Command match | 75.5% | +| Exact match | 22.9% | +| Syntax correct | 80.5% | +| Safety compliance | 99.7% | +| No gratuitous tp | 98.5% | +| Avg latency | 4.0s | + +### Safety + +The model uses a 5-level risk hierarchy: + +- **Level 0 (never):** ban, kick, stop, op — hardcoded block in validator +- **Level 1 (refuse):** permanent server state changes +- **Level 2 (warn):** temporary/reversible changes, destructive actions +- **Level 3 (normal):** standard gameplay commands +- **Level 4 (generous):** full enchanted gear, large material stacks + +Additional safety layers: +- Validator blocks dangerous commands even if model generates them +- Dangerous effect duration caps (levitation 15s, wither 30s) +- Fall protection (detects lethal teleports) +- Gamerule auto-revert timers + +### Limitations + +- Cannot determine what a player is looking at (no raycast) +- Limited awareness of world state beyond player position +- Enchantment syntax errors still occur (~15% need validator fixes) +- Empty responses on ~5% of requests +- Thinks in `` blocks that must be stripped (Qwen3 behavior) +- God persona can be unpredictable by design + +## Environmental Impact + +- **Training energy:** ~84W × 4 hours = 0.34 kWh per training run +- **Inference energy:** ~54W during calls, idle otherwise +- **All compute on consumer GPUs** — no data center resources used diff --git a/requirements-training.txt b/requirements-training.txt new file mode 100644 index 0000000..09ca77a --- /dev/null +++ b/requirements-training.txt @@ -0,0 +1,106 @@ +accelerate==1.13.0 +aiohappyeyeballs==2.6.1 +aiohttp==3.13.3 +aiosignal==1.4.0 +annotated-doc==0.0.4 +annotated-types==0.7.0 +anyio==4.12.1 +attrs==25.4.0 +bitsandbytes==0.49.2 +certifi==2026.2.25 +charset-normalizer==3.4.6 +click==8.3.1 +cuda-bindings==12.9.4 +cuda-pathfinder==1.4.3 +cut-cross-entropy==25.1.1 +datasets==4.3.0 +diffusers==0.37.0 +dill==0.4.0 +docstring_parser==0.17.0 +filelock==3.20.0 +frozenlist==1.8.0 +fsspec==2025.9.0 +gguf==0.18.0 +h11==0.16.0 +hf-xet==1.4.2 +hf_transfer==0.1.9 +httpcore==1.0.9 +httpx==0.28.1 +huggingface_hub==1.7.1 +idna==3.11 +importlib_metadata==8.7.1 +Jinja2==3.1.6 +jsonschema==4.26.0 +jsonschema-specifications==2025.9.1 +markdown-it-py==4.0.0 +MarkupSafe==3.0.2 +mdurl==0.1.2 +mistral_common==1.10.0 +mpmath==1.3.0 +msgspec==0.20.0 +multidict==6.7.1 +multiprocess==0.70.16 +nest-asyncio==1.6.0 +networkx==3.6.1 +numpy==2.3.5 +nvidia-cublas-cu12==12.8.4.1 +nvidia-cuda-cupti-cu12==12.8.90 +nvidia-cuda-nvrtc-cu12==12.8.93 +nvidia-cuda-runtime-cu12==12.8.90 +nvidia-cudnn-cu12==9.10.2.21 +nvidia-cufft-cu12==11.3.3.83 +nvidia-cufile-cu12==1.13.1.3 +nvidia-curand-cu12==10.3.9.90 +nvidia-cusolver-cu12==11.7.3.90 +nvidia-cusparse-cu12==12.5.8.93 +nvidia-cusparselt-cu12==0.7.1 +nvidia-nccl-cu12==2.27.5 +nvidia-nvjitlink-cu12==12.8.93 +nvidia-nvshmem-cu12==3.4.5 +nvidia-nvtx-cu12==12.8.90 +packaging @ file:///home/task_176104885106445/conda-bld/packaging_1761049078006/work +pandas==3.0.1 +peft==0.18.1 +pillow==12.0.0 +propcache==0.4.1 +protobuf==7.34.0 +psutil==7.2.2 +pyarrow==23.0.1 +pycountry==26.2.16 +pydantic==2.12.5 +pydantic-extra-types==2.11.1 +pydantic_core==2.41.5 +Pygments==2.19.2 +python-dateutil==2.9.0.post0 +PyYAML==6.0.3 +referencing==0.37.0 +regex==2026.2.28 +requests==2.32.5 +rich==14.3.3 +rpds-py==0.30.0 +safetensors==0.7.0 +sentencepiece==0.2.1 +shellingham==1.5.4 +six==1.17.0 +sympy==1.14.0 +tiktoken==0.12.0 +tokenizers==0.22.2 +torch==2.10.0 +torchao==0.16.0 +torchvision==0.25.0 +tqdm==4.67.3 +transformers==5.3.0 +triton==3.6.0 +trl==0.24.0 +typeguard==4.5.1 +typer==0.24.1 +typing-inspection==0.4.2 +typing_extensions==4.15.0 +tyro==1.0.10 +unsloth==2026.3.8 +unsloth_zoo==2026.3.4 +urllib3==2.6.3 +xformers==0.0.35 +xxhash==3.6.0 +yarl==1.23.0 +zipp==3.23.0 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..45073f5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +# Mortdecai inference + service requirements +requests>=2.28.0 +mcrcon>=0.7.0 +python-escpos>=3.0 +prometheus-client>=0.16.0