Jingyao Gong logo

MiniMind

MiniMindv64MCurrent
byJingyao GongJingyao Gong(open source)
Released September 2, 2026
Context1.0K tokens
Training CutoffNot specified
CategoryLarge Language Model
Max Output1.0K tokens

About MiniMind

MiniMind is a small open-source language-model training project that demonstrates how to train a 64M-parameter LLM from scratch. The repository is aimed at builders who want a compact, inspectable model-training path rather than a hosted frontier API.

Capabilities

texteducationtraining

Input Modalities

text

Output Modalities

text

Technical Details

API Identifier
jingyaogong/minimind
Category
Large Language Model
Context Window
1,024 tokens
Max Output Tokens
1,024 tokens

Tags

small-llmtrainingopen-sourceeducationpytorch

Run this model yourself

Local and cloud setup for MiniMind, with exact configurations, sources and clear evidence limits.

Find a model for your hardware
Local hardwareDocumented setupSources checked Oct 16, 2026

Run MiniMind-3 64M as a private Linux CPU learning service

Explore short Chinese prompts with the dense 63,912,192-parameter MiniMind-3 artifact released April 1, 2026. Use native Transformers Qwen3 loading in author-selected FP32 and a bounded authenticated loopback educational server. Compatibility, full memory fit, speed and answer quality are unmeasured.

Hardware
Intel Core i5-12400 desktop, 4-thread allocation, 8 GiB host RAM
Runtime
Native Transformers Qwen3 with reader-authored private HTTPServer Transformers 4.57.6; torch 2.6.0+cpu cp312; Python 3.12; author-selected FP32 · CPU
Model format
safetensors · FP32 CPU loading from F16 safetensors; author choice · None; F16 published weights loaded into author-selected FP32
Workload
640 token context · 1 concurrent

Based on source documentation; this setup has not been executed by OpenTools. Memory: unknown. No compatible measurement available.

Read the complete setup guide

Before you start

  • Use an owned Intel Core i5-12400 desktop with Ubuntu 24.04 x86_64. Allocate four inference threads, 8 GiB host RAM and 20 GiB free disk.
  • These are author planning allocations. You need sudo, HTTPS access and Python 3.12 venv support. No measured minimum, fit or performance is claimed.
  • Use the dense MiniMind-3 64M snapshot, not MiniMind2 104M or MiniMind-3 MoE. This family guide documents the April 1, 2026 artifact without rewriting the catalog date.
  • Read Apache 2.0 terms. This is a private educational demonstrator; Python HTTPServer is not intended for production.

Exact model and requirements

Artifact:
jingyaogong / MiniMind-3 dense 64M · checkpoint jingyaogong/minimind-3
Publisher revision:
f92512d4cd6142fa9acc0d6022375049a8974bf6
Artifact digest:
sha256:3adf69402b5d22e693151cabadc12528f923c4ba6bf343738aaf13f0892162e8
Download size:
0.12 GiB
Memory requirement (unknown):
Unknown — No exact full-process peak memory evidence for this configuration.
System RAM / disk:
Unknown / Unknown
Placement:
single device. One CPU host; no tensor/pipeline sharding. Entire model on CPU; no device_map, GPU or disk offload.
KV cache:
FP32 native Qwen3 attention state matching loaded model dtype
Workload:
640 token context; Unknown; Unknown; concurrency 1; batch 1; cache unknown; repetitions Unknown.
Tokenizer:
Exact MiniMind-3 tokenizer and open_thinking chat template · f92512d4cd6142fa9acc0d6022375049a8974bf6
Sampling / reasoning:
Author-selected short-prompt sampling: temperature 0.85, top_p 0.95, top_k 0 (disabled), repetition_penalty 1.0; max_new_tokens 1–128. Temperature/top-p match native evaluation defaults; other choices explicit. open_thinking=False inserts the publisher template closed empty thinking block. No reasoning parser or tool execution.
Runtime prerequisites:
Ubuntu 24.04 x86_64; See prerequisites above.

Official artifact · License

Publisher model metadata declares Apache-2.0; official project Apache 2.0 license is archived. Retain license and required notices for redistribution, identify modifications, and review patent/NOTICE conditions. A standalone LICENSE in the model repository was not found.

  • 8 GiB host RAM and 20 GiB disk are author planning allocations, not measured minimums or fit guarantees.
  • Published file bytes and FP32 parameter arithmetic exclude caches, buffers, framework, dependencies and OS. Exact process peak is unknown.

One-time setup and hardware

hardware
Unknown — Existing desktop purchase price and incremental hardware cost depend on the reader; unknown.
Existing desktop purchase price and incremental hardware cost depend on the reader; unknown. Tax: unknown.
setup
Unknown — Initial provisioning/build time and labor cost are unknown.
Initial provisioning/build time and labor cost are unknown. Tax: unknown.

Recurring costs

electricity
Unknown — Actual wall power, electricity rate and powered hours are unknown; no TDP-to-wall-power conversion.
Actual wall power, electricity rate and powered hours are unknown; no TDP-to-wall-power conversion. Tax: unknown.
storage
Unknown — Incremental cost of local disk capacity is unknown. The 20 GiB free-disk walkthrough allocation is an author choice, not a measured requirement.
Incremental cost of local disk capacity is unknown. The 20 GiB free-disk walkthrough allocation is an author choice, not a measured requirement. Tax: unknown.
egress
Unknown — Data transfer price, allowances and traffic volume are unknown.
Data transfer price, allowances and traffic volume are unknown. Tax: unknown.
administration
Unknown — Maintenance labor rate and hours are unknown.
Maintenance labor rate and hours are unknown. Tax: unknown.

Install the runtime

  1. 1. Create the Python 3.12 CPU environment

    Install the exact official CPU wheel by hash and Transformers version. System and transitive package versions resolve at installation; save the resulting environment. This is not an executed compatibility claim.

    Command
    sudo apt-get update
    sudo apt-get install -y python3.12 python3.12-venv curl ca-certificates openssl
    mkdir -p "$HOME/minimind3-hosting/minimind-3"
    cd "$HOME/minimind3-hosting"
    python3.12 -m venv .venv
    .venv/bin/python -m pip install "https://download.pytorch.org/whl/cpu/torch-2.6.0%2Bcpu-cp312-cp312-linux_x86_64.whl#sha256=59e78aa0c690f70734e42670036d6b541930b8eabbaa18d94e090abf14cc4d91"
    .venv/bin/python -m pip install "transformers==4.57.6"
    .venv/bin/python -m pip check
    .venv/bin/python -m pip freeze > resolved-environment.txt

    Expected result: pip check succeeds; resolved-environment.txt records actual installed versions. Stop on resolver or hash errors.

Download the model

  1. 1. Fetch and verify the complete inference snapshot

    Download six pinned inference files, including tokenizer and separate chat template. Weight hash is publisher LFS metadata; small-file hashes are archived byte hashes. No custom remote code is loaded.

    Command
    cd "$HOME/minimind3-hosting"
    curl --fail --location --output minimind-3/config.json 'https://huggingface.co/jingyaogong/minimind-3/resolve/f92512d4cd6142fa9acc0d6022375049a8974bf6/config.json'
    curl --fail --location --output minimind-3/generation_config.json 'https://huggingface.co/jingyaogong/minimind-3/resolve/f92512d4cd6142fa9acc0d6022375049a8974bf6/generation_config.json'
    curl --fail --location --output minimind-3/tokenizer.json 'https://huggingface.co/jingyaogong/minimind-3/resolve/f92512d4cd6142fa9acc0d6022375049a8974bf6/tokenizer.json'
    curl --fail --location --output minimind-3/tokenizer_config.json 'https://huggingface.co/jingyaogong/minimind-3/resolve/f92512d4cd6142fa9acc0d6022375049a8974bf6/tokenizer_config.json'
    curl --fail --location --output minimind-3/chat_template.jinja 'https://huggingface.co/jingyaogong/minimind-3/resolve/f92512d4cd6142fa9acc0d6022375049a8974bf6/chat_template.jinja'
    curl --fail --location --output minimind-3/model.safetensors 'https://huggingface.co/jingyaogong/minimind-3/resolve/f92512d4cd6142fa9acc0d6022375049a8974bf6/model.safetensors'
    cat > snapshot.sha256 <<'HASHES'
    efcfa39ede9bbb5b64ded2bb90969e4b840f0f9e1e36725d386acb7eca1c6d05  minimind-3/config.json
    3ee3cbe9acb55059b37a4e90bb843812eb86f70c5ebea404f137cd9c80127870  minimind-3/generation_config.json
    71f32c68cf63a15355a8fc171b7594b3d41870fe0ddb54fc6aefa55f73a4a668  minimind-3/tokenizer.json
    04ae7620b9cf93fd2d6fbf94936b0c3c4be65f30cd6ef6fa8741baac986525d1  minimind-3/tokenizer_config.json
    97c6a9ef3f8d35044f435bb7773f1af160a7328ab6e8d2e9d67702941320a711  minimind-3/chat_template.jinja
    3adf69402b5d22e693151cabadc12528f923c4ba6bf343738aaf13f0892162e8  minimind-3/model.safetensors
    HASHES
    sha256sum --check snapshot.sha256

    Expected result: All six SHA-256 checks report OK. Stop on any mismatch.

Configure

  1. 1. Write the private reader-authored bounded server

    This code is an OpenTools-authored prescription using official APIs, not publisher server code. It preserves an existing service key. Single-process HTTPServer binds loopback, authenticates health and inference, accepts only prompt plus max_new_tokens, caps body at 8,192 bytes, rendered input at 512 tokens, output at 128 and combined tokens at 640. No streaming or OpenAI compatibility.

    Command
    cd "$HOME/minimind3-hosting"
    umask 077
    if [ ! -e .api-key ]; then openssl rand -hex 32 > .api-key; fi
    test -s .api-key || { echo 'Restore empty service key before proceeding'; exit 1; }
    chmod 600 .api-key
    cat > reader-server.py <<'PYTHON'
    """OpenTools reader-authored educational demonstrator; not publisher server."""
    import hmac,json,os
    from http.server import BaseHTTPRequestHandler,HTTPServer
    
    def check_budget(count,limit):
        if count>512 or count+limit>640: raise ValueError('token_budget')
    
    def handler_factory(generate,key):
        class Handler(BaseHTTPRequestHandler):
            protocol_version='HTTP/1.0'
            def setup(self):
                super().setup(); self.connection.settimeout(10)
            def log_message(self,*args): pass
            def reply(self,status,data):
                body=json.dumps(data,ensure_ascii=False).encode()
                self.send_response(status); self.send_header('Content-Type','application/json; charset=utf-8')
                self.send_header('Content-Length',str(len(body))); self.end_headers(); self.wfile.write(body)
            def authorized(self):
                value=self.headers.get('Authorization','').encode()
                return hmac.compare_digest(value,('Bearer '+key).encode())
            def do_GET(self):
                if not self.authorized(): return self.reply(401,{'error':'unauthorized'})
                if self.path!='/health': return self.reply(404,{'error':'not_found'})
                self.reply(200,{'status':'ready'})
            def do_POST(self):
                if not self.authorized(): return self.reply(401,{'error':'unauthorized'})
                if self.path!='/v1/minimind': return self.reply(404,{'error':'not_found'})
                if self.headers.get('Transfer-Encoding') is not None: return self.reply(400,{'error':'transfer_encoding_unsupported'})
                if self.headers.get_content_type()!='application/json': return self.reply(415,{'error':'json_required'})
                lengths=self.headers.get_all('Content-Length',[])
                if len(lengths)!=1 or not lengths[0] or not all('0'<=c<='9' for c in lengths[0]): return self.reply(411,{'error':'content_length_required'})
                if len(lengths[0])>4: return self.reply(413,{'error':'body_limit'})
                n=int(lengths[0])
                if not 1<=n<=8192: return self.reply(413,{'error':'body_limit'})
                try:
                    raw=self.rfile.read(n)
                    if len(raw)!=n: return self.reply(400,{'error':'incomplete_body'})
                    data=json.loads(raw)
                except (ValueError,UnicodeError,TimeoutError): return self.reply(400,{'error':'invalid_json'})
                if type(data)!=dict or set(data)!={'prompt','max_new_tokens'} or type(data['prompt'])!=str or not data['prompt'].strip() or type(data['max_new_tokens'])!=int or not 1<=data['max_new_tokens']<=128:
                    return self.reply(400,{'error':'invalid_fields'})
                try: result=generate(data['prompt'],data['max_new_tokens'])
                except ValueError: return self.reply(422,{'error':'token_budget'})
                except Exception: return self.reply(500,{'error':'generation_failed'})
                self.reply(200,result)
        return Handler
    
    def main():
        import torch
        from transformers import AutoTokenizer,AutoModelForCausalLM
        key=open('.api-key',encoding='ascii').read().strip()
        if len(key)!=64 or any(c not in '0123456789abcdef' for c in key): raise SystemExit('Invalid service key')
        torch.set_num_threads(4)
        tok=AutoTokenizer.from_pretrained('./minimind-3',local_files_only=True,trust_remote_code=False)
        model=AutoModelForCausalLM.from_pretrained('./minimind-3',local_files_only=True,trust_remote_code=False,dtype=torch.float32).to('cpu').eval()
        def generate(prompt,limit):
            ids=tok.apply_chat_template([{'role':'user','content':prompt}],tokenize=True,add_generation_prompt=True,open_thinking=False,return_tensors='pt')
            count=ids.shape[-1]
            check_budget(count,limit)
            with torch.inference_mode():
                out=model.generate(ids,attention_mask=torch.ones_like(ids),max_new_tokens=limit,do_sample=True,temperature=0.85,top_p=0.95,top_k=0,repetition_penalty=1.0,pad_token_id=tok.eos_token_id)
            new=out[0,count:]
            return {'text':tok.decode(new,skip_special_tokens=True),'input_tokens':count,'output_tokens':len(new)}
        HTTPServer(('127.0.0.1',8998),handler_factory(generate,key)).serve_forever()
    if __name__=='__main__': main()
    PYTHON
    .venv/bin/python -m py_compile reader-server.py

    Expected result: Python syntax check succeeds; service key is private and never printed.

Start the model

  1. 1. Start the CPU learning service

    Use one foreground process. Torch uses four CPU threads; load FP32 explicitly rather than native project FP16. No truncation silently changes a prompt. Requests run sequentially; this is not a hardened multitenant service.

    Command
    cd "$HOME/minimind3-hosting"
    HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 .venv/bin/python reader-server.py

    Expected result: After snapshot load, loopback port 8998 accepts authenticated health requests. Startup may fail until environment compatibility is verified.

Connect to your endpoint

http://127.0.0.1:8998/v1/minimind

Server loopback only; client runs on the same desktop.

Access: loopback. Use the private Bearer key for health and generation. Send a JSON object with prompt as a string and max_new_tokens as an integer. The response contains text, input_tokens and output_tokens. This educational endpoint uses the documented custom schema.

Verify the setup

  1. 1. Check authentication and a short Chinese prompt

    Run on the same host in another terminal. The prompt follows the native educational Chinese chat use. Expect a nonempty text field, then inspect accuracy yourself; 64M capacity does not establish reliable factual or English summarization ability.

    Command
    cd "$HOME/minimind3-hosting"
    MINIMIND_SERVICE_KEY="$(cat .api-key)"
    curl --fail http://127.0.0.1:8998/health -H "Authorization: Bearer $MINIMIND_SERVICE_KEY"
    curl --fail http://127.0.0.1:8998/v1/minimind -H "Authorization: Bearer $MINIMIND_SERVICE_KEY" -H 'Content-Type: application/json' -d '{"prompt":"请介绍一下自己。","max_new_tokens":128}'
    curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8998/health
    unset MINIMIND_SERVICE_KEY

    Expected result: Authorized health returns ready; generation returns text/input_tokens/output_tokens; missing key returns 401. A nonempty answer is only a smoke check.

Performance evidence

No compatible measurement available. Documented support and estimated memory do not establish response speed.

Limits and troubleshooting

  • Documented source support only: no weights, installation or inference executed by this author. No measured fit, speed, latency or answer-quality evidence.
  • Dense MiniMind-3 has 63,912,192 parameters. MiniMind2 104M and the 198M-total/64M-active MoE are distinct variants.
  • Native config advertises 32,768 positions; this deliberate educational workload enforces 640 combined tokens and a single user string, with no history, tools or multimodal input.
  • FP32 loading is an author choice distinct from the native evaluation and API FP16 path. Published F16 file size is not process RAM.
  • The server is reader-authored private demonstration code, not publisher code or a production API. Loopback authentication does not protect against privileged local users; no TLS or multi-user isolation.
  • HTTP errors: 401 authentication; 404 route; 411 missing/ambiguous length; 413 body bound; 415 content type; 400 JSON/fields/transfer encoding; 422 token budget; 500 generic generation failure. Other HTTP methods receive BaseHTTPRequestHandler 501.
  • Transitive dependencies and apt packages are not fully locked; save actual environment and verify on the selected host. Source metadata and stub tests do not prove model execution.
  • Full family coverage is not final; training, fine-tuning and other variants are outside this specific guide.
Load or package failure
Check Python 3.12 x86_64, exact CPU wheel digest, Transformers 4.57.6 and all six snapshot hashes. Do not silently swap an older model or enable remote code.
HTTP 401 or connection refused
Check same-host loopback, foreground startup logs and matching .api-key. Run the client on this desktop.
HTTP 400/411/413/415/422
Send only prompt and integer max_new_tokens (1–128), application/json with a single length, at most 8,192 bytes. Shorten the prompt to fit 512 rendered tokens and 640 combined tokens; never disable bounds.
Empty or poor answer
Confirm exact tokenizer/template and open_thinking=False; simplify the Chinese prompt. Inspect generated content manually. Small educational model quality is unknown.
Memory pressure or stalled generation
Stop the foreground service; inspect OS memory and process logs. Allocate more resources or change workload explicitly; no fit or response-time guarantee is available.

Stop the model

  1. 1. Stop the service

    Press Ctrl+C in the foreground server terminal. Confirm port 8998 stops responding.

    Command
    unset MINIMIND_SERVICE_KEY

    Expected result: Service exits; shell key variable removed.

Uninstall

  1. 1. Remove dedicated files

    Back up wanted logs first and verify the exact dedicated path. Shared apt packages remain.

    Command
    rm -r -- "$HOME/minimind3-hosting"

    Expected result: Dedicated snapshot, venv, wrapper and private credential removed.

Sources and verification

Sources checked Oct 16, 2026. Verification source

Related guides

Compare this configuration
Cloud serverDocumented setupSources checked Oct 16, 2026

Run MiniMind-3 64M as a private AWS CPU learning service

Explore short Chinese prompts with the dense 63,912,192-parameter MiniMind-3 artifact released April 1, 2026. Use native Transformers Qwen3 loading in author-selected FP32 and a bounded authenticated loopback educational server. Compatibility, full memory fit, speed and answer quality are unmeasured.

Hardware
AWS c7i.xlarge, 8 GiB RAM, Ubuntu x86_64
Runtime
Native Transformers Qwen3 with reader-authored private HTTPServer Transformers 4.57.6; torch 2.6.0+cpu cp312; Python 3.12; author-selected FP32 · CPU
Model format
safetensors · FP32 CPU loading from F16 safetensors; author choice · None; F16 published weights loaded into author-selected FP32
Workload
640 token context · 1 concurrent

Based on source documentation; this setup has not been executed by OpenTools. Memory: unknown. No compatible measurement available.

Read the complete setup guide

Before you start

  • Select AWS c7i.xlarge in us-east-1: four vCPUs, 8 GiB RAM, Ubuntu 24.04 x86_64 and a 20 GiB gp3 root volume. Restrict SSH to your own source IP; do not open port 8998.
  • These are author planning allocations. You need sudo, HTTPS access and Python 3.12 venv support. No measured minimum, fit or performance is claimed.
  • Use the dense MiniMind-3 64M snapshot, not MiniMind2 104M or MiniMind-3 MoE. This family guide documents the April 1, 2026 artifact without rewriting the catalog date.
  • Read Apache 2.0 terms. This is a private educational demonstrator; Python HTTPServer is not intended for production.

Exact model and requirements

Artifact:
jingyaogong / MiniMind-3 dense 64M · checkpoint jingyaogong/minimind-3
Publisher revision:
f92512d4cd6142fa9acc0d6022375049a8974bf6
Artifact digest:
sha256:3adf69402b5d22e693151cabadc12528f923c4ba6bf343738aaf13f0892162e8
Download size:
0.12 GiB
Memory requirement (unknown):
Unknown — No exact full-process peak memory evidence for this configuration.
System RAM / disk:
Unknown / Unknown
Placement:
single device. One CPU host; no tensor/pipeline sharding. Entire model on CPU; no device_map, GPU or disk offload.
KV cache:
FP32 native Qwen3 attention state matching loaded model dtype
Workload:
640 token context; Unknown; Unknown; concurrency 1; batch 1; cache unknown; repetitions Unknown.
Tokenizer:
Exact MiniMind-3 tokenizer and open_thinking chat template · f92512d4cd6142fa9acc0d6022375049a8974bf6
Sampling / reasoning:
Author-selected short-prompt sampling: temperature 0.85, top_p 0.95, top_k 0 (disabled), repetition_penalty 1.0; max_new_tokens 1–128. Temperature/top-p match native evaluation defaults; other choices explicit. open_thinking=False inserts the publisher template closed empty thinking block. No reasoning parser or tool execution.
Runtime prerequisites:
Ubuntu 24.04 x86_64; See prerequisites above.

Official artifact · License

Publisher model metadata declares Apache-2.0; official project Apache 2.0 license is archived. Retain license and required notices for redistribution, identify modifications, and review patent/NOTICE conditions. A standalone LICENSE in the model repository was not found.

  • 8 GiB host RAM and 20 GiB disk are author planning allocations, not measured minimums or fit guarantees.
  • Published file bytes and FP32 parameter arithmetic exclude caches, buffers, framework, dependencies and OS. Exact process peak is unknown.

One-time setup and hardware

hardware
Not applicable — AWS hardware acquisition is included in compute rental; no purchased GPU required. Any separate hardware cost is not applicable.
AWS hardware acquisition is included in compute rental; no purchased GPU required. Any separate hardware cost is not applicable. Tax: unknown.
setup
Unknown — Initial provisioning/build time and labor cost are unknown.
Initial provisioning/build time and labor cost are unknown. Tax: unknown.

Recurring costs

compute
$0.18 / hour
AWS published US East (N. Virginia) Linux On-Demand quote, no preinstalled paid software. USD 0.1785 per billed instance hour; eight hours USD 1.428 compute, 24 hours USD 4.284. Storage, egress, tax and administration additional. No reservation, Spot or discount assumed. Idle running hours bill. Capacity and quotas unverified. Region: us-east-1. SKU: c7i.xlarge Linux On-Demand. Tax: excluded. Price dated Oct 15, 2026. Price source
storage
$0.08 / GB month
US East (N. Virginia) gp3 storage USD 0.08 per GB-month; AWS page defines GB as 1024^3 bytes. A 20 GiB root volume is USD 1.60 per full month, prorated by provisioned duration; baseline 3000 IOPS and 125 MB/s with no provisioned extras. Snapshots and other retained resources bill separately. Storage persists after instance stop; taxes excluded. Region: us-east-1. SKU: EBS gp3 baseline 3000 IOPS / 125 MB/s. Tax: excluded. Price dated Oct 16, 2026. Price source
egress
Unknown — Data transfer price, allowances and traffic volume are unknown.
Data transfer price, allowances and traffic volume are unknown. Tax: unknown.
administration
Unknown — Maintenance labor rate and hours are unknown.
Maintenance labor rate and hours are unknown. Tax: unknown.

Install the runtime

  1. 1. Create the Python 3.12 CPU environment

    Install the exact official CPU wheel by hash and Transformers version. System and transitive package versions resolve at installation; save the resulting environment. This is not an executed compatibility claim.

    Command
    sudo apt-get update
    sudo apt-get install -y python3.12 python3.12-venv curl ca-certificates openssl
    mkdir -p "$HOME/minimind3-hosting/minimind-3"
    cd "$HOME/minimind3-hosting"
    python3.12 -m venv .venv
    .venv/bin/python -m pip install "https://download.pytorch.org/whl/cpu/torch-2.6.0%2Bcpu-cp312-cp312-linux_x86_64.whl#sha256=59e78aa0c690f70734e42670036d6b541930b8eabbaa18d94e090abf14cc4d91"
    .venv/bin/python -m pip install "transformers==4.57.6"
    .venv/bin/python -m pip check
    .venv/bin/python -m pip freeze > resolved-environment.txt

    Expected result: pip check succeeds; resolved-environment.txt records actual installed versions. Stop on resolver or hash errors.

Download the model

  1. 1. Fetch and verify the complete inference snapshot

    Download six pinned inference files, including tokenizer and separate chat template. Weight hash is publisher LFS metadata; small-file hashes are archived byte hashes. No custom remote code is loaded.

    Command
    cd "$HOME/minimind3-hosting"
    curl --fail --location --output minimind-3/config.json 'https://huggingface.co/jingyaogong/minimind-3/resolve/f92512d4cd6142fa9acc0d6022375049a8974bf6/config.json'
    curl --fail --location --output minimind-3/generation_config.json 'https://huggingface.co/jingyaogong/minimind-3/resolve/f92512d4cd6142fa9acc0d6022375049a8974bf6/generation_config.json'
    curl --fail --location --output minimind-3/tokenizer.json 'https://huggingface.co/jingyaogong/minimind-3/resolve/f92512d4cd6142fa9acc0d6022375049a8974bf6/tokenizer.json'
    curl --fail --location --output minimind-3/tokenizer_config.json 'https://huggingface.co/jingyaogong/minimind-3/resolve/f92512d4cd6142fa9acc0d6022375049a8974bf6/tokenizer_config.json'
    curl --fail --location --output minimind-3/chat_template.jinja 'https://huggingface.co/jingyaogong/minimind-3/resolve/f92512d4cd6142fa9acc0d6022375049a8974bf6/chat_template.jinja'
    curl --fail --location --output minimind-3/model.safetensors 'https://huggingface.co/jingyaogong/minimind-3/resolve/f92512d4cd6142fa9acc0d6022375049a8974bf6/model.safetensors'
    cat > snapshot.sha256 <<'HASHES'
    efcfa39ede9bbb5b64ded2bb90969e4b840f0f9e1e36725d386acb7eca1c6d05  minimind-3/config.json
    3ee3cbe9acb55059b37a4e90bb843812eb86f70c5ebea404f137cd9c80127870  minimind-3/generation_config.json
    71f32c68cf63a15355a8fc171b7594b3d41870fe0ddb54fc6aefa55f73a4a668  minimind-3/tokenizer.json
    04ae7620b9cf93fd2d6fbf94936b0c3c4be65f30cd6ef6fa8741baac986525d1  minimind-3/tokenizer_config.json
    97c6a9ef3f8d35044f435bb7773f1af160a7328ab6e8d2e9d67702941320a711  minimind-3/chat_template.jinja
    3adf69402b5d22e693151cabadc12528f923c4ba6bf343738aaf13f0892162e8  minimind-3/model.safetensors
    HASHES
    sha256sum --check snapshot.sha256

    Expected result: All six SHA-256 checks report OK. Stop on any mismatch.

Configure

  1. 1. Write the private reader-authored bounded server

    This code is an OpenTools-authored prescription using official APIs, not publisher server code. It preserves an existing service key. Single-process HTTPServer binds loopback, authenticates health and inference, accepts only prompt plus max_new_tokens, caps body at 8,192 bytes, rendered input at 512 tokens, output at 128 and combined tokens at 640. No streaming or OpenAI compatibility.

    Command
    cd "$HOME/minimind3-hosting"
    umask 077
    if [ ! -e .api-key ]; then openssl rand -hex 32 > .api-key; fi
    test -s .api-key || { echo 'Restore empty service key before proceeding'; exit 1; }
    chmod 600 .api-key
    cat > reader-server.py <<'PYTHON'
    """OpenTools reader-authored educational demonstrator; not publisher server."""
    import hmac,json,os
    from http.server import BaseHTTPRequestHandler,HTTPServer
    
    def check_budget(count,limit):
        if count>512 or count+limit>640: raise ValueError('token_budget')
    
    def handler_factory(generate,key):
        class Handler(BaseHTTPRequestHandler):
            protocol_version='HTTP/1.0'
            def setup(self):
                super().setup(); self.connection.settimeout(10)
            def log_message(self,*args): pass
            def reply(self,status,data):
                body=json.dumps(data,ensure_ascii=False).encode()
                self.send_response(status); self.send_header('Content-Type','application/json; charset=utf-8')
                self.send_header('Content-Length',str(len(body))); self.end_headers(); self.wfile.write(body)
            def authorized(self):
                value=self.headers.get('Authorization','').encode()
                return hmac.compare_digest(value,('Bearer '+key).encode())
            def do_GET(self):
                if not self.authorized(): return self.reply(401,{'error':'unauthorized'})
                if self.path!='/health': return self.reply(404,{'error':'not_found'})
                self.reply(200,{'status':'ready'})
            def do_POST(self):
                if not self.authorized(): return self.reply(401,{'error':'unauthorized'})
                if self.path!='/v1/minimind': return self.reply(404,{'error':'not_found'})
                if self.headers.get('Transfer-Encoding') is not None: return self.reply(400,{'error':'transfer_encoding_unsupported'})
                if self.headers.get_content_type()!='application/json': return self.reply(415,{'error':'json_required'})
                lengths=self.headers.get_all('Content-Length',[])
                if len(lengths)!=1 or not lengths[0] or not all('0'<=c<='9' for c in lengths[0]): return self.reply(411,{'error':'content_length_required'})
                if len(lengths[0])>4: return self.reply(413,{'error':'body_limit'})
                n=int(lengths[0])
                if not 1<=n<=8192: return self.reply(413,{'error':'body_limit'})
                try:
                    raw=self.rfile.read(n)
                    if len(raw)!=n: return self.reply(400,{'error':'incomplete_body'})
                    data=json.loads(raw)
                except (ValueError,UnicodeError,TimeoutError): return self.reply(400,{'error':'invalid_json'})
                if type(data)!=dict or set(data)!={'prompt','max_new_tokens'} or type(data['prompt'])!=str or not data['prompt'].strip() or type(data['max_new_tokens'])!=int or not 1<=data['max_new_tokens']<=128:
                    return self.reply(400,{'error':'invalid_fields'})
                try: result=generate(data['prompt'],data['max_new_tokens'])
                except ValueError: return self.reply(422,{'error':'token_budget'})
                except Exception: return self.reply(500,{'error':'generation_failed'})
                self.reply(200,result)
        return Handler
    
    def main():
        import torch
        from transformers import AutoTokenizer,AutoModelForCausalLM
        key=open('.api-key',encoding='ascii').read().strip()
        if len(key)!=64 or any(c not in '0123456789abcdef' for c in key): raise SystemExit('Invalid service key')
        torch.set_num_threads(4)
        tok=AutoTokenizer.from_pretrained('./minimind-3',local_files_only=True,trust_remote_code=False)
        model=AutoModelForCausalLM.from_pretrained('./minimind-3',local_files_only=True,trust_remote_code=False,dtype=torch.float32).to('cpu').eval()
        def generate(prompt,limit):
            ids=tok.apply_chat_template([{'role':'user','content':prompt}],tokenize=True,add_generation_prompt=True,open_thinking=False,return_tensors='pt')
            count=ids.shape[-1]
            check_budget(count,limit)
            with torch.inference_mode():
                out=model.generate(ids,attention_mask=torch.ones_like(ids),max_new_tokens=limit,do_sample=True,temperature=0.85,top_p=0.95,top_k=0,repetition_penalty=1.0,pad_token_id=tok.eos_token_id)
            new=out[0,count:]
            return {'text':tok.decode(new,skip_special_tokens=True),'input_tokens':count,'output_tokens':len(new)}
        HTTPServer(('127.0.0.1',8998),handler_factory(generate,key)).serve_forever()
    if __name__=='__main__': main()
    PYTHON
    .venv/bin/python -m py_compile reader-server.py

    Expected result: Python syntax check succeeds; service key is private and never printed.

Start the model

  1. 1. Start the CPU learning service

    Use one foreground process. Torch uses four CPU threads; load FP32 explicitly rather than native project FP16. No truncation silently changes a prompt. Requests run sequentially; this is not a hardened multitenant service.

    Command
    cd "$HOME/minimind3-hosting"
    HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 .venv/bin/python reader-server.py

    Expected result: After snapshot load, loopback port 8998 accepts authenticated health requests. Startup may fail until environment compatibility is verified.

Connect to your endpoint

http://127.0.0.1:8998/v1/minimind

Server loopback only; use SSH local forwarding for an operator client.

Access: loopback. Use the private Bearer key for health and generation. Send a JSON object with prompt as a string and max_new_tokens as an integer. The response contains text, input_tokens and output_tokens. This educational endpoint uses the documented custom schema.

Verify the setup

  1. 1. Check authentication and a short Chinese prompt

    Run on the same host in another terminal. The prompt follows the native educational Chinese chat use. Expect a nonempty text field, then inspect accuracy yourself; 64M capacity does not establish reliable factual or English summarization ability.

    Command
    cd "$HOME/minimind3-hosting"
    MINIMIND_SERVICE_KEY="$(cat .api-key)"
    curl --fail http://127.0.0.1:8998/health -H "Authorization: Bearer $MINIMIND_SERVICE_KEY"
    curl --fail http://127.0.0.1:8998/v1/minimind -H "Authorization: Bearer $MINIMIND_SERVICE_KEY" -H 'Content-Type: application/json' -d '{"prompt":"请介绍一下自己。","max_new_tokens":128}'
    curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8998/health
    unset MINIMIND_SERVICE_KEY

    Expected result: Authorized health returns ready; generation returns text/input_tokens/output_tokens; missing key returns 401. A nonempty answer is only a smoke check.

  2. 2. Connect through private SSH forwarding

    On your trusted client, replace the SSH target with your own instance. Keep the tunnel foreground; run the same authenticated requests through localhost. Copy the service key only over your trusted SSH channel; never publish it.

    Command
    ssh -N -L 8998:127.0.0.1:8998 ubuntu@YOUR_INSTANCE_ADDRESS

    Expected result: Client localhost:8998 reaches instance loopback while tunnel is active.

Performance evidence

No compatible measurement available. Documented support and estimated memory do not establish response speed.

Limits and troubleshooting

  • Documented source support only: no weights, installation or inference executed by this author. No measured fit, speed, latency or answer-quality evidence.
  • Dense MiniMind-3 has 63,912,192 parameters. MiniMind2 104M and the 198M-total/64M-active MoE are distinct variants.
  • Native config advertises 32,768 positions; this deliberate educational workload enforces 640 combined tokens and a single user string, with no history, tools or multimodal input.
  • FP32 loading is an author choice distinct from the native evaluation and API FP16 path. Published F16 file size is not process RAM.
  • The server is reader-authored private demonstration code, not publisher code or a production API. Loopback authentication does not protect against privileged local users; no TLS or multi-user isolation.
  • HTTP errors: 401 authentication; 404 route; 411 missing/ambiguous length; 413 body bound; 415 content type; 400 JSON/fields/transfer encoding; 422 token budget; 500 generic generation failure. Other HTTP methods receive BaseHTTPRequestHandler 501.
  • Transitive dependencies and apt packages are not fully locked; save actual environment and verify on the selected host. Source metadata and stub tests do not prove model execution.
  • Full family coverage is not final; training, fine-tuning and other variants are outside this specific guide.
Load or package failure
Check Python 3.12 x86_64, exact CPU wheel digest, Transformers 4.57.6 and all six snapshot hashes. Do not silently swap an older model or enable remote code.
HTTP 401 or connection refused
Check same-host loopback, foreground startup logs and matching .api-key. Check your SSH tunnel; keep port 8998 closed publicly.
HTTP 400/411/413/415/422
Send only prompt and integer max_new_tokens (1–128), application/json with a single length, at most 8,192 bytes. Shorten the prompt to fit 512 rendered tokens and 640 combined tokens; never disable bounds.
Empty or poor answer
Confirm exact tokenizer/template and open_thinking=False; simplify the Chinese prompt. Inspect generated content manually. Small educational model quality is unknown.
Memory pressure or stalled generation
Stop the foreground service; inspect OS memory and process logs. Allocate more resources or change workload explicitly; no fit or response-time guarantee is available.

Stop the model

  1. 1. Stop the service

    Press Ctrl+C in the foreground server terminal. Confirm port 8998 stops responding.

    Command
    unset MINIMIND_SERVICE_KEY

    Expected result: Service exits; shell key variable removed.

Uninstall

  1. 1. Remove dedicated files

    Back up wanted logs first and verify the exact dedicated path. Shared apt packages remain.

    Command
    rm -r -- "$HOME/minimind3-hosting"

    Expected result: Dedicated snapshot, venv, wrapper and private credential removed.

Shut down cloud resources

  1. 1. End cloud billing resources

    In EC2 us-east-1, stop for later reuse or terminate this exact VM. Review Delete on termination for its root volume. Delete unwanted detached EBS volumes, snapshots and reserved/Elastic/public IP resources. Stopped VM storage and retained resources may still bill. Check Bills/Cost Explorer later for final usage.

    Expected result: Exact instance is stopped/terminated as intended; no unwanted attached/retained billed resources remain. Instance compute stops only after its lifecycle transition, not when the Python service stops.

Sources and verification

Sources checked Oct 16, 2026. Verification source

Related guides

Compare this configuration

Pricing and access

Open-source project; API pricing is not applicable unless a downstream host adds serving costs.

Jingyao Gong logo
Jingyao Gongopen source

Open-source AI project maintainer

Founded 2026Not publicly specified
View full profile