-
Notifications
You must be signed in to change notification settings - Fork 38
Unfinished code #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Unfinished code #244
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
05f84d9
fix
tastelikefeet a79fb3b
fix
tastelikefeet 12471dc
fix
tastelikefeet e23c212
fix
tastelikefeet d6d4896
fix
tastelikefeet a498ca2
fix
tastelikefeet 4a8f2e8
fix
tastelikefeet dd10f2c
fix
tastelikefeet 04aaf76
fix
tastelikefeet 2e34588
wip
tastelikefeet ea932a6
wip
tastelikefeet 8896c84
fix
tastelikefeet b2442ee
wip
tastelikefeet 9cb0662
fix
tastelikefeet 5e8d6f0
fix
tastelikefeet a90e7c8
fix
tastelikefeet 79b76ba
fix
tastelikefeet 6f9787d
fix
tastelikefeet 637127b
fix
tastelikefeet 71098cc
fix
tastelikefeet 71f6868
fix
tastelikefeet 0f91fc2
fix
tastelikefeet 22b7d90
fix
tastelikefeet afbb450
wip
tastelikefeet 10aecda
wip
tastelikefeet d64d96d
wip
tastelikefeet 8879535
Merge branch 'dev' into feat/emb_utility
tastelikefeet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,7 +49,7 @@ htmlcov/ | |
| .tox/ | ||
| .coverage | ||
| .coverage.* | ||
| .cache | ||
| .cache* | ||
| nosetests.xml | ||
| coverage.xml | ||
| *.cover | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| #!/bin/bash | ||
| # RAG Ablation Suite — 串行运行全部 5 个消融实验 | ||
| # GPUs: 需要 8 卡(兼容所有配置的最大需求) | ||
| # | ||
| # 用法: | ||
| # COMPRESS_API_KEY=sk-xxx bash cookbook/exp/embedding/ablation_all.sh | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| export COMPRESS_API_KEY="${COMPRESS_API_KEY:?Set COMPRESS_API_KEY}" | ||
|
|
||
| SCRIPT="cookbook/exp/embedding/eval_gpqa_rag.py" | ||
| N=500 | ||
| SEED=100 | ||
| SIM=0.6 | ||
| TOPK=1 | ||
| OUTDIR="./output/thinking_rag" | ||
| DB_PATH="./output.oldemb/thinking_rag/lance.db" | ||
|
|
||
| # echo "============================================================" | ||
| # echo " Ablation 1/5: Direct (no RAG)" | ||
| # echo "============================================================" | ||
| # GEN_GPUS=8 python $SCRIPT \ | ||
| # --mode direct --n $N --seed $SEED \ | ||
| # --output $OUTDIR/ablation_direct_65k.jsonl | ||
|
|
||
| # echo "" | ||
| # echo "============================================================" | ||
| # echo " Ablation 2/5: RAG + raw thinking (drop >24k, no condenser)" | ||
| # echo "============================================================" | ||
| # python $SCRIPT \ | ||
| # --mode rag --n $N --seed $SEED \ | ||
| # --db-path $DB_PATH \ | ||
| # --sim-threshold $SIM --top-k $TOPK \ | ||
| # --max-trace-len 24000 \ | ||
| # --output $OUTDIR/ablation_rag_raw_24k.jsonl | ||
|
|
||
| echo "" | ||
| echo "============================================================" | ||
| echo " Ablation 3/5: RAG + API condenser (qwen3.7-max)" | ||
| echo "============================================================" | ||
| python $SCRIPT \ | ||
| --mode rag --n $N --seed $SEED \ | ||
| --db-path $DB_PATH \ | ||
| --sim-threshold $SIM --top-k $TOPK \ | ||
| --condense \ | ||
| --output $OUTDIR/ablation_rag_api_condenser_65k.jsonl | ||
|
|
||
| echo "" | ||
| echo "============================================================" | ||
| echo " Ablation 4/5: RAG + local vLLM condenser (4B) + API fallback" | ||
| echo "============================================================" | ||
| EVAL_CONDENSER_GPUS=2 python $SCRIPT \ | ||
| --mode rag --n $N --seed $SEED \ | ||
| --db-path $DB_PATH \ | ||
| --sim-threshold $SIM --top-k $TOPK \ | ||
| --condense \ | ||
| --output $OUTDIR/ablation_rag_local_condenser_65k.jsonl | ||
|
|
||
| # echo "" | ||
| # echo "============================================================" | ||
| # echo " Ablation 5/5: RAG + cot_compressed (pre-compressed, no runtime condenser)" | ||
| # echo "============================================================" | ||
| # python $SCRIPT \ | ||
| # --mode rag --n $N --seed $SEED \ | ||
| # --db-path $DB_PATH \ | ||
| # --sim-threshold $SIM --top-k $TOPK \ | ||
| # --use-cot-compressed \ | ||
| # --max-trace-len 4000 \ | ||
| # --output $OUTDIR/ablation_rag_cot_compressed_65k.jsonl | ||
|
|
||
| echo "" | ||
| echo "============================================================" | ||
| echo " All 5 ablations complete. Results:" | ||
| echo "============================================================" | ||
| for f in $OUTDIR/ablation_*_65k.jsonl $OUTDIR/ablation_*_24k.jsonl; do | ||
| n=$(wc -l < "$f") | ||
| correct=$(python -c " | ||
| import json | ||
| recs=[json.loads(l) for l in open('$f') if l.strip()] | ||
| print(sum(1 for r in recs if r['is_correct'])) | ||
| ") | ||
| echo " $(basename $f): $correct/$n" | ||
| done | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/bash | ||
| # Ablation 1: Direct (no RAG, no condenser) | ||
| # GPUs: 4 (gen only) | ||
| # Baseline — model solves problems without any retrieved context. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| python cookbook/exp/embedding/eval_gpqa_rag.py \ | ||
| --mode direct \ | ||
| --n 200 \ | ||
| --seed 42 \ | ||
| --output ./output/thinking_rag/ablation_direct.jsonl |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #!/bin/bash | ||
| # Ablation 3: RAG + API condenser (qwen3.7-max) | ||
| # GPUs: 6 (emb=2 + gen=4), condenser via API (no local vLLM) | ||
| # Compresses thinking_raw with COMPRESS_SYSTEM + CONDENSE_EVAL_QUERY via API. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| export COMPRESS_API_KEY="${COMPRESS_API_KEY:?Set COMPRESS_API_KEY}" | ||
|
|
||
| python cookbook/exp/embedding/eval_gpqa_rag.py \ | ||
| --mode rag \ | ||
| --n 200 \ | ||
| --seed 42 \ | ||
| --sim-threshold 0.6 \ | ||
| --top-k 1 \ | ||
| --condense \ | ||
| --output ./output/thinking_rag/ablation_rag_api_condenser.jsonl |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/bash | ||
| # Ablation 4: RAG + local vLLM condenser (Qwen3.5-4B-CM-v2) | ||
| # GPUs: 8 (emb=2 + gen=4 + condenser=2) | ||
| # Local 4B condenser as primary, API as fallback. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| export EVAL_CONDENSER_GPUS=2 | ||
| export COMPRESS_API_KEY="${COMPRESS_API_KEY:?Set COMPRESS_API_KEY}" | ||
|
|
||
| python cookbook/exp/embedding/eval_gpqa_rag.py \ | ||
| --mode rag \ | ||
| --n 200 \ | ||
| --seed 42 \ | ||
| --sim-threshold 0.6 \ | ||
| --top-k 1 \ | ||
| --condense \ | ||
| --output ./output/thinking_rag/ablation_rag_local_condenser.jsonl |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #!/bin/bash | ||
| # Ablation 2: RAG + raw thinking (no condenser, truncated to max-trace-len) | ||
| # GPUs: 6 (emb=2 + gen=4) | ||
| # Uses thinking_raw directly, truncated to 4000 chars. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| python cookbook/exp/embedding/eval_gpqa_rag.py \ | ||
| --mode rag \ | ||
| --n 200 \ | ||
| --seed 42 \ | ||
| --sim-threshold 0.6 \ | ||
| --top-k 1 \ | ||
| --max-trace-len 4000 \ | ||
| --output ./output/thinking_rag/ablation_rag_raw.jsonl |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since some ablation runs are commented out in this script, the glob patterns (e.g.,
ablation_*_24k.jsonl) might not match any files. In bash, unmatched globs are left unexpanded as literal strings. Sinceset -euo pipefailis active, trying to read from a non-existent literal glob path will causewcto fail and the script to exit prematurely. We should check if the file exists before processing it.