test2 / docs /PROJECT_CHRONICLE.md
Martechsol
Hardened user name discovery with background retry and profile API prioritization
6a7ee8f
|
Raw
History Blame Contribute Delete
4.26 kB
# Project Chronicle: The Evolution of Martechsol HR Intelligence
This document traces the journey of the **Martechsol HR Assistant**, detailing its transition from a standard retrieval system to an institutional-grade AI engine designed for absolute precision, zero hallucination, and empathetic employee guidance.
---
## 1. The Vision: Defining Institutional Intelligence
The goal was to create more than just a chatbot; the objective was to build a **trusted digital HR partner** capable of interpreting complex, often "imperfect" human queries and delivering authoritative, policy-grounded answers.
### Core Philosophy:
- **Zero Hallucination**: If it’s not in the policy, the bot doesn't "invent" it.
- **Empathetic Guidance**: Understanding the *intent* and *frustration* behind employee queries.
- **Institutional Tone**: Maintaining a formal, warm, and professional persona at all times.
---
## 2. Technical Milestones & Evolutionary Phases
### Phase 1: The RAG Foundation (Building the Memory)
We initialized a robust **Retrieval-Augmented Generation (RAG)** pipeline.
- **Hybrid Search**: Combining **FAISS** (semantic vector search) with **BM25** (keyword matching) to ensure no policy detail is missed.
- **BGE Embeddings**: Utilizing `bge-small-en-v1.5` to convert dense HR documents into searchable mathematical vectors.
### Phase 2: The Intelligence Push (Query Understanding)
Employees don't always use perfect English. We implemented a **Query Rewrite Engine** powered by **Llama 3.1 8B**.
- **Linguistic Bridge**: The system now translates Roman Urdu (e.g., *"chutti"**"leave"*) and fixes broken grammar/typos in real-time.
- **Intent Mapping**: Mapping informal slang (e.g., *"pakka"**"confirmation"*) to official HR terminology.
### Phase 3: The "Master System Prompt" (Institutional Guardrails)
To ensure absolute reliability, we developed a 200+ line **Master System Prompt** that acts as the "Constitution" of the AI.
- **Format Decision Table**: A deterministic logic gate that picks the perfect layout (Bullet points for procedures, single facts for counts, exhaustive lists for leave types).
- **Graceful Guidance**: Instead of a dead-end "I don't know," the bot now intelligently routes users to the **Corporate Portal** or **Trouble Ticket System** for personal data or technical issues.
### Phase 4: Performance & Latency Optimization
To achieve a "premium" feel, response speed was prioritized.
- **Think Model Suppression**: We implemented `/no_think` signals and post-processors to strip internal "chain-of-thought" artifacts from models like **Qwen 2.5 32B**.
- **Groq Integration**: Leveraging LPU inference to deliver near-instantaneous responses even with complex reasoning.
---
## 3. The Architecture of Precision
| Layer | Technology | Purpose |
| :--- | :--- | :--- |
| **Primary Brain** | `qwen/qwen3-32b` | Reasoning, logic, and final answer generation. |
| **Query Optimizer** | `llama-3.1-8b-instant` | Translating messy user input into clean search terms. |
| **Search Engine** | FAISS + BM25 | Finding the relevant needle in the HR haystack. |
| **The Filter** | BGE-Reranker | Deep evaluation of chunk relevance to prevent noise. |
| **The Interface** | WordPress Floating Icon | Providing a seamless, beautiful entry point for employees. |
---
## 4. Key Breakthroughs
### Handling the "Human Factor"
The assistant now recognizes situational context. If an employee asks, *"It's been 4 months and I'm still not permanent,"* the AI doesn't just look for "permanent"; it identifies a **Probation/Confirmation** issue and explains the 90-day evaluation process.
### The "Portal" Bridge
The system acts as a smart router. It handles **Policy** directly but handles **Personal Data** (salary, leave balance) by guiding the user to the Portal, ensuring data privacy while remaining helpful.
---
## 5. Current State: Production Ready
As of May 2026, the **Martechsol HR Assistant** stands as a peak implementation of RAG technology. It is stable, highly accurate, and specifically hardened against regressions through a series of "Intelligence Restorations" that have fine-tuned its logic to a near-human level of workplace understanding.
---
**"Precision in Policy, Empathy in Service."**