Led development of an LLM service that analyzes supply chain management (SCM) data and supports planners' daily work with Text-to-SQL and agents.
Context
- Samsung Electronics' supply chain management (SCM) organization wanted planners to query SCM data and get work guidance directly, in natural language.
Problem
- Even routine data questions required SQL and schema knowledge, so planners had to route them through specialists.
- Operational know-how was scattered across documents and individual experience.
- Planners gathered market information such as news, financial indices, and logistics data by hand, slowing root-cause analysis.
My role
- Led the project end to end in a team of seven, owning the service architecture, the agent roles and their coordination, and the workflow design.
- Built the data-query agent pipeline and prepared the dataset and training scripts for sLLM fine-tuning. Set up the development and production environments and defined the CI/CD branch strategy.
Approach
- Agreed on 95% SQL generation accuracy on an evaluation set as the success criterion at kickoff.
- Designed an orchestrator (query rewrite, routing, response layout) that coordinates three agents (data query and analysis, the AI Advisor for work support, and external information) through A2A.
- Built the data-query pipeline as view identification, entity extraction, code mapping, and a pseudo query that a BI engine turns into the final query.
- Fine-tuned a Qwen 8B sLLM for entity extraction and Text-to-SQL after a prompted general-purpose LLM kept confusing entity codes, and split training and inference servers.
Key decisions
| Decision | Why | Trade-off |
|---|---|---|
| Pseudo query instead of direct SQL | A BI engine converts a structured pseudo query into SQL, so generated queries never hit the production database directly and can be validated before execution. | Query coverage is limited to what the BI engine can express. |
| Separate models for SQL and generation | We chose a fine-tunable Qwen 8B sLLM for Text-to-SQL to balance accuracy and cost, and Llama 3.1 70B to write the answers. | Two models to serve and operate. |
| Automated dev deployment, gated production release | We automated development deployments with CI/CD for speed and kept production releases stable through pull request review and manual deployment. | Longer lead time for production releases. |
Architecture
Scroll sideways to see the whole diagram
Components
- Web and mobile portal; BI engine, query, compute, chart; SCM database; LLM server, Llama 3.1 70B (LLM (Llama 3.1 70B)); Market data DB, trend search
- Service platform: Admin page; Embedding, reranker; Vector DB, work guides; System logs; Data pipeline
- Orchestrator: Query rewrite (LLM (Llama 3.1 70B)); Router (LLM (Llama 3.1 70B)); Data query, Text-to-SQL; AI Advisor, work support; External information; Response layout
- LLMOps platform: Training server, fine-tunes Qwen 8B (Fine-tuned sLLM (Qwen 8B)); Inference server, entity, pseudo query (Fine-tuned sLLM (Qwen 8B))
Connections
- Web and mobile portal to Query rewrite
- Query rewrite to Router
- Router to Data query
- Router to AI Advisor
- Router to External information
- Data query to Response layout
- AI Advisor to Response layout
- External information to Response layout
- Response layout to BI engine
- BI engine to SCM database
- BI engine back to Web and mobile portal
- Data pipeline to Vector DB
- Training server to Inference server
- Orchestrator with Inference server
- Service platform with LLM server
- Service platform with Market data DB
Service flow
Scroll sideways to see the whole diagram
Components
- Web and mobile portal; Response layout
- Orchestrator: Query rewrite (LLM (Llama 3.1 70B)); Embedding; Router (LLM (Llama 3.1 70B))
- BI engine: Query conversion; Run query, SCM database; Compute and chart; Build result
- Data query: View identification (LLM (Llama 3.1 70B)); Entity extraction (Fine-tuned sLLM (Qwen 8B)); Code mapping; Pseudo query (Fine-tuned sLLM (Qwen 8B))
- AI Advisor (work support): Retrieval, work-guide vector DB; Reranking; Generation (LLM (Llama 3.1 70B))
- External information: Search, market data; Post-processing; Generation (LLM (Llama 3.1 70B))
Connections
- Web and mobile portal to Query rewrite
- Query rewrite to Embedding
- Embedding to Router
- Router to View identification
- Router to Retrieval
- Router to Search
- View identification to Entity extraction
- Entity extraction to Code mapping
- Code mapping to Pseudo query
- Retrieval to Reranking
- Reranking to Generation (AI Advisor (work support))
- Search to Post-processing
- Post-processing to Generation (External information)
- Pseudo query to Response layout
- Generation (AI Advisor (work support)) to Response layout
- Generation (External information) to Response layout
- Response layout to Query conversion
- Query conversion to Run query
- Run query to Compute and chart
- Compute and chart to Build result
- Build result back to Web and mobile portal
Outcome
- Achieved 95%+ SQL generation accuracy on the evaluation set.
- Enabled planners to query data in natural language and view charts directly without waiting for a specialist to reply.
- Won the phase-2 contract to extend the service with direct system integration and real-time external data.