feat: Add MNN_LLM and FP4_ULTRA processors#6
Open
Subaskar-S wants to merge 4 commits into
Open
Conversation
Add "llm" and "fp4_ultra" to the data_type enum in the GNUS processing schema. Regenerated all C++ headers via quicktype. - LLM: autoregressive text generation processor type - FP4_ULTRA: 4-bit NF4 quantized input processor type
…ation Implements token-by-token LLM generation within SGProcessingManager: - Parses input as space-separated token IDs - Runs MNN forward loop with dynamic sequence length - Samples via temperature + top-K + top-P nucleus sampling - Stops on EOS token or max_tokens limit - Outputs generated token IDs as raw int32 bytes - Chains SHA256 hashes per step for proof-of-work Generation parameters (maxTokens, temperature, topP, topK, eosTokenId) are read from the JSON parameters array. Registered under DataType::LLM (JSON type "llm").
Handles FP4-quantized input data (4-bit NF4 with per-macroblock scales): - Dequantizes packed nibbles + float32 scales → FLOAT32 - Runs windowed MNN inference with overlap-add stitching - Same chunking/hashing pattern as MNN_Float Data layout: [packed_nibbles: ceil(N/2) bytes][scales: num_macroblocks * 4 bytes] Macroblock size: 64x64 = 4096 elements. Registered under DataType::FP4_ULTRA (JSON type "fp4_ultra").
- Add factory registration for DataType::LLM and DataType::FP4_ULTRA - Add validation cases in CheckProcessValidity() - Uncomment FP4_ULTRA in TENSOR format validation - Add includes for new processor headers - Add new source files to CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two new processor types:
Both are registered in ProcessingManager, validated in CheckProcessValidity(), and wired into the build system.
MNN_LLM Processor
MNN_FP4Ultra Processor