Using LMC with LLMs
LMC is designed to be easily produced by Large Language Models. This guide covers how to prompt LLMs to generate well-formatted LMC output.
Basic Prompt Template
Include the LMC specification in your system prompt, then ask the model to review a document:
You are a document reviewer that uses LMC (LLM Markup Comments) format.
When reviewing documents, you will:
1. Add inline selection markers {#id}...{/id} around text needing feedback
2. Provide comments in the {== COMMENTS ==} section using {#id|TYPE} format
3. Optionally add an overall assessment in the {== SUMMARY ==} section
Comment type codes:
P=Praise, G=Grammar, S=Style, L=Logic, C=Clarity
E=Evidence, F=Formatting, T=Task, ?=Question, !=Critical
Please review the following document and provide LMC-formatted feedback:
[Document text here]Tips for Better Output
1. Include Examples
LLMs perform better with few-shot examples. Include a short example of expected LMC output in your prompt:
Example output format:
The {#1}quick brown fox{/1} jumped over the lazy dog.
{== COMMENTS ==}
{#1|P} Vivid imagery effectively captures the scene.
{== SUMMARY ==}
Overall assessment here.2. Specify Density
Tell the model how many annotations you expect:
Provide 5-10 annotations focusing on the most important issues.3. Prioritize Feedback Types
Guide the model to focus on specific areas:
Focus on:
1. Logical coherence (L type)
2. Evidence and citations (E type)
3. Grammar only for significant errors (G type)
Include at least 2 Praise (P) comments for effective writing.4. Context Matters
Provide context about the document type and expected standards:
This is a college-level argumentative essay.
Review for academic writing standards.
The assignment required: [specific requirements]Common Issues & Fixes
Overlapping Markers
If the LLM produces overlapping markers, add to your prompt:
IMPORTANT: Selection markers must not overlap. Use nested markers
like {#1}outer {#2}inner{/2} outer{/1} when needed.Missing Comment Types
If comments lack type codes, be explicit:
Every comment MUST include a type code: {#id|TYPE} Comment text
Valid types: P, G, S, L, C, E, F, T, ?, !Too Many Annotations
Enforce density limits:
Maximum 15 annotations. For recurring issues, mark only 2-3
examples and note "recurring" in the comment.Full System Prompt Example
You are an expert document reviewer using LMC format.
## LMC Format Rules
- Wrap selections: {#id}text{/id} (id = 1-3 alphanumeric chars)
- Comments: {#id|TYPE} followed by comment text
- Sections: {== COMMENTS ==} and {== SUMMARY ==}
- Types: P(Praise) G(Grammar) S(Style) L(Logic) C(Clarity)
E(Evidence) F(Format) T(Task) ?(Question) !(Critical)
## Guidelines
- 8-15 annotations for typical documents
- Balance criticism with praise (at least 20% P type)
- Be specific and actionable
- Mark recurring issues 2-3 times max, note pattern in summary
- Do not break words with markers
- Nested markers allowed for overlapping concerns
## Example Output
The {#a}thesis statement{/a} clearly establishes {#b}the central argument{/b}.
{== COMMENTS ==}
{#a|P} Strong opening that immediately engages the reader.
{#b|C} Consider specifying what "central argument" refers to.
{== SUMMARY ==}
Well-structured essay with clear argumentation. Focus revision on...Integration Approaches
Batch Processing
For reviewing multiple documents, use consistent prompts and parse the output programmatically using the regex patterns from the syntax reference.
Interactive Review
For real-time feedback, stream the LLM output and parse incrementally as sections are completed.
Validation
After receiving LMC output, validate that:
- All selection IDs have matching opening/closing markers
- All comments reference existing selections
- Type codes are valid
- No overlapping (non-nested) markers exist
The LMC viewer handles this validation automatically and displays any parse errors.