# localai-org/kimodo.cpp — AlpLab Radar Static Code Audit

- Ring: `trial`
- Category: `ai-models`
- Overall score: `3.7/5`
- Implementation check: `verified`
- Maturity: `early`
- Audited commit: `75ed52d2d3ec` (read-only; nothing from the repository was executed)
- Reviewed at: 2026-12-01T20:26:55Z
- Repository: https://github.com/localai-org/kimodo.cpp
- Radar entry: https://radar.alplab.co/#repo/localai-org/kimodo.cpp
- License: `Apache-2.0`
- Tags: `ggml`, `text-to-motion`, `diffusion`, `vulkan`, `gguf`, `llm2vec`

## Summary

A C++23/GGML (CPU+Vulkan) reimplementation of NVIDIA's Kimodo text-to-motion diffusion model: hardened GGUF loading, a Llama-3/LLM2Vec text encoder with byte-BPE tokenizer, two-stage transformer denoiser with DDIM sampling, conditioned multi-prompt sequencing, C ABI, CLI, and a Go web demo exporting animated GLB.

## Implementation Check

Every README capability I traced exists in working code — DDIM (src/diffusion.cpp make_cosine_schedule/ddim_step), two-stage denoiser (src/denoiser.cpp run_two_stage_denoiser), conditioned transitions (src/sequence.cpp sample_motion_sequence_from_noise), quantization (src/quantize_text.cpp), GLB export (demo/main.go writeSkeletonGLB), C API (src/capi.cpp) — and the README explicitly lists what is not implemented (77-joint SOMA expansion, skinned-mesh GLB), which matches the code.

## When to Use

Use it when you need local, GPU-or-CPU text-to-motion inference (SMPL-X/SOMA/G1 skeletons) for games, robotics, or animation pipelines and can handle C++23+CMake 3.25 builds plus multi-GB HF-hosted weights. Not for users wanting a turnkey product: there is no auth on the demo API, no CI, and outputs are joint rotations/root translations rather than skinned characters.

## Sub-scores

| Dimension | Score |
|---|---|
| quality | 4.0/5 |
| usability | 3.5/5 |
| reliability | 3.0/5 |
| security | 4.0/5 |
| integration | 4.0/5 |

## Code Evidence

src/model.cpp model::generate_embedding validates frames/steps/CFG finiteness and drives sample_motion_from_noise → decode_motion with a mutex-serialized, deferred-weight-load path; src/denoiser.cpp implements the 16-layer root/body transformers with explicit F32-precision mul_mat (ggml_mul_mat_set_prec(GGML_PREC_F32)) and a cached-graph path (transformer_cache, cache_graph) keyed on batch/frames/layer_chunk; src/llm_text_encoder.cpp implements the monolithic-or-component LLM2Vec encoder with packed LoRA projections (packed_low_rank), resident-32-layer mode gated by KIMODO_TEXT_LAYER_CHUNK/KIMODO_TEXT_RESIDENT_LIMIT_MIB, and mean-pooling over non-BOS tokens; src/llm_tokenizer.cpp is a from-scratch Llama-3 byte-BPE with strict UTF-8 validation (valid_utf8 rejects overlong/surrogate/>U+10FFFF) and merge-rank BPE; src/gguf.cpp read_gguf_header treats GGUF as hostile input (count limits, array-metadata rejection, offset/overflow checks, truncation detection) and validate_motion_gguf pins architecture, skeleton, dims, and the exact 414-tensor layout; src/capi.cpp is a full exception firewall (try/catch on every entry point, size-checked option structs); demo/main.go serializes generation through a persistent kmd-generate --server worker (startGeneratorSession/generate), guards file serving with safePathPart, and writeSkeletonGLB emits node-hierarchy-only glTF 2.0; scripts/download_gguf_weights.py verifies size+SHA-256 against a published MANIFEST.json before use; tests/root_parity.cpp and tests/llm_text_session_parity.cpp are real parity harnesses wired as ctest cases with CPU and Vulkan variants in CMakeLists.txt; fuzz/gguf_fuzz.cpp targets the parser under libFuzzer/ASan/UBSan.

## Issues Found

No CI configuration exists despite ~20 ctest targets and Python/Go tests, so the substantial parity suite never runs automatically; demo/main.go /api/generate leaks an empty reason when the model key is unknown (`model.Reason` on the zero-value motionModel in the not-available error path) and the API has no authentication, while docker-compose.yml publishes 0.0.0.0:8094 to the host (documented as needing your own TLS/access control); text/constraint CFG weights are hardcoded to 2.0 in src/generate.cpp rather than exposed through the demo protocol.

## Key Risks

The standard suite (kimodo-root-parity, llm-text-session, denoiser-runtime, capi positive path) requires locally downloaded multi-GB motion GGUFs, the text bundle, and captured fixtures, so the core numerical path cannot be verified without them; no CI workflows exist in the tree, so tests were never observed to pass; the Vulkan F32-parity path depends on pinned GGML submodule behavior (GGML_REF 8c63e709... in Dockerfile) and env-driven knobs (KIMODO_BACKEND, KIMODO_TEXT_LAYER_CHUNK) that are runtime-tunable; only three skeleton layouts are supported and the SMPL-X checkpoint is deliberately excluded from redistribution due to its NVIDIA internal-R&D license; demo performance claims (VRAM ceilings, timing) come from docs/benchmarks I could not reproduce statically.

## Reviewed Files

- `README.md`
- `CMakeLists.txt`
- `go.mod`
- `.gitmodules`
- `Dockerfile`
- `docker-compose.yml`
- `docker/entrypoint.sh`
- `include/kimodo/kimodo_capi.h`
- `src/capi.cpp`
- `src/model.cpp`
- `src/denoiser.cpp`
- `src/diffusion.cpp`
- `src/sequence.cpp`
- `src/gguf.cpp`
- `src/ggml_weights.cpp`
- `src/motion_decode.cpp`
- `src/motion_graph_cache.hpp`
- `src/skeleton.hpp`
- `src/llm_text_encoder.cpp`
- `src/llm_tokenizer.cpp`
- `src/quantize_text.cpp`
- `src/generate.cpp`
- `demo/main.go`
- `demo/main_test.go`
- `demo/skeletons_extra.go`
- `scripts/download_gguf_weights.py`
- `scripts/download_gguf_weights.sh`
- `scripts/publish_gguf.py`
- `tests/capi_test.cpp`
- `tests/root_parity.cpp`
- `tests/llm_tokenizer_test.cpp`
- `tests/llm_embedding_parity.cpp`
- `tests/docker_entrypoint_test.py`
- `tests/converter_test.py`
- `tests/quantization_metrics_test.py`
- `fuzz/gguf_fuzz.cpp`
