feat(llm): add P2P model config file delivery from workers to frontends#3
Closed
Kaonael wants to merge 1 commit into
Closed
feat(llm): add P2P model config file delivery from workers to frontends#3Kaonael wants to merge 1 commit into
Kaonael wants to merge 1 commit into
Conversation
Workers register a "model-config" AsyncEngine endpoint alongside inference endpoints. Frontends discover it through standard discovery and download config files directly from any available worker over the request plane (HTTP, TCP, or NATS). Download priority chain: 1. Local HF cache (instant, no network) 2. ModelExpress server (no hidden HF fallback) 3. P2P from any available worker (parallel downloads, atomic writes) 4. Direct HuggingFace download (last resort) This enables private models that aren't on HuggingFace without requiring shared filesystems or manual file copying. Key implementation details: - Split hub::from_hf() into individual steps for fine-grained fallback - P2pConfigDownloader trait decouples model_card from discovery internals - Blake3 checksum verification after P2P download - Atomic writes (temp file + rename) for concurrent safety - String-based response to avoid Vec<u8> JSON serialization blowup Signed-off-by: Nikita Sukharev <kaonael@gmail.com>
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
|
This PR has been closed due to inactivity. If you believe this PR is still relevant, please feel free to reopen it with additional context or information. |
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.
Overview:
Add P2P model config file delivery from workers to frontends. Workers automatically serve config files (config.json, tokenizer.json, etc.) over the request plane. Frontends
discover and download them from any available worker before falling back to HuggingFace. Enables private models without shared filesystems.
Details:
Problem: Frontends need model config files for preprocessing. The only paths were HuggingFace and ModelExpress — breaking for private/custom models not on HF.
Solution: Workers register a
model-configAsyncEngine endpoint alongside inference endpoints. Frontends discover it through standard discovery and download files directlyover the current request plane (HTTP, TCP, or NATS).
Download priority chain (new):
Implementation:
config_endpoint.rs(new) —ModelConfigEngine, request/response types,P2pConfigDownloadertraithub.rs— splitfrom_hf()intoget_cached_model_path(),try_model_express_server(),mx_download_direct()for fine-grained fallback controlmodel_card.rs—download_config()orchestrates the 4-step chain; newconfig_filenames(),verify_local_checksums(),checked_file()accessorswatcher.rs—WatcherP2pDownloaderimplementsP2pConfigDownloaderwith parallel downloads and atomic writes (temp file + rename)local_model.rs— registersmodel-configendpoint inattach()checked_file.rs—filename()method,update_dir()refactored to use itSafety:
../etc/passwd→passwd)String-based response avoidsVec<u8>JSON serialization blowup (4-7x)Docs updated:
frontend/README.md— download fallback chainfrontend/configuration.md— new "Model Config File Delivery" sectiondiscovery-plane.md— new "Model Config Endpoint" sectionTests:
checked_file.rs—filename()from paths/URLs,update_dir()conversionconfig_endpoint.rs— engine file serving, path traversal, serde round-trip, cache dir uniquenessmodel_card.rs—config_filenames(),verify_local_checksums()on valid and tampered filesWhere should the reviewer start?
lib/llm/src/config_endpoint.rs— new file, core types and enginelib/llm/src/model_card.rs:537-598—download_config()4-step fallback chainlib/llm/src/hub.rs:149-175—try_model_express_server()usingrequest_model_with_provider(not_and_fallback)lib/llm/src/discovery/watcher.rs:832-931—WatcherP2pDownloaderwith parallel downloads and atomic writes