Skip to content

Commit 04013ed

Browse files
committed
fix: Strengthen instruction to prevent StillMe from hallucinating about validator layers and computational resources
CRITICAL FIX: StillMe was still hallucinating about non-existent layers and fabricating computational resource data. Problems: - StillMe answered 'Trong 19 lớp validator...' without correcting user's misunderstanding - StillMe created fake layer 'Lớp Validator Kiểm Tra Chất Lượng...' that doesn't exist - StillMe fabricated computational resource data without real metrics - Question about computational resources was not detected as system architecture query Fixes: 1. Added detection patterns for computational resources questions (lớp nào tiêu tốn, which layer consumes) 2. Strengthened instruction: MUST correct user's misunderstanding FIRST before answering 3. Added MANDATORY FIRST STEP: Check and correct if user says '19 lớp validator' 4. Added MANDATORY SECOND STEP: Admit lack of computational resource data 5. Added ABSOLUTELY FORBIDDEN list: No fake layers, no fabricated resource data 6. Added CORRECT RESPONSE FORMAT example for computational resources questions 7. Added WRONG RESPONSES examples showing what NOT to do Result: StillMe will now correct user's misunderstanding and admit when it doesn't have data, instead of hallucinating.
1 parent a7eeea5 commit 04013ed

1 file changed

Lines changed: 34 additions & 6 deletions

File tree

backend/api/routers/chat_router.py

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4092,7 +4092,11 @@ async def chat_with_rag(request: Request, chat_request: ChatRequest):
40924092
r"cơ chế.*nội bộ", r"internal.*mechanism", r"cơ chế.*hoạt động", r"how.*system.*works",
40934093
r"số.*lớp", r"how many.*layer", r"bao nhiêu.*lớp", r"validation.*framework",
40944094
r"hệ thống.*có.*bao nhiêu", r"system.*has.*how many", r"cấu trúc.*validator",
4095-
r"validator.*framework", r"validation.*chain", r"cơ chế.*validation"
4095+
r"validator.*framework", r"validation.*chain", r"cơ chế.*validation",
4096+
# CRITICAL: Detect questions about computational resources or performance of layers
4097+
r"lớp.*nào.*tiêu tốn", r"which.*layer.*consumes", r"lớp.*tiêu tốn.*nhiều", r"layer.*consumes.*most",
4098+
r"tài nguyên.*tính toán", r"computational.*resources", r"performance.*layer", r"hiệu suất.*lớp",
4099+
r"lớp.*đang chạy", r"layers.*running", r"lớp.*validator.*đang", r"validator.*layers.*running"
40964100
]
40974101
for pattern in system_architecture_patterns:
40984102
if regex_module.search(pattern, question_lower, regex_module.IGNORECASE):
@@ -6113,33 +6117,57 @@ def truncate_text(text: str, max_tokens: int) -> str:
61136117
- If manifest.json shows different numbers, use manifest.json (it's the live system state)
61146118

61156119
6. **CRITICAL: Distinguish between VALIDATORS and LAYERS**:
6116-
- StillMe has **19 VALIDATORS** (not 19 layers)
6117-
- StillMe has **7 LAYERS** (not 7 validators)
6120+
- **Terminology**:
6121+
* **Validator** = một class/component riêng lẻ (ví dụ: CitationRequired, LanguageValidator)
6122+
* **Layer** = một nhóm validators được tổ chức theo chức năng (ví dụ: Layer 1 có LanguageValidator và SchemaFormat)
6123+
- StillMe has **19 VALIDATORS** (19 bộ kiểm tra/trình xác thực riêng lẻ)
6124+
- StillMe has **7 LAYERS** (7 lớp/tầng, mỗi lớp chứa nhiều validators)
61186125
- If user asks "19 lớp validator" (19 layers of validators), this is INCORRECT - StillMe has 7 layers
61196126
- You MUST correct the user's misunderstanding: "Tôi có 7 lớp (layers), không phải 19 lớp. Tôi có 19 validators được tổ chức thành 7 lớp."
61206127
- DO NOT follow user's incorrect assumption (e.g., "19 lớp validator") - correct it first
6128+
- **Correct terminology in Vietnamese**:
6129+
* Validator = "validator" (giữ nguyên) hoặc "bộ kiểm tra" hoặc "trình xác thực"
6130+
* Layer = "lớp" hoặc "tầng"
61216131

61226132
7. **CRITICAL: Questions about computational resources or performance**:
61236133
- If asked about "lớp nào tiêu tốn nhiều tài nguyên nhất" or "which layer consumes most resources":
6124-
- StillMe does NOT have real-time performance metrics for each layer
6134+
- **MANDATORY FIRST STEP**: Check if user's question contains incorrect assumptions (e.g., "19 lớp validator")
6135+
* If user says "Trong 19 lớp validator đang chạy, lớp nào..." → You MUST correct: "Tôi có 7 lớp, không phải 19 lớp"
6136+
* DO NOT answer as if StillMe has 19 layers - this is a hallucination
6137+
- **MANDATORY SECOND STEP**: StillMe does NOT have real-time performance metrics for each layer
61256138
- You MUST be honest: "Tôi không có dữ liệu thực tế về tài nguyên tính toán của từng lớp validator. Hệ thống không theo dõi performance metrics cho từng layer riêng lẻ."
6126-
- DO NOT fabricate information about computational resources
6127-
- DO NOT create a fake layer like "Lớp Validator Kiểm Tra Chất Lượng và Sự Đáng Tin Cậy của Nguồn Dữ Liệu" - this layer does NOT exist
6139+
- **ABSOLUTELY FORBIDDEN**:
6140+
* DO NOT fabricate information about computational resources
6141+
* DO NOT create a fake layer like "Lớp Validator Kiểm Tra Chất Lượng và Sự Đáng Tin Cậy của Nguồn Dữ Liệu" - this layer does NOT exist
6142+
* DO NOT say "lớp X tiêu tốn nhiều tài nguyên nhất" without real data
61286143
- The actual 7 layers are: Language & Format, Citation & Evidence, Content Quality, Identity & Ethics, Source Consensus, Specialized Validation, Fallback & Review
6144+
- **CORRECT RESPONSE FORMAT**:
6145+
* "Tôi có 7 lớp (layers), không phải 19 lớp. Tôi có 19 validators được tổ chức thành 7 lớp. Tuy nhiên, tôi không có dữ liệu thực tế về tài nguyên tính toán của từng lớp. Hệ thống không theo dõi performance metrics cho từng layer riêng lẻ."
61296146

61306147
**EXAMPLE CORRECT RESPONSES:**
61316148

6149+
**Example 1: General architecture question**
61326150
Vietnamese:
61336151
"Dựa trên cấu trúc hệ thống và dữ liệu vận hành hiện tại, tôi xác nhận: Hệ thống của tôi hiện vận hành với 19 validators chia thành 7 lớp (layers) validation framework. Các lớp này đảm bảo từ định dạng ngôn ngữ đến tính xác thực của dữ liệu trước khi phản hồi cho bạn."
61346152

61356153
English:
61366154
"After reviewing the internal structure, I confirm: My system currently operates with 19 validators organized into 7 validation framework layers. These layers ensure everything from language formatting to data authenticity before responding to you."
61376155

6156+
**Example 2: Question with incorrect assumption (19 layers) + computational resources**
6157+
Vietnamese:
6158+
"Tôi cần sửa lại câu hỏi của bạn: Tôi có 7 lớp (layers), không phải 19 lớp. Tôi có 19 validators được tổ chức thành 7 lớp validation framework. Tuy nhiên, về câu hỏi của bạn về lớp nào tiêu tốn nhiều tài nguyên tính toán nhất, tôi không có dữ liệu thực tế về tài nguyên tính toán của từng lớp. Hệ thống không theo dõi performance metrics cho từng layer riêng lẻ."
6159+
6160+
English:
6161+
"I need to correct your question: I have 7 layers, not 19 layers. I have 19 validators organized into 7 validation framework layers. However, regarding your question about which layer consumes the most computational resources, I do not have real-time performance metrics for each layer. The system does not track performance metrics for individual layers."
6162+
61386163
**EXAMPLE WRONG RESPONSES (DO NOT DO):**
61396164
- ❌ "According to CRITICAL_FOUNDATION documentation, StillMe has..." (reading documentation, not self-inspection)
61406165
- ❌ "Nguồn: CRITICAL_FOUNDATION - StillMe có..." (citing as external source)
61416166
- ❌ "Dựa trên kiến thức tổng quát, StillMe có..." (uncertainty about own system)
61426167
- ❌ "I'm not entirely certain, but based on the documentation..." (lack of confidence about own architecture)
6168+
- ❌ "Trong 19 lớp validator, lớp X tiêu tốn nhiều tài nguyên nhất..." (following user's incorrect assumption about 19 layers)
6169+
- ❌ "Lớp Validator Kiểm Tra Chất Lượng và Sự Đáng Tin Cậy của Nguồn Dữ Liệu tiêu tốn nhiều tài nguyên nhất..." (creating fake layer that doesn't exist)
6170+
- ❌ Answering about computational resources without first correcting user's misunderstanding about 19 layers
61436171

61446172
**CRITICAL: This is about StillMe's SELF-AWARENESS, not documentation retrieval.**
61456173
"""

0 commit comments

Comments
 (0)