Repository navigation
perplexity: opt-in worker cap and chunk-range shards for KLD - #450
Draft
khosravipasha wants to merge 1 commit into
Draft
khosravipasha wants to merge 1 commit into
khosravipasha wants to merge 1 commit into
Conversation
…s for KLD - LLAMA_PERPLEXITY_THREADS=<n> caps the per-chunk worker threads (default unchanged: every hardware thread). Same per-token math; far less lock contention on a busy node. - LLAMA_PERPLEXITY_SHARD=k/K evaluates one contiguous run of chunks, cut on whole n_seq batches. With --kl-divergence-base all shards write into one logits file at their own offsets (byte-for- byte the unsharded file); with --kl-divergence, LLAMA_KLD_DUMP saves a shard's sums and per-token values and LLAMA_KLD_MERGE=<dumps> prints the whole run's summary without a model.
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.
Two opt-in switches for
llama-perplexity. With neither set, behaviour is unchanged.What
LLAMA_PERPLEXITY_THREADS=<n>caps the worker threads that compute the per-token log-softmax and KL work. Today every chunk starts one thread per hardware thread (223 on a 224-thread node), and they all queue on one mutex per token. On a busy node that stalls badly. The per-token math is unchanged; only which thread handles which token changes.LLAMA_PERPLEXITY_SHARD=k/Kmakes a run evaluate one contiguous range of chunks, cut on wholen_seqbatches, so every decode batch is the same one the unsharded run builds.--kl-divergence-base: every shard writes its chunks at their own offset in one logits file, without truncating it. After all K shards finish, the file is byte-for-byte the unsharded one. Delete any stale file first.--kl-divergence:LLAMA_KLD_DUMP=<file>saves a shard's sums and per-token values. ThenLLAMA_KLD_MERGE=<dump0>,<dump1>,...prints the whole run's final row and summary block from the dumps, with no model loaded.Exactness (H200 node, Nov 22)
cmp, 73 GB).certify_kld.pypasses with the same values.Speed: the four KLD runs per pack, 8 × H200, 8 shards
KLD_SHARDS=K(packing draft PR: PrismML-Eng/packing#212).