Microsoft Certified: Azure AI Engineer AssociateImplement generative AI solutionsMedium

A software development company is using Azure OpenAI Service to generate code documentation for its projects. They want to ensure that the generated documentation is consistently high-quality, relevant to the codebase, and includes specific details that are only available in their internal code repository. The current approach of direct prompting often leads to generic or incomplete documentation. Which technique should they implement to improve the quality and specificity of the documentation by leveraging their internal code knowledge?

  1. AImplement Retrieval Augmented Generation (RAG) using their code repository as the knowledge base.
  2. BIncrease the `temperature` parameter to explore more diverse documentation styles.
  3. CReduce the `max_tokens` parameter to encourage concise documentation.
  4. DFine-tune a large language model on publicly available documentation datasets.
Show answer & explanation

Correct answer: A. Implement Retrieval Augmented Generation (RAG) using their code repository as the knowledge base.

Retrieval Augmented Generation (RAG) is ideal for this scenario. By using the internal code repository as a knowledge base, RAG can retrieve relevant code snippets, comments, and project details, and then provide this specific context to the LLM. This ensures the generated documentation is highly relevant, specific, and grounded in the actual codebase, avoiding generic or incomplete outputs.

Why the other options are wrong

  • B. Increasing temperature would make the documentation more varied but not necessarily more accurate or specific to the internal code.
  • C. Reducing `max_tokens` would just make the documentation shorter, without improving its quality, relevance, or specificity to the internal code.
  • D. Fine-tuning on public datasets would not provide the specific internal code knowledge required for high-quality, relevant documentation.

Retrieval Augmented Generation (RAG)

An architectural pattern that combines a retriever (to fetch relevant information from a knowledge base) with a generator (an LLM) to produce more accurate and grounded responses.

  • Enhances factual accuracy by providing external, verifiable context.
  • Crucial for generating responses based on proprietary or domain-specific data.
  • Reduces hallucinations by grounding the LLM's output.

Memory trick: To make docs specific, retrieve from your code, then generate.

More Implement generative AI solutions questions