After training the shared basisDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/facebookresearch/LoRe/llms.txt
Use this file to discover all available pages before exploring further.
V, a key question is how quickly a brand-new user can be personalized with only a handful of preference examples. vary_fewshot.py answers this by sweeping over a range of shot counts, re-running few-shot weight learning for each count across multiple random trials, and reporting mean and standard deviation of accuracy. The result is a learning curve that reveals both the adaptation speed (low shots) and the ceiling accuracy (high shots) for each basis rank K.
Which datasets support vary_fewshot.py
RedditTLDR
RedditTLDR/vary_fewshot.py — standalone script with its own embedding loading and user split logic. Sweeps shots from 5 to 50, 20 trials each.PRISM / PersonalLLM
Neither PRISM nor PersonalLLM has a
vary_fewshot.py. Their few-shot evaluation runs inside train_basis.py using fixed shot counts.run_few_shot_vary_shots
The core function lives inutils.py:
sample_shots
Random shot sampling is done without replacement by shuffling and truncating each user’s tensor:train_features_unseen is a [M, hidden_dim] tensor for one user. The function returns a list of [shots, hidden_dim] tensors.
RedditTLDR vary_fewshot configuration
The RedditTLDR
vary_fewshot.py fixes K=5 (the highest rank from
train_basis.py) and sweeps shots from 5 to 50 in steps of 5. To compare
multiple ranks, extend K_list.Running the script
vary_fewshot.py loads the reward model at startup to extract V_final. Make sure
prepare.py has already been run and tldr_embeddings_train.pkl / tldr_embeddings_val.pkl
exist in the RedditTLDR/ directory before executing.Interpreting results
| Metric | Meaning |
|---|---|
few_shot_train_accuracies_few_shot_means | Accuracy on the shot examples themselves — measures overfitting to few-shot data |
unseen_user_unseen_prompts_accuracies_few_shot_means | Accuracy on held-out test prompts — the true personalization metric |
- Higher
K→ higher ceiling: a richer basis captures more preference diversity, so the accuracy on unseen prompts improves asKgrows — provided enough shots are available. - Lower shots → faster convergence with LoRe: even with 5–10 shots, a well-trained
K≥2basis outperformsK=1(BT) because users only need to locate themselves within the pre-learned preference space. K=0andK=1are flat:W_few_shotis forced to a constant[1.0]tensor for these cases, so shot count has no effect.