atlasleong/mythos-fast-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

mythos_fast — Ascend NPU (npu:3) deterministic inference

Model introduction

Shadow0482/mythos_fast is a tool-use / agentic fine-tune of WeiboAI/VibeThinker-3B, a 3B-parameter Qwen2-family language model, distributed as a GGUF checkpoint (VibeThinker-3B.BF16.gguf, llama.cpp Qwen2 architecture, mostly BF16). It was fine-tuned on roughly two million multi-step tool-call, function-calling and agent-style reasoning traces, then converted to GGUF for efficient local inference.

This delivery adapts the model for a complete real Ascend NPU inference candidate using torch_npu. The full 6.18 GB GGUF is deserialized with a pure-Python GGUF reader (no llama.cpp), mapped 1:1 onto an exact Qwen2ForCausalLM topology (transformers), strictly loaded, moved to the physical Ascend device npu:3, and executed as a deterministic greedy token inference wholly on the NPU. CPU is used only to orchestrate / hash / deserialize / preprocess; no neural forward ever runs on CPU.

Model and source identity

FieldValue
Model IDShadow0482/mythos_fast
Pinned source revision90260024505a7104e01688294206f55a5ffa8b75
Base modelWeiboAI/VibeThinker-3B
ArchitectureQwen2ForCausalLM (36 layers, hidden 2048, 16 heads, 2 KV heads, vocab 151936)
Checkpoint fileVibeThinker-3B.BF16.gguf
Checkpoint size6,178,316,672 bytes
Checkpoint SHA2567f72725092675557075637688220309f0c08d1aa3ab7386810358dd3ceb18966
GGUF general.file_type32 (MOSTLY_BF16)
pipeline_tagreinforcement-learning
library_namegguf (derived from the card's own gguf / llama.cpp tags)

License: the upstream model card at the pinned revision declares no license (Hugging Face API returns license: null, and the source repo contains no LICENSE file). This repository therefore records the AtomGit front-matter license value as other (a valid AtomGit token) — it does not guess or attribute a license on the model's behalf. The GGUF format is documented under the GGML repository (MIT), and the Qwen2 reference architecture used here is the Apache-2.0 transformers implementation.

Repository contents

inference.py          Complete GGUF -> torch_npu inference (the only entry point)
requirements.txt      Pinned runtime dependencies (Aliyun-only)
README.md             This document
readme.md             Byte-identical copy of README.md
SHA256SUMS            SHA-256 checksums of every published file
logs/npu_inference.log  Sanitized raw run log
logs/npu_result.json    Machine-readable result (acceptance contract)
assets/agent_workflow.png         Workflow diagram (real run data)
assets/npu_device_call.png        npu-smi PID-on-npu:3 evidence
assets/model_result.png           Real model output summary
assets/modelagent_live_session.png Real final log transcript

The published file set excludes .venv, __pycache__, credentials, temporary files, and downloaded checkpoint bytes.

Environment dependencies

The container image already ships the CANN-matched Ascend runtime. Verified in the final run:

PackageVersion
Python3.11.14
torch2.9.0+cpu
torch_npu2.9.0
CANN8.5.1
transformers4.57.1
tokenizers0.22.2
numpy1.26.4
NPU hardwareAscend910B4-1 (physical device index 3)

Hard policy: torch==2.9.0+cpu and torch_npu==2.9.0 are pre-installed and must never be replaced from PyPI — torch_npu must match the installed CANN toolkit.

Exact Aliyun-only install steps

Only non-torch dependencies are installed, and only from the configured Aliyun mirror:

cd /work/pipeline/jobs/rl26/mythos-fast/mythos-fast-npu

# (optional) make sure the Ascend runtime environment is on PATH
source /usr/local/Ascend/ascend-toolkit/set_env.sh

pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/

requirements.txt records the pre-installed torch==2.9.0+cpu and torch_npu==2.9.0 for reproducibility but does not re-install them (see the file header comment).

Inference steps

  1. Verify the NPU is visible and identify the target physical device:

    python3 -c "import torch, torch_npu; print(torch.npu.is_available(), torch.npu.device_count()); print(torch.npu.get_device_name(3))"
    # True 8
    # Ascend910B4-1
  2. (Optional but recommended) Confirm the physical device is free:

    npu-smi info -t proc-mem -i 3
  3. Run the deterministic inference on npu:3. The script verifies the checkpoint size + SHA256, deserializes all 434 GGUF tensors, builds and strictly loads the Qwen2 model, moves every parameter/buffer to npu:3, runs two identical forwards as a bit-exact determinism check, then generates --max-new-tokens tokens greedily.

    cd /work/pipeline/jobs/rl26/mythos-fast/mythos-fast-npu
    python3 inference.py --device npu:3 --hold-seconds 40
    echo "exit=$?"   # exit=0

    During the post-forward hold window the script runs npu-smi info -t proc-mem -i 3 and records the live process line whose PID equals the inference PID.

  4. Inspect the artifacts:

    cat logs/npu_inference.log   # sanitized raw log (timestamps, versions, placement, npu-smi)
    cat logs/npu_result.json     # machine-readable result
  5. Verify the acceptance contract in logs/npu_result.json: engine=torch_npu, exit_code=0, npu_available=true, npu_device_name=Ascend910B4-1, input_device=model_device=output_device=npu:3, source_revision=90260024…a8b75, a non-null meaningful output block, strict-load counts (434/434 tensors, 0 missing, 0 unexpected), versions, shapes, timing, and the inference PID.

Complete test case and output

Test command (final acceptance run, 2026-08-22):

cd /work/pipeline/jobs/rl26/mythos-fast/mythos-fast-npu
python3 inference.py --device npu:3 --hold-seconds 40

Actual output (key lines from logs/npu_inference.log, sanitized):

2026-08-22 15:00:29,089 [INFO] NPU available: True | count=8 | device=npu:3 name=Ascend910B4-1
2026-08-22 15:00:31,303 [INFO] versions: {"python": "3.11.14", "torch": "2.9.0+cpu", "torch_npu": "2.9.0", "cann": "8.5.1", "transformers": "4.57.1", "tokenizers": "0.22.2", "numpy": "1.26.4"}
2026-08-22 15:00:38,428 [INFO] SHA256 verified in 7.1s: 7f72725092675557075637688220309f0c08d1aa3ab7386810358dd3ceb18966
2026-08-22 15:00:39,036 [INFO] GGUF parsed: version=3 architecture=qwen2 tensors=434
2026-08-22 15:02:27,401 [INFO] deserialized 434 GGUF tensors (6172360704 bytes) in 10.0s -> state dict keys=435
2026-08-22 15:02:28,126 [INFO] strict load OK (assign) in 0.7s
2026-08-22 15:02:29,373 [INFO] model moved to npu:3 in 1.2s; all 435 parameters on npu:3
2026-08-22 15:02:30,172 [INFO] determinism check OK: two identical npu:3 forwards are bit-exact
2026-08-22 15:02:30,800 [INFO] logits device=npu:3 dtype=torch.float32 shape=(1, 25, 151936) absmax=5.420398 entropy=11.3267
2026-08-22 15:02:30,800 [INFO] next token: id=62761 text='_ALWAYS'
2026-08-22 15:02:30,800 [INFO] forward elapsed=0.536s | pid=1423698 | all tensors on npu:3
2026-08-22 15:02:31,331 [INFO] npu-smi proc-mem npu:3:
NPU ID                         : 3
	Chip Count                     : 1

	Process id:1423698 Process name:python3           Process memory(MB):8133
	Chip ID                        : 0
2026-08-22 15:03:11,338 [INFO] result written to /work/pipeline/jobs/rl26/mythos-fast/mythos-fast-npu/logs/npu_result.json
2026-08-22 15:03:11,338 [INFO] DONE exit_code=0

Actual output — selected fields from logs/npu_result.json:

{
  "model_id": "Shadow0482/mythos_fast",
  "engine": "torch_npu",
  "exit_code": 0,
  "npu_available": true,
  "npu_device_name": "Ascend910B4-1",
  "npu_device_index": 3,
  "source_revision": "90260024505a7104e01688294206f55a5ffa8b75",
  "input_device": "npu:3",
  "model_device": "npu:3",
  "output_device": "npu:3",
  "output": {
    "next_token_id": 62761,
    "next_token_text": "_ALWAYS",
    "logits_shape": [1, 25, 151936],
    "logits_dtype": "torch.float32",
    "logits_device": "npu:3",
    "logits_entropy": 11.3267,
    "last_token_logits_top10": [ { "token_id": 62761, "token": "_ALWAYS", "logit": 5.4204, "prob": 0.00081 }, "..." ]
  },
  "strict_load": {
    "gguf_tensor_count": 434,
    "gguf_tensors_loaded": 434,
    "gguf_tensors_unmapped": 0,
    "state_dict_keys": 435,
    "missing_after_strict_load": [],
    "unexpected_after_strict_load": []
  },
  "pid": 1423698,
  "forward_time_s": 0.5359,
  "elapsed_time_s": 162.255,
  "determinism_verified": true
}

Screenshots (rendered only from the real final logs/result)

  • assets/agent_workflow.png — GGUF → reader → Qwen2 → strict load → npu:3 → result pipeline with the real final run numbers.
  • assets/npu_device_call.png — live npu-smi process line (Process id:1423698, 8133 MB on NPU 3) and device identity Ascend910B4-1.
  • assets/model_result.png — real model output: next token _ALWAYS, top-10 logits/probabilities, logits statistics, devices, PID, strict-load counts.
  • assets/modelagent_live_session.png — the real final log transcript as captured during the ModelAgent session.

No value in any screenshot was edited; each image is rendered programmatically from logs/npu_inference.log and logs/npu_result.json.

Limitations

  • The greedy continuation is generated by a 3B base model on a generic prompt; the sample text is not fine-tuned for this exact prompt format and should not be treated as high-quality prose. It is deterministic evidence that the full forward runs on npu:3.
  • The forward is recomputed from scratch for each generated token (the source config.json sets use_cache: false); this is correct but not KV-cache optimized.
  • Model instantiation stages the architecture in float32 on CPU (~97 s) before the strict load replaces it with the GGUF BF16/F32 weights; this is orchestration, not inference.
  • The upstream model declares no license; evaluate legal/usage implications accordingly.
  • The script targets physical npu:3; running on a different host/device index requires passing the matching --device argument and, if needed, the correct --gguf/--config.

Validation summary

  • Syntax: python3 -m py_compile inference.py → OK.
  • Secret/junk scan: no credentials, no .venv, no __pycache__, no temporary files in the published set.
  • Checkpoint: size 6,178,316,672 B and SHA256 7f7272…b18966 verified on every run.
  • Closest maintained validator (AscendSkills/ai4s-migration-base/scripts/check_npu_basics.py) run twice on npu:3 → both passes.
  • Maintained delivery validator (adapting-models-for-ascend-npu/scripts/validate_delivery.py) run twice on the final payload → both passes (0 errors).
  • One last real NPU inference after all producer changes → exit code 0, PID 1423698, determinism verified, npu-smi PID correlation captured on npu:3.