taurusduan's picture
Duplicate from pfeifferj/DeepSeek-V4.1-Flash-GSQ-RCO-GGUF
0b10848
|
Raw
History Blame Contribute Delete
4.92 kB

Reproduce the DeepSeek evaluation

Build the runtime and scorer, then prepare a workspace for the tokenizer checks, MMLU-Pro evaluation, PPL and chat diagnostics.

Python environment

Use Python 3.12 and the dependencies pinned in requirements-minimal.txt. The oracle uses CPU PyTorch 2.14.0+cpu. The C++ runtime requires a CUDA toolkit and a compatible NVIDIA driver. The native build commands below require CMake 3.24 or newer and CUDA 11.6 or newer.

From the model repository root:

cd runtime
python3.12 -m venv .venv
.venv/bin/python -m pip install --index-url https://download.pytorch.org/whl/cpu 'torch==2.14.0+cpu'
.venv/bin/python -m pip install -r requirements-minimal.txt
export NLTK_DATA="$PWD/nltk_data"

The included English Punkt/Punkt-tab resources are in nltk_data; their hashes and sources are in nltk-resources.json.

official-source/manifest.json pins the tokenizer, encoder, reference model/Engram equations and supporting files to deepseek-ai/DeepSeek-V4.1-Flash revision dba1be0a40aa45a94ad051997016db3960a90277, with sizes, SHA256 hashes and source URLs. Original model shards are not included.

Build from the retained archive

From runtime/:

mkdir llama-deepseek41
tar -xzf deepseek-runtime-base-source.tar.gz -C llama-deepseek41
git -C llama-deepseek41 apply ../deepseek-runtime.patch
git -C llama-deepseek41 apply ../deepseek-perplexity-sidecar.patch
cmake -S llama-deepseek41 -B llama-deepseek41/build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=native
cmake --build llama-deepseek41/build --target llama-server llama-perplexity -j 24
bash build_helpers.sh ./llama-deepseek41 ./bin

native targets the CUDA devices visible during the build. Replace it with the target CUDA architecture when building for another machine. provenance.json records the source archive and patch hashes; helper-build-validation.json records the helper source and binary hashes.

Fresh diagnostic workspace

The helper creates a new directory, links the inputs and binaries, and copies the diagnostic driver with its ROOT path set to the workspace. --check-request-plan checks all 24 encoded requests against the supplied request plan without loading the model.

Still from runtime/:

.venv/bin/python prepare_replay_workspace.py \
  --workspace "$PWD/replay" \
  --runtime-checkout "$PWD/llama-deepseek41" \
  --helper-dir "$PWD/bin" \
  --model "$PWD/../DeepSeek-V4.1-Flash-GSQ-RCO-3.0bit.gguf" \
  --check-request-plan

Before inference, download the model at repository revision 100f4d51b43805557945f94b73a7f9b667948a7b and verify SHA256 11f46543370256ef616b6e458b6950e148625b5f8b7545173d124445d3393c53. Allow CPU memory for the approximately 209 GB Engram mapping and sufficient GPU memory for the backbone.

Set DEEPSEEK_CUDA_DEVICES to the comma-separated device IDs to use for scoring and capture. In replay/deepseek-run-diagnostics.relocated.py, set both CUDA_VISIBLE_DEVICES in the ENV assignment and the device string in the first replicas entry to that same list. These assignments override the shell's device selection. Keep the default single replica and the F32 GEMM/cache settings with flash attention disabled. The driver uses loopback port 8093.

Run the prerequisite checks:

  1. Run bin/dump-deepseek-vocab MODEL NATIVE_DUMP and .venv/bin/python verify_vocab.py official-source/tokenizer.json NATIVE_DUMP replay/results/deepseek-vocab-parity.json, replacing MODEL and NATIVE_DUMP with the model and output paths.
  2. Run .venv/bin/python test_reference_components.py replay to check tokenizer mapping, Engram/history constants and candidate-mask behavior.
  3. Run bin/capture-deepseek-serial MODEL replay/results/deepseek-capture-few-ref-f32kv 'The capital of France is' 128 128 with CUDA_VISIBLE_DEVICES="$DEEPSEEK_CUDA_DEVICES", NVIDIA_TF32_OVERRIDE=0, GGML_CUDA_MMF_F32_DISABLE=1, GGML_CUDA_REFERENCE_F32=1, DEEPSEEK_CAPTURE_NO_FLASH=1, and DEEPSEEK_CAPTURE_F32_KV=1. Unset DEEPSEEK_CAPTURE_SERIAL for full prefill. Run the independent oracle comparison on that capture.
  4. Run the raw MMLU command with -o replay/results/deepseek3.0-f32.tsv, first adding --preflight to check the tokenizer and context bounds. Then run .venv/bin/python ../eval/2026-09-13/analyze_mmlu.py --config replay/mmlu-analysis-config.json --output-prefix replay/results/mmlu-analysis to validate the 2,000 rows.

Then run .venv/bin/python replay/deepseek-run-diagnostics.relocated.py without additional flags. It checks serial decoding against the prefill, evaluates eight PPL contexts, saves the native cache and lossless F32 sidecar, and runs the 24 chat items. Results and raw responses are written to replay/results/diagnostics/; the metadata records the driver hash and numerical settings.