PHI-Model-8B/docs/diagrams/04-generator-code.drawio

55 lines
7.2 KiB
Plaintext

<mxfile host="app.diagrams.net" modified="2026-10-15T15:00:00.000Z" agent="Copilot" version="24.7.17">
<diagram id="generator-code" name="C4 Level 4 - Generator Code">
<mxGraphModel dx="1422" dy="794" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1800" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="title" value="TrainingGenerationService - C4 Level 4: Code Relationships" style="text;html=1;align=center;fontSize=24;fontStyle=1" vertex="1" parent="1">
<mxGeometry x="400" y="20" width="1000" height="40" as="geometry"/>
</mxCell>
<mxCell id="service" value="&lt;b&gt;TrainingGenerationService&lt;/b&gt;&lt;br&gt;+ GenerateAsync()&lt;br&gt;- GenerateCategoryAsync()&lt;br&gt;- CreatePlan()&lt;br&gt;- GeneratePassAsync()&lt;br&gt;- PersistOrderedAsync()&lt;br&gt;- FindResumableRunAsync()&lt;br&gt;- ValidateGeneratedValue()" style="swimlane;html=1;startSize=30;rounded=0;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=13;align=left;spacingLeft=8" vertex="1" parent="1">
<mxGeometry x="660" y="310" width="360" height="280" as="geometry"/>
</mxCell>
<mxCell id="reader" value="&lt;b&gt;TrainingDataReader&lt;/b&gt;&lt;br&gt;+ ValidateAsync()&lt;br&gt;+ ReadCategoryValuesAsync()&lt;br&gt;+ ReadPatternsAsync()" style="swimlane;html=1;startSize=30;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=13;align=left;spacingLeft=8" vertex="1" parent="1">
<mxGeometry x="130" y="120" width="290" height="150" as="geometry"/>
</mxCell>
<mxCell id="definitions" value="&lt;b&gt;Training definitions&lt;/b&gt;&lt;br&gt;TrainingCategories&lt;br&gt;TrainingSubjects&lt;br&gt;TrainingCategoryDefinition&lt;br&gt;TrainingCategoryValue" style="swimlane;html=1;startSize=30;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=13;align=left;spacingLeft=8" vertex="1" parent="1">
<mxGeometry x="120" y="390" width="310" height="180" as="geometry"/>
</mxCell>
<mxCell id="lmclient" value="&lt;b&gt;LmStudioClient&lt;/b&gt;&lt;br&gt;+ CompleteAsync()&lt;br&gt;- ResolveFragmentTokens()&lt;br&gt;- ResolveArticles()&lt;br&gt;- SendCompletionAsync()" style="swimlane;html=1;startSize=30;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=13;align=left;spacingLeft=8" vertex="1" parent="1">
<mxGeometry x="1250" y="120" width="300" height="180" as="geometry"/>
</mxCell>
<mxCell id="options" value="&lt;b&gt;Configuration&lt;/b&gt;&lt;br&gt;GenerationOptions&lt;br&gt;LmStudioOptions&lt;br&gt;SentenceTenses" style="swimlane;html=1;startSize=30;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=13;align=left;spacingLeft=8" vertex="1" parent="1">
<mxGeometry x="1260" y="390" width="280" height="150" as="geometry"/>
</mxCell>
<mxCell id="context" value="&lt;b&gt;RlhfGeneratorDbContext&lt;/b&gt;&lt;br&gt;DbSet&lt;Category&gt;&lt;br&gt;DbSet&lt;TrainingItem&gt;&lt;br&gt;DbSet&lt;GenerationRun&gt;&lt;br&gt;DbSet&lt;Keyword&gt;&lt;br&gt;DbSet&lt;KeywordVariant&gt;" style="swimlane;html=1;startSize=30;fillColor=#f8cecc;strokeColor=#b85450;fontSize=13;align=left;spacingLeft=8" vertex="1" parent="1">
<mxGeometry x="650" y="760" width="380" height="200" as="geometry"/>
</mxCell>
<mxCell id="run" value="&lt;b&gt;GenerationRun&lt;/b&gt;&lt;br&gt;Status, seed, fingerprints&lt;br&gt;checkpoint and counts&lt;br&gt;failure/cancellation data" style="swimlane;html=1;startSize=30;fillColor=#f8cecc;strokeColor=#b85450;fontSize=13;align=left;spacingLeft=8" vertex="1" parent="1">
<mxGeometry x="180" y="760" width="300" height="160" as="geometry"/>
</mxCell>
<mxCell id="item" value="&lt;b&gt;TrainingItem&lt;/b&gt;&lt;br&gt;RecordKey, PlanOrdinal&lt;br&gt;Category, Keyword&lt;br&gt;IsPositive, Value" style="swimlane;html=1;startSize=30;fillColor=#f8cecc;strokeColor=#b85450;fontSize=13;align=left;spacingLeft=8" vertex="1" parent="1">
<mxGeometry x="1200" y="760" width="300" height="160" as="geometry"/>
</mxCell>
<mxCell id="channel" value="&lt;b&gt;Bounded Channel&lt;/b&gt;&lt;br&gt;Parallel workers write completed plan items; ordered writer consumes" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;fontSize=13" vertex="1" parent="1">
<mxGeometry x="690" y="120" width="300" height="110" as="geometry"/>
</mxCell>
<mxCell id="e1" value="Validates and reads inputs" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=open" edge="1" parent="1" source="service" target="reader"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e2" value="Returns" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=open" edge="1" parent="1" source="reader" target="definitions"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e3" value="Plans with" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=open" edge="1" parent="1" source="service" target="definitions"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e4" value="Calls concurrently" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=open" edge="1" parent="1" source="service" target="lmclient"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e5" value="Binds" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=open" edge="1" parent="1" source="options" target="service"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e6" value="Binds" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=open" edge="1" parent="1" source="options" target="lmclient"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e7" value="Coordinates producer/consumer" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=open" edge="1" parent="1" source="service" target="channel"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e8" value="Queries and transacts" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=open" edge="1" parent="1" source="service" target="context"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e9" value="Tracks" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=diamond;endFill=0" edge="1" parent="1" source="context" target="run"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e10" value="Tracks" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=diamond;endFill=0" edge="1" parent="1" source="context" target="item"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e11" value="Owns ordered items" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=diamond;endFill=1" edge="1" parent="1" source="run" target="item"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="note" value="Plan order: category positive pass, then negative pass. Workers may finish out of order; persistence waits for the next contiguous ordinal and commits rows plus checkpoint atomically." style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12" vertex="1" parent="1">
<mxGeometry x="1080" y="560" width="430" height="120" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>