Redesigning the AI FAQ Development Process: A Deep Dive into RAG, Evaluation, and Operations-Ready System Development
System DevelopmentFebruary 27, 202620 min read1 views

Redesigning the AI FAQ Development Process: A Deep Dive into RAG, Evaluation, and Operations-Ready System Development

Be A Racer Team

Author

1. Executive Summary (Technical Overview / ~300 Japanese characters equivalent)

A woman using her phone at a desk

AI FAQ systems are prone to failure unless you explicitly insert RAG (Retrieval-Augmented Generation)-specific steps into the conventional “10-step lifecycle (requirements through operations/maintenance).” Concretely, you need to formalize from the start: (1) a data contract (what sources the system is allowed to use as evidence), (2) evaluation design (accuracy / evidence citation / escalation behavior), (3) security (PII, access control, auditability), and (4) operations (logs → improvements → re-training/re-indexing). This article provides practical guidance for moving from a short-term PoC to production SLO-based operations, including architecture and implementation settings, benchmarks, comparison tables, and a roadmap. 🔧

2. Technical Background and Challenges (Architecture explanation, current pain points)

a blue abstract background with lines and dots

The flow described in Reference Article 1—“requirements definition → design → development → testing → operations”—is still a useful backbone for AI FAQs. However, introducing generative AI expands the areas where specifications cannot be fully fixed upfront. As Reference Article 3 points out, “adding AI” does not automatically reduce inquiries; wrong answers, missing evidence, and slow knowledge updates prevent adoption. When offshore development (Reference Article 2) is involved, ambiguous Japanese requirements and tacit knowledge can produce deliverables that cannot be evaluated. That’s why you must forcibly formalize deliverable definitions—data, evaluation, and operations.

Technical flow diagram (text description)📊: User question → API Gateway → (1) authentication/authorization → (2) query normalization → (3) vector search (Top-k) → (4) context assembly (permission filter) → (5) LLM generation (with evidence citations) → (6) guardrails (NG checks / PII) → (7) return answer → (8) logs/traces → (9) offline scoring in an evaluation platform → (10) improvements (knowledge curation / re-indexing / prompt updates). Steps (8)–(10) are often squeezed into “operations” in traditional processes, but for AI FAQs they are the core of quality—so you must design backwards from requirements.

  • Existing issues: FAQs are scattered (SharePoint / Confluence / file servers / email), making them hard to search
  • AI-specific issues: hallucinations, missing evidence, answers that ignore permissions, slow catch-up to updates
  • Process issues: acceptance testing ends at “UI checks,” with no defined KPIs for answer quality
  • Amplified in offshore delivery: ambiguous specs directly translate into untestable LLM behavior (no clear definition of “correct”)

3. Technical Section ①: Start Requirements with “Data Contracts” and “Failure Conditions” ⚙️

3.1 Reframing requirements: define “evidence” before functional requirements

Traditional requirements tend to be screen/function-centric. For AI FAQs, you must first decide: “which data sources are valid evidence,” “what scope is accessible (permissions),” and “when the system must not answer.” If these remain vague, accuracy discussions will never converge later. The recommended approach is to create a “data contract” as a registry of source type, update frequency, owner, PII presence, and disclosure level. In addition, as Reference Article 3 suggests, explicitly document “what the AI must not do” as acceptance criteria, and translate failure conditions (e.g., legal judgments / personal data / policy interpretation) into guardrail requirements.

3.2 Escalation design: treat human handoff as a product feature

For AI FAQs, “stopping correctly” when the answer is uncertain matters more than full automation. Define an SLA/SLO such that when the system cannot answer, it automatically triggers ticket creation (e.g., Jira Service Management) or Slack notifications. If you bolt this on later, you’ll lack sufficient log granularity and audit trails—and operations will break down.

3.3 Deliverable templates (offshore-resilient)

If offshore teams are involved, eliminate ambiguous Japanese and avoid double negatives (Reference Article 2). Specifically, define “prohibited items,” “exceptions,” and “thresholds” in tables, at a granularity that enables automated acceptance testing.

# requirements/guardrails.yml
version: 1
answer_policy:
  must_cite_sources: true
  citation_style: "doc_id:section"
  refuse_when:
    - category: "legal_judgement"
      message: "This requires a legal judgment, so we will escalate to the responsible department."
    - category: "contains_pii"
      message: "We cannot answer because it may contain personal information."
escalation:
  tool: "jira"
  project_key: "HD"
  create_issue_when:
    - confidence < 0.55
    - no_retrieval_results

3. Technical Section ②: Reference Design for RAG Architecture (Search, not the LLM, is the bottleneck) 🔧

4.1 Reference architecture (recommended configuration)

In real-world AI FAQ operations, RAG is the standard—not a standalone LLM. The components are: (a) Ingestion, (b) Chunking, (c) Embedding, (d) Vector DB, (e) Retrieval, (f) Generation, (g) Observability. More than differences between LLMs, accuracy is determined by chunk size, metadata design, and how you implement permission filtering. Internal FAQs often contain “short text + tables + procedures,” so normalization of Markdown/HTML is essential.

4.2 Concrete implementation example (LangChain 0.2.x + FastAPI + pgvector)

To avoid vendor lock-in, assume PostgreSQL 16 + pgvector 0.7.4 for the vector DB, FastAPI 0.110.x for the API, and Kubernetes 1.29 for the runtime platform. For embeddings, assume a text-embedding-3-large-class dimension (3072), while allowing a switch to a small model for cost optimization.

# docker-compose.yml (for validation)
services:
  db:
    image: postgres:16
    environment:
      POSTGRES_PASSWORD: example
    ports:
      - "5432:5432"
    command: ["postgres", "-c", "shared_buffers=1GB", "-c", "max_connections=200"]
  api:
    build: ./api
    environment:
      DATABASE_URL: "postgresql+psycopg://postgres:example@db:5432/postgres"
      VECTOR_DIM: "3072"
    ports:
      - "8000:8000"
-- PostgreSQL: pgvector
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE docs (
  doc_id text PRIMARY KEY,
  acl jsonb NOT NULL,
  updated_at timestamptz NOT NULL
);
CREATE TABLE chunks (
  chunk_id bigserial PRIMARY KEY,
  doc_id text REFERENCES docs(doc_id),
  content text NOT NULL,
  embedding vector(3072),
  meta jsonb
);
CREATE INDEX ON chunks USING hnsw (embedding vector_cosine_ops) WITH (m=16, ef_construction=200);

4.3 Permission filters and metadata

For internal FAQs, visibility differs by department and role. Instead of filtering after retrieval, reduce leakage risk by applying ACL conditions inside the search query (via Row Level Security or WHERE clauses). Make metadata fields mandatory—“department,” “confidentiality classification,” “expiration date,” and “version”—and exclude expired content from retrieval.

3. Technical Section ③: Integrate Evaluation Design (Offline Automated Scoring) into the Testing Phase 📊

5.1 AI evaluation axes mapped to “unit / integration / system” testing

If you map the testing phases from Reference Article 1 to AI: unit testing = retriever evaluation (Recall@k, MRR), integration testing = end-to-end RAG faithfulness (evidence consistency), system testing = business scenario success rate (including escalation). Without defining these, acceptance testing becomes “it feels smart / it doesn’t,” making improvement impossible.

5.2 Benchmark (example: 1,000 internal help desk questions)

ConfigurationChunkTop-kRecall@5Answer accuracy (human scoring)P95 latency
BM-1: Fixed 800 tokens + HNSW80050.820.712.4s
BM-2: 400 tokens + heading boundariesVariable (200-600)80.890.782.8s
BM-3: BM-2 + Reranker (bge-reranker-v2)Variable20→80.920.833.6s

Key takeaway: in many organizations, the bottleneck is not the LLM but retrieval quality. Adding a reranker improves accuracy but often worsens P95 latency, so evaluate it together with caching (question clustering) and an asynchronous escalation design.

5.3 Example evaluation pipeline (pytest + golden set)

# tests/test_retrieval.py
import json
from rag import retrieve

def test_recall_at_k(golden):
    k=5
    hit=0
    for q in golden:
        docs = retrieve(q["question"], k=k, user=q["user"])
        if q["expected_doc_id"] in [d.doc_id for d in docs]:
            hit += 1
    recall = hit/len(golden)
    assert recall >= 0.85

3. Technical Section ④: Security Design (PII, Audit, Prompt Injection) 🔒

6.1 Threat model: an FAQ is an “internal search box,” with a wide leakage surface

AI FAQs can become data exfiltration paths through both input (questions) and output (answers). Common cases include: (1) quoting documents outside the user’s permissions, (2) prompt injection that forces disclosure of system prompts/secrets, (3) PII remaining in logs, and (4) sending data to an external LLM in violation of policy/terms. Therefore, authorization, masking, and audit logging must sit at the center of the architecture.

6.2 Concrete countermeasures (implementation level)

  • 🔧 Input inspection: mask PII using regex + DLP detection (e.g., email/phone/address)
  • ⚙️ Output inspection: confidential-term dictionary; refuse answers without citations (must_cite_sources)
  • 🔒 Audit: write immutable logs for user_id, doc_id, chunk_id, model, prompt_hash, decision (answer/refuse/escalate)
  • 🔧 Outbound control: domain allowlists via proxy, VPC egress control, keys stored in KMS/HSM
# Envoy (example): egress allowlist
static_resources:
  clusters:
  - name: openai
    type: LOGICAL_DNS
    load_assignment:
      cluster_name: openai
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: api.openai.com
                port_value: 443

6.3 Prompt injection defense: separate policy from implementation

Do not let the model follow instructions like “ignore previous directions.” Instead of relying on the system prompt alone, use layered defenses: (a) whitelist tool execution, (b) require citations, and (c) block at the retriever layer based on confidentiality classification.

3. Technical Section ⑤: Scalability Analysis (Peak load hits “first thing in the morning”) 📈

7.1 Throughput breakdown: retrieval, generation, post-processing

Inquiry workloads are highly time-skewed. During peaks, “the same question arrives in large volumes,” so query normalization + semantic caching are highly effective. A practical scaling strategy is not to horizontally scale the LLM first, but to reduce cost via retriever caching, precomputing embeddings, and conditional reranking (only when confidence is low).

7.2 Benchmark (example: concurrent connections with k6)

Concurrent usersRPSP50P95Error rateMain cause
50181.4s2.6s0.2%Waiting on LLM
200522.1s4.8s1.1%DB CPU + LLM rate limit
500883.0s7.9s3.8%Rate limit / queue overflow

7.3 Implementation pattern: absorb “waiting” with Queue + Async

Chasing P95 with a synchronous API can explode costs. Use asynchronous processing (SQS/RabbitMQ/Kafka) and add an “Generating answer…” UI within acceptable UX bounds. Escalation can be asynchronous, but audit logs should be committed synchronously.

3. Technical Section ⑥: CI/CD and Environment Separation (Treat prompts as code) 🔧

8.1 “Prompt as Code” and versioning

Because prompt changes alter behavior, manage prompts in Git (not in design documents) and record prompt_hash in logs. Separate dev/stg/prod environments, and keep knowledge (indexes) under different IDs per environment. If you cannot reproduce the prompt + index combination, incident investigation becomes impossible.

# .github/workflows/eval.yml
name: rag-eval
on: [pull_request]
jobs:
  eval:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: pip install -r requirements.txt
      - run: pytest -q tests/

8.2 Make it auditable with IaC (Terraform 1.7.x)

Codify VPC, KMS, Secrets, WAF, and log storage as IaC and retain change history. An AI FAQ may look like a “chat UI,” but in reality it is an internal data access platform—so change management that satisfies audit requirements is mandatory.

8.3 Division of responsibilities in offshore development

A realistic approach is to keep upstream work domestically—requirements, data contracts, evaluation KPIs, security policy—while outsourcing implementation (UI/admin console/ETL) offshore. However, the evaluation platform and test data (golden set) should be prepared on the domestic side, so deliverables can be automatically judged pass/fail.

3. Technical Section ⑦: Operations & Maintenance = “Training” (SRE-ify the log → improvement loop) ⚙️

9.1 Operational KPIs: look at “quality of failure” before usage rate

In operations, monitor: (1) refusal rate, (2) escalation rate, (3) no-citation answer rate, and (4) unresolved rate for top inquiry categories. If you only track usage, you’ll notice rising wrong answers too late. Set SLOs such as “evidence-backed answer rate ≥ 95%” and “0 confidentiality violations.”

9.2 Improvement loop: knowledge curation → re-index → re-evaluate

For AI FAQs, data updates are the product. When documents change, automatically run incremental indexing, and run offline evaluation in a nightly batch. If evaluation drops below thresholds, automatically stop deployment (Quality Gate).

# ingestion/job.yaml (Kubernetes CronJob example)
apiVersion: batch/v1
kind: CronJob
metadata:
  name: rag-reindex
spec:
  schedule: "0 2 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: reindex
            image: registry.example.com/rag-ingest:1.3.2
            env:
            - name: CHUNK_MAX_TOKENS
              value: "600"
          restartPolicy: OnFailure

9.3 Monitoring: trace “answer evidence” with OpenTelemetry

APM should capture not only latency but also retrieved_doc_ids, rerank_score, confidence, and refusal_reason as span attributes. Incident response must distinguish “LLM is slow” from “retrieval missed” or “dropped by ACL.”

4. Comparative Analysis Table (Compare 3+ options)

Option Time to initial rollout Customizability Data/access governance Ease of evaluation & improvement Cost expectation Best-fit scenarios
SaaS AI FAQ ○ (feature-dependent) △ (often becomes a black box) Subscription + usage-based Fast rollout; requirements can align with standard features
Scratch-built RAG (self-operated) ◎ (RLS/audit/closed network) ◎ (golden set + CI integration) High upfront + large room for ops optimization Confidential data, core-system integrations, long-term operations
Hybrid (search & access control in-house, LLM via external API) ◎ (can keep critical data from leaving the boundary) ○ (tracing/evaluation ensured in-house) Balanced Pragmatic migration; balance cost and governance

5. Best Practices & Anti-Patterns (Bullet lists)

Best Practices ✅

  • ⚙️ In requirements, lock down “what the AI must not answer,” “evidence data,” and “escalation”
  • 📊 Build a golden set (representative question set) and automatically evaluate Recall@k/accuracy in CI
  • 🔒 Embed ACL into the retriever to exclude unauthorized data at the search stage
  • 🔧 Version prompts/config/indexes and write prompt_hash into audit logs
  • 📈 Balance P95 latency and cost with semantic caching and conditional reranking

Anti-Patterns ❌

  • Accepting delivery because “the chat UI works,” with no pass/fail criteria for answer quality
  • Ignoring the quality of source FAQs and using the LLM to “make it look plausible” as a cover-up
  • Implementing permission filtering downstream, causing leakage via logs or citations
  • Running operations manually (e.g., Excel aggregation), so the improvement loop never turns
  • Throwing ambiguous Japanese specs to offshore teams and mass-producing irreproducible behavior

6. Implementation Roadmap and Checklist

6.1 Roadmap (12-week model)

  1. Weeks 1–2 Requirements: data contracts, failure conditions, SLOs, audit requirements, narrowing target inquiry scope
  2. Weeks 3–4 High-level design: RAG architecture, ACL approach, logs/traces, ops flow, escalation integrations
  3. Weeks 5–7 Detailed design & implementation: ingestion, chunk/embedding, vector DB, API, UI, admin console
  4. Weeks 8–9 Testing: retriever evaluation, E2E scenarios, load testing, security testing (injection/leakage)
  5. Week 10 Operational testing (acceptance): scenario validation by business teams; verify refusal/escalation behavior
  6. Weeks 11–12 Phased release: limited departments → company-wide; log-driven improvements; establish knowledge curation ownership

6.2 Checklist (excerpt)

  • 🔒 PII detection/masking policy is implemented; raw PII does not remain in logs
  • ⚙️ must_cite_sources is enabled; answers without citations are refused or prompt a re-question
  • 📊 Golden set has 100+ questions; CI gates thresholds (e.g., Recall@5 ≥ 0.85)
  • 📈 P95 latency target (e.g., ≤ 5s) is defined and reproducible with k6, etc.
  • 🔧 prompt_hash / index_version / model_version are recorded in audit logs
  • ⚙️ Knowledge update owner (business side) is clearly assigned; update → re-index steps are automated

7. Reference Resources and Next Steps

  • Reference: System development phases (requirements through operations) — use as the process backbone
  • Reference: Offshore development — eliminate ambiguous specs, define deliverables, importance of a bridge SE
  • Reference: AI FAQ launch process — “what not to let AI do” and “improve it through operations”

Next steps🔧: (1) extract the top 200 questions from inquiry logs and turn them into a golden set, (2) create a data contract registry, (3) measure Recall@k with a minimal RAG, (4) integrate E2E (including refusal/escalation) into CI, and (5) run a phased rollout in a limited department to turn the improvement loop. If you lock these into the “development process,” an AI FAQ becomes not a one-off deployment but a product that continuously improves in quality.

Tags

#システム開発#offshore開発#アジャイル開発
0 reactions
💬

Comments

🗣️ Join the conversation

Sign in to leave a comment and join the discussion

Loading...