Spaces:
Sleeping
Sleeping
File size: 4,716 Bytes
f23deb1 ac224ce f23deb1 ac224ce f23deb1 ac224ce f23deb1 ac224ce f23deb1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | # Models Reference
Field-by-field reference for the Pydantic models in `models.py`.
## Enums
### `EmbeddingModel`
- `GENERAL` -> `sentence-transformers/all-MiniLM-L6-v2`
- `MEDICAL` -> `NeuML/pubmedbert-base-embeddings`
- `LEGAL` -> `nlpaueb/legal-bert-base-uncased`
- `CODE` -> `sentence-transformers/multi-qa-mpnet-base-dot-v1`
### `Domain`
- `SOFTWARE`
- `CLIMATE`
- `MEDICAL`
### `ActionType`
- `ADJUST_CHUNK_SIZE` (`params.value: int`)
- `ADJUST_CHUNK_OVERLAP` (`params.value: int`)
- `ADJUST_THRESHOLD` (`params.value: float`)
- `ADJUST_TOP_K` (`params.value: int`)
- `SWAP_EMBEDDING_MODEL` (`params.model: str`)
- `TOGGLE_RERANKING` (`params.enabled: bool`)
- `ADJUST_CONTEXT_LIMIT` (`params.value: int`)
- `REWRITE_QUERY` (`params.query_id: int`, optional `strategy` accepted by callers)
- `SUBMIT` (no params)
### `FaultType`
- `CHUNK_TOO_LARGE`
- `CHUNK_TOO_SMALL`
- `THRESHOLD_TOO_LOW`
- `THRESHOLD_TOO_HIGH`
- `TOP_K_TOO_SMALL`
- `CONTEXT_OVERFLOW`
- `DUPLICATE_FLOODING`
- `WRONG_EMBEDDING_MODEL`
- `NO_RERANKING`
## Tier 1 OpenEnv Interface Models
### `RAGDebugAction(Action)`
Fields:
- `action_type: ActionType`
- `params: dict[str, Any] = {}`
Notes:
- `params` accepts dict or JSON-stringified dict (validator coercion)
- used by server step routing in `_apply_action`
### `RAGDebugObservation(Observation)`
Fields:
- `pipeline_config: PipelineConfig`
- `query_results: list[QueryResult]`
- `metrics: QualityMetrics`
- `corpus_stats: CorpusStats`
- `steps_taken: int`
- `max_steps: int`
- `task_id: int`
- `task_description: str`
- `done: bool`
- `last_action_error: str | None`
- `diagnostic_hints: list[str]`
- `reward_components: dict[str, float]`
Design note:
- injected faults are intentionally omitted from observation and remain internal.
## Tier 2 Internal Models
### `PipelineConfig`
Defaults and bounds:
- `chunk_size: int = 512` (`64..2048`)
- `chunk_overlap: int = 50` (`0..500`)
- `similarity_threshold: float = 0.3` (`0.0..1.0`)
- `top_k: int = 10` (`1..50`)
- `embedding_model: EmbeddingModel = GENERAL`
- `use_reranking: bool = False`
- `context_window_limit: int = 4096` (`512..16384`)
Validation:
- `chunk_overlap < chunk_size` (model validator)
### `QueryResult`
Per-query retrieval result:
- `query_id: int`
- `query_text: str`
- `retrieved_chunk_ids: list[int]`
- `retrieval_scores: list[float]`
- `n_retrieved: int`
- `coverage_score: float` (`0..1`)
- `precision_score: float` (`0..1`)
- `is_multi_hop: bool = False`
Metric definitions:
- coverage = `|R_agent ∩ R*| / |R*|`
- precision = `|R_agent ∩ R*| / |R_agent|`
### `QualityMetrics`
Aggregate metrics:
- `mean_coverage: float`
- `mean_precision: float`
- `mean_recall: float`
- `n_empty_retrievals: int`
- `n_context_overflows: int`
- `multi_hop_coverage: float | None`
### `CorpusStats`
Static corpus metadata:
- `domain: Domain`
- `n_documents: int`
- `n_chunks: int`
- `avg_chunk_tokens: int`
- `has_near_duplicates: bool`
- `n_queries: int`
- `n_multi_hop_queries: int`
### `Reward`
- `value: float`
- `components: dict[str, float]`
Component names emitted by environment reward logic:
- `progress_reward`
- `delta_bonus`
- `empty_retrieval_signal`
- `overflow_signal`
- `step_cost`
- `redundancy_penalty`
- `invalid_action_penalty` (only when the last action had invalid params)
Terminal submit components:
- `terminal_success` (successful submit)
- `terminal_failure` (unsuccessful submit)
Terminal submit rewards are handled directly in action routing:
- success: `0.7 + 0.3 * task_score` (clipped to `[0.7, 1.0]`)
- failure: `0.2 * task_score` (clipped to `[0.0, 0.2]`)
### `FaultConfig`
Internal fault descriptor:
- `fault_type: FaultType`
- `params: dict[str, Any] = {}`
- `description: str = ""`
### `InternalState`
Server-side state:
- `injected_faults: list[FaultConfig]`
- `episode_seed: int`
- `action_history: list[RAGDebugAction]`
- `reward_history: list[float]`
Properties:
- `total_reward`
- `fault_names`
### `EpisodeResult`
Post-episode summary model (not currently exposed via custom app endpoint):
- `task_id: int`
- `task_score: float` (`0..1`)
- `success: bool`
- `n_steps: int`
- `total_reward: float`
- `final_metrics: QualityMetrics`
- `fault_names: list[str]`
- `action_history: list[RAGDebugAction]`
## Runtime Scoring Rules (Environment)
From `server/rag_debug_env_environment.py`:
Task score:
- Task 1 and 2:
- `0.60 * mean_coverage + 0.25 * mean_precision + 0.15 * (1 - n_steps/max_steps)`
- Task 3:
- `0.55 * mean_coverage + 0.25 * mean_precision + 0.20 * multi_hop_coverage`
Success checks:
- Task 1: `task_score >= 0.75`
- Task 2: `task_score >= 0.75`
- Task 3: `task_score >= 0.70` and `multi_hop_coverage > 0.60`
|