llama.cpp was aligning GGUF tensor data from byte 0 of the file, silently corrupting embedded models
PR #28993, merged 2026-09-17T07:19Z, fixes `gguf_init_from_file_ptr()` reading from the current file position but aligning the data section from offset 0, so a GGUF stored at an unaligned offset inside a larger file (an Android APK asset, for example) loaded without error and returned wrong tensor data. The reader now aligns from where the GGUF actually starts, which means embedded models need no new API: `fseek` to the GGUF then call `llama_model_load_from_file_ptr()`. The PR also adds `llama_adapter_lora_init_from_file_ptr()`, turns mmap off with a warning instead of a ggml assert when data is not at a 32-byte offset, and adds a `test-gguf` file_offset mode that writes 7 junk bytes ahead of the GGUF and fails without the fix.
Source
↳ Follow the thread