Public handling: selected full-text prompt with secret filtering.
Prompt Text
Phase 9C main accuracy multi-seed aggregation is complete.The following limitations are now removed:- seed=0 only- no significance/std yetDo not remove this methodological note:- shared-pool scoring is an efficiency fix, not a protocol change.Now enter Phase 9D: DeepSeek V4 Flash API LLM Experiments.Goal:Remove the no-API-LLM limitation by integrating DeepSeek V4 Flash as an OpenAI-compatible API backend and running controlled LLM reranking / temporal evidence prompt experiments.This phase should produce API LLM results as a separate paper table, not overwrite the main non-LLM accuracy table.# Current statusMain accuracy table is complete for:- MovieLens full- Amazon filtered iterative k=3- seeds [0,1,2,3,4]- methods: - popularity - bm25 - mf_bpr - sasrec - temporal_graph_encoder - time_graph_evidence - time_graph_evidence_dynamicKnown result interpretation:- MovieLens: time_graph_evidence is strongest.- Amazon: popularity has higher Recall@5, while time_graph_evidence has better ranking quality on NDCG/MRR.- time_graph_evidence_dynamic is currently weak and should be diagnosed, not used as a positive claim.# Phase 9D ScopeAllowed:- DeepSeek V4 Flash provider- async batch API runner- cache-first execution- 429 retry/backoff- strict JSON parsing- LLM rerank experiments- temporal evidence prompt experiments- API cost/latency tracking- grounding/hallucination evaluation- paper-ready LLM table exportForbidden:- do not rerun Phase 9C main matrix- do not change frozen split/candidate artifacts- do not change candidate_size- do not run LoRA yet- do not write final paper conclusions- do not store API key- do not run unlimited uncontrolled API calls- do not mix API LLM rows into the non-LLM main table without clear labeling# DeepSeek provider requirementsImplement or update:src/llm4rec/llm/deepseek_provider.pysrc/llm4rec/llm/async_batch.pysrc/llm4rec/llm/rate_limit.pysrc/llm4rec/llm/api_cache.pysrc/llm4rec/llm/api_cost.pysrc/llm4rec/llm/json_parser.pyconfigs/llm/deepseek_v4_flash.yamlconfigs/experiments/paper_deepseek_llm_rerank.yamlconfigs/experiments/paper_deepseek_temporal_evidence.yamlscripts/run_deepseek_llm_matrix.pyscripts/estimate_deepseek_cost.pyscripts/export_deepseek_tables.pytests/unit/test_deepseek_provider.pytests/unit/test_deepseek_rate_limit.pytests/unit/test_deepseek_cache.pytests/unit/test_deepseek_json_parser.pytests/smoke/test_deepseek_dry_run.pyProvider config:base_url: https://api.deepseek.commodel: deepseek-v4-flashapi_key_env: DEEPSEEK_API_KEYtemperature: 0top_p: 1max_tokens: 512stream: false by defaulttimeout: 120max_retries: 8retry_on_status: [429, 500, 502, 503, 504]cache_enabled: trueresume: trueConcurrency config:max_concurrency: 32adaptive_concurrency: truemin_concurrency: 4max_concurrency_hard_cap: 128backoff_initial_seconds: 2backoff_max_seconds: 60jitter: trueImportant:DeepSeek rate limit is dynamic. If 429 occurs, reduce concurrency and retry with backoff. Do not fail the whole matrix unless error budget is exceeded.# API key safetyRead key only from env var:DEEPSEEK_API_KEYNever save:- API key- authorization header- raw secret env- full request headersSanitize:- resolved_config.yaml- logs.txt- api_requests.jsonl- api_raw_outputs.jsonl- cache files# ExperimentsRun DeepSeek experiments as separate LLM matrices.Datasets:1. movielens_full2. amazon_multidomain_filtered_iterative_k3Use frozen protocol_v1 artifacts.Use compact_ref_v1 for Amazon.Candidate handling:- Do not pass all 1000 candidates to LLM unless prompt length is safe.- Use first-stage retriever candidate reduction: - top_m_candidates_for_llm: 50 by default - source from frozen candidates + method scores/evidence scores - target inclusion audit must be recorded.- The LLM reranker reranks top_m candidates only.- Save the upstream retrieval source and top_m selection policy.Prompt variants:1. history_only2. history_with_order3. history_with_time_buckets4. history_with_transition_evidence5. history_with_contrastive_evidence6. time_graph_evidence_promptLLM methods:1. deepseek_history_only_rerank2. deepseek_order_rerank3. deepseek_time_bucket_rerank4. deepseek_transition_evidence_rerank5. deepseek_contrastive_evidence_rerank6. deepseek_tge_evidence_rerank# Execution stages## Phase 9D-0: dry-run and cost estimateRun:py -3.12 scripts/estimate_deepseek_cost.py \ --config configs/experiments/paper_deepseek_llm_rerank.yamlpy -3.12 scripts/run_deepseek_llm_matrix.py \ --config configs/experiments/paper_deepseek_llm_rerank.yaml \ --dry-runDry-run must output:outputs/paper_runs/protocol_v1/deepseek_llm/dry_run/├── cost_estimate.json├── planned_requests.jsonl├── prompt_length_report.csv├── target_inclusion_audit.csv└── api_safety_report.json## Phase 9D-1: pilot API runRun small pilot first:datasets:- movielens_full- amazon_multidomain_filtered_iterative_k3max_users_per_dataset: 500max_requests: 3000max_concurrency: 32cache_enabled: trueresume: trueOutput:outputs/paper_runs/protocol_v1/deepseek_llm/pilot/Acceptance:- parse_success_rate >= 0.95- hallucination_rate reported- candidate_adherence_rate reported- target inclusion audit present- cache works- cost/latency saved- 429 handling works or no 429 occurred## Phase 9D-2: full API LLM runOnly start after pilot passes.Full output:outputs/paper_runs/protocol_v1/deepseek_llm/full/Required files:resolved_config.yamlenvironment.jsonapi_requests.jsonlapi_raw_outputs.jsonlpredictions.jsonlmetrics.jsonmetrics.csvcost_latency.jsoncache_report.jsonfailure_report.jsongrounding_report.csvhallucination_cases.jsonlparse_failures.jsonltable_deepseek_llm.csvtable_deepseek_llm.tex# MetricsCompute:Recall@1/5/10NDCG@1/5/10MRR@10validity_ratehallucination_ratecandidate_adherence_rateparse_success_rateevidence_grounding_ratetransition_evidence_usage_ratetime_evidence_usage_ratesemantic_evidence_usage_ratecontrastive_evidence_usage_ratelatency_meanlatency_p50latency_p95total_tokensprompt_tokenscompletion_tokensestimated_costcache_hit_raterequests_per_minute# Comparison tableExport a separate API LLM table:table_deepseek_llm.csvtable_deepseek_llm.texCompare:- best non-LLM baseline from Phase 9C- time_graph_evidence- deepseek_history_only_rerank- deepseek_transition_evidence_rerank- deepseek_contrastive_evidence_rerank- deepseek_tge_evidence_rerankDo not merge into main accuracy table unless clearly labeled API LLM.# Tests and validationRun:py -3.12 -m pytest tests/unit/test_deepseek_provider.pypy -3.12 -m pytest tests/unit/test_deepseek_rate_limit.pypy -3.12 -m pytest tests/unit/test_deepseek_cache.pypy -3.12 -m pytest tests/unit/test_deepseek_json_parser.pypy -3.12 -m pytest tests/smoke/test_deepseek_dry_run.pypy -3.12 -m pytest -qRun:py -3.12 scripts/validate_project.py# Acceptance criteriaPhase 9D is complete only if:1. DeepSeek provider implemented.2. Dry-run works without API call.3. Cost estimate works.4. API key is read only from DEEPSEEK_API_KEY.5. Logs/configs/cache do not contain API key.6. Async runner supports adaptive concurrency.7. 429 backoff is implemented.8. Pilot run succeeds before full run.9. Full run writes predictions/metrics/cost/latency.10. API LLM table is exported separately.11. No LoRA training is run.12. Frozen artifacts unchanged.13. validate_project passes.14. pytest -q passes.# Output reportWhen finished, report:## Files changed## Commands run## Test results## DeepSeek provider summary## Dry-run cost estimate## Pilot API summary## Full API run summary## API LLM metrics## Cost and latency summary## Grounding/hallucination summary## Failure audit summary## Artifact integrity## Known limitationsAfter Phase 9D, remove:- no API LLM yetStill include:- no LoRA yet- shared-pool scoring is an efficiency fix, not a protocol change## Next recommended stepExactly:Phase 9E: Local 8B LoRA / QLoRA experiments.
Reuse Notes
EXTRACTED: This is a selected Codex prompt or automation prompt from the local Codex corpus.
INFERRED: Future agents can reuse its structure, constraints, and acceptance criteria when creating similar Codex workflows.