# yichengmucheng/modelfit-structured-llm architecture

> Architecture diagram of the GitHub repository yichengmucheng/modelfit-structured-llm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yichengmucheng/modelfit-structured-llm
- Repository: https://github.com/yichengmucheng/modelfit-structured-llm

## Overview

ModelFit (百擎) is a financial-risk modeling product concept and demo: analysts prepare samples, create and evaluate a TabPFN model, then publish a contract-backed model package for GPU-side validation and customer scoring. The repository demonstrates package production and target-side checks in two Python demos, and separately contains a UI prototype; the prototype’s controls are not wired to those demos. GPU deployment, approval/rollback, and the customer API are documented capabilities, not sampled implementations. The map distinguishes these documented stages from demonstrated code paths.

Main entry points: [`TabPFN-main/baiqing-web/src/App.tsx`](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/App.tsx) (Model workbench), [`README.md`](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/README.md) (GPU inference platform), [`demo_baiqing.py`](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_baiqing.py) (Package generation), [`demo_baiji.py`](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_baiji.py) (Package compliance)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analyst["Analyst workflow"]
  node_workbench["Model workbench<br/>[App.tsx]"]
  node_sample["Sample preparation<br/>[App.tsx]"]
  node_modeling["Model training<br/>[demo_baiqing.py]"]
  node_evaluation["Validation and inference<br/>[App.tsx]"]
  node_publication["Model publication<br/>[App.tsx]"]
end

subgraph group_package["Model package"]
  node_packagegen["Package generation<br/>[demo_baiqing.py]"]
  node_contracts["Model contracts<br/>[demo_baiqing.py]"]
  node_bundle["LDM model package<br/>[README.md]"]
end

subgraph group_serving["Serving and scoring"]
  node_compliance["Package compliance<br/>[demo_baiji.py]"]
  node_golden["Golden-case checks<br/>[demo_baiji.py]"]
  node_gpu["GPU inference platform<br/>[README.md]"]
  node_registry[("Deployment registry<br/>[README.md]")]
  node_score["Score mapping<br/>[score.py]"]
  node_api["Scoring API<br/>[README.md]"]
end

subgraph group_prototype["UI prototypes"]
  node_entry["React entry point<br/>[main.tsx]"]
  node_canvasstub["Canvas UI stubs"]
  node_flowcanvas["Guided-flow canvas"]
  node_redesign["UI redesign canvas"]
  node_ldmcanvas["LDM specification canvas"]
end

node_analyst(("Risk analyst"))
node_customer(("Customer API caller"))

node_analyst -->|"uses"| node_workbench
node_workbench -->|"starts"| node_sample
node_sample -.->|"provides samples"| node_modeling
node_analyst -->|"runs demo"| node_modeling
node_modeling -->|"fits model"| node_packagegen
node_packagegen -->|"generates"| node_contracts
node_packagegen -->|"writes package"| node_bundle
node_workbench -->|"offers step"| node_evaluation
node_workbench -->|"offers step"| node_publication
node_bundle -->|"loads"| node_compliance
node_compliance -->|"checks"| node_golden
node_golden -->|"validates migration"| node_gpu
node_gpu -->|"registers deployment"| node_registry
node_registry -->|"enables serving"| node_api
node_customer -->|"requests score"| node_api
node_api -->|"dispatches scoring"| node_gpu
node_gpu -.->|"maps probability"| node_score
node_entry -->|"renders"| node_workbench
node_workbench -->|"uses UI elements"| node_canvasstub
node_analyst -.->|"views prototype"| node_flowcanvas
node_analyst -.->|"views prototype"| node_redesign
node_analyst -.->|"views specification"| node_ldmcanvas

click node_workbench "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/App.tsx"
click node_sample "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/App.tsx"
click node_modeling "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_baiqing.py"
click node_evaluation "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/App.tsx"
click node_publication "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/App.tsx"
click node_packagegen "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_baiqing.py"
click node_contracts "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_baiqing.py"
click node_bundle "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/README.md"
click node_compliance "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_baiji.py"
click node_golden "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_baiji.py"
click node_gpu "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/README.md"
click node_registry "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/README.md"
click node_score "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_output/credit_risk_tab2.5_n1_f20_800/score.py"
click node_api "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/README.md"
click node_entry "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/main.tsx"
click node_canvasstub "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/cursor-canvas-stub.tsx"
click node_flowcanvas "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/canvases/baiqing-new-flow.canvas.tsx"
click node_redesign "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/canvases/baiqing-redesign.canvas.tsx"
click node_ldmcanvas "https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/canvases/ldm-migration-prd.canvas.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_workbench,node_sample,node_modeling,node_evaluation,node_publication toneBlue
class node_packagegen,node_contracts,node_bundle toneAmber
class node_compliance,node_golden,node_gpu,node_registry,node_score,node_api,node_customer toneMint
class node_entry,node_canvasstub,node_flowcanvas,node_redesign,node_ldmcanvas toneRose
class node_analyst toneIndigo
```

## Components

### Analyst workflow

- [Model workbench](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/App.tsx): `TabPFN-main/baiqing-web/src/App.tsx`
- [Sample preparation](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/App.tsx): `TabPFN-main/baiqing-web/src/App.tsx`
- [Model training](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_baiqing.py): `demo_baiqing.py`
- [Validation and inference](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/App.tsx): `TabPFN-main/baiqing-web/src/App.tsx`
- [Model publication](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/App.tsx): `TabPFN-main/baiqing-web/src/App.tsx`

### Model package

- [Package generation](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_baiqing.py): `demo_baiqing.py`
- [Model contracts](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_baiqing.py): `demo_baiqing.py`
- [LDM model package](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/README.md): `README.md`

### Serving and scoring

- [Package compliance](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_baiji.py): `demo_baiji.py`
- [Golden-case checks](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_baiji.py): `demo_baiji.py`
- [GPU inference platform](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/README.md): `README.md`
- [Deployment registry](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/README.md): `README.md`
- [Score mapping](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/demo_output/credit_risk_tab2.5_n1_f20_800/score.py): `demo_output/credit_risk_tab2.5_n1_f20_800/score.py`
- [Scoring API](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/README.md): `README.md`

### UI prototypes

- [React entry point](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/main.tsx): `TabPFN-main/baiqing-web/src/main.tsx`
- [Canvas UI stubs](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/baiqing-web/src/cursor-canvas-stub.tsx): `TabPFN-main/baiqing-web/src/cursor-canvas-stub.tsx`
- [Guided-flow canvas](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/canvases/baiqing-new-flow.canvas.tsx): `TabPFN-main/canvases/baiqing-new-flow.canvas.tsx`
- [UI redesign canvas](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/canvases/baiqing-redesign.canvas.tsx): `TabPFN-main/canvases/baiqing-redesign.canvas.tsx`
- [LDM specification canvas](https://github.com/yichengmucheng/modelfit-structured-llm/blob/main/TabPFN-main/canvases/ldm-migration-prd.canvas.tsx): `TabPFN-main/canvases/ldm-migration-prd.canvas.tsx`

### Other components

- **Risk analyst**
- **Customer API caller**

## Connections

- Risk analyst → Model workbench: uses (evidence: `README.md`)
- Model workbench → Sample preparation: starts (evidence: `README.md`)
- Sample preparation → Model training: provides samples
- Risk analyst → Model training: runs demo (evidence: `README.md`)
- Model training → Package generation: fits model (evidence: `demo_baiqing.py`)
- Package generation → Model contracts: generates (evidence: `demo_baiqing.py`)
- Package generation → LDM model package: writes package (evidence: `README.md`)
- Model workbench → Validation and inference: offers step (evidence: `README.md`)
- Model workbench → Model publication: offers step (evidence: `README.md`)
- LDM model package → Package compliance: loads (evidence: `demo_baiji.py`)
- Package compliance → Golden-case checks: checks (evidence: `demo_baiji.py`)
- Golden-case checks → GPU inference platform: validates migration (evidence: `README.md`)
- GPU inference platform → Deployment registry: registers deployment (evidence: `README.md`)
- Deployment registry → Scoring API: enables serving (evidence: `README.md`)
- Customer API caller → Scoring API: requests score (evidence: `README.md`)
- Scoring API → GPU inference platform: dispatches scoring (evidence: `README.md`)
- GPU inference platform → Score mapping: maps probability
- React entry point → Model workbench: renders (evidence: `TabPFN-main/baiqing-web/src/main.tsx`)
- Model workbench → Canvas UI stubs: uses UI elements (evidence: `TabPFN-main/baiqing-web/src/App.tsx`)
- Risk analyst → Guided-flow canvas: views prototype
- Risk analyst → UI redesign canvas: views prototype
- Risk analyst → LDM specification canvas: views specification
