PoCInnovation / PoCInnovation/MLBlock
Spec: UX Blocks Rework — Typage par Stages, Réduction du Catalogue et Expérience Visuelle Astryx
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Problem Statement
When learners build machine learning pipelines in MLBlock, they face high cognitive load and confusing errors:
- The Catalog presents 88 flat blocks across 13 technical categories without guidance on the machine learning lifecycle sequence.
- Connecting mismatched data types (such as a CSV
pd.DataFramedirectly to a neural layer expectingtorch.Tensor) causes immediate, opaque rejection (incompatible) without actionable suggestions. - Duplicate blocks with ephemeral weights vs persistent modules (issue #14,
conv2dvsconv2d_layer) lead to silent training failures. - Discrepancies between frontend and backend type classification produce unexpected validation behaviors on unions and image types.
Solution
A revamped Block Catalog and Stage-based Type System that provides a guided, safe, and friction-free experience:
- Reorganize the Catalog around 5 pedagogical Stages matching the standard ML workflow (
S0 Ingest,S1 Prepare,S2 Represent,S3 Train,S4 Eval, plus isolatedSX Worldfor RL). - Curate the default Catalog view from 88 to ~45 essential Blocks, moving specialized activation variants into a collapsed "Advanced" section.
- Implement a unified
TypeSystemFacade synchronized across backend and frontend with explicit conversion strategies. - Provide interactive assistance on the ReactFlow canvas: when connecting convertible ports, present an Astryx confirmation popover offering to automatically insert the intermediary adapter Block (e.g.,
df_to_tensor), and display visual Stage badges on each Block. - Guarantee complete coverage of 12 canonical reference Pipelines sourced from official documentation (PyTorch, scikit-learn, Gymnasium).
User Stories
- As a learner, I want to view Blocks in the palette organized by the 5 stages of the ML lifecycle (Ingest, Prepare, Represent, Train, Eval), so that I understand which Block to place next.
- As a learner, I want the default palette to display only essential Blocks (~45), so that I am not overwhelmed by dozens of rare activation functions and duplicate blocks.
- As a learner, I want to expand an "Advanced" palette drawer when needed, so that I can still access specialized activation functions or advanced utilities.
- As a learner, I want to see a clear visual Stage badge (e.g. S0, S1, S2, S3, S4, SX) on each placed Block on the canvas, so that I can easily track the architectural flow of my Pipeline.
- As a learner, when I connect two convertible ports (e.g.,
pd.DataFrametotorch.Tensor), I want an Astryx confirmation popover to appear at the cursor, so that I can confirm inserting the required converter Block with a single click. - As a learner, when I accept the conversion suggestion in the Astryx popover, I want the adapter Block (e.g.,
df_to_tensor) to be automatically placed between the two Blocks with the connecting edges rewired, so that my Pipeline remains valid without manual lookup. - As a learner, when I cancel or dismiss the Astryx conversion popover, I want the invalid connection to be aborted cleanly, so that my canvas does not enter an erroneous state.
- As a learner, when I attempt an impossible connection (e.g.,
torch.optim.Optimizerinto a data loader port), I want a descriptive explanation of the type mismatch rather than an unexplained red highlight, so that I understand why the connection is disallowed. - As a learner building an image classifier (CIFAR-10), I want to connect convolutional layers (
conv2d_layer) that retain persistent weights during optimization, so that my model trains properly without weight disappearance bugs. - As a learner following the official PyTorch tutorials, I want reference examples (such as CIFAR-10 Blitz, Fashion-MNIST Quickstart, and MNIST from scratch) to be fully supported by the Catalog, so that I can reproduce standard educational benchmarks.
- As a learner following scikit-learn tutorials, I want tabular Pipelines (Logistic Regression, PCA 4D→2D, and K-Means clustering on Iris) to validate cleanly without requiring artificial neural network training components, so that classic ML workflows remain simple.
- As a learner exploring reinforcement learning, I want tabular Q-learning on CartPole to run within an isolated
SX Worldstage, so that environment and policy ports are protected from accidental tensor pipeline connections. - As a developer, I want a single
TypeSystemFacade governing type classifications on both frontend and backend, so that validation verdicts never disagree between the canvas and the execution engine. - As a developer, I want existing saved Pipelines using deprecated tensor blocks to be transparently handled via Adapters, so that existing user projects continue to load and execute.
Implementation Decisions
-
Staged Pipeline Architecture (ADR 0001):
- The ML lifecycle is structured into 5 standard Stages:
S0 Ingest(data ingestion),S1 Prepare(preprocessing / conversions),S2 Represent(S2ADeep Learning modules /S2BClassical ML models),S3 Train(S3ADL training loops /S3BML fitting),S4 Eval(metrics and visualization), alongsideSX World(RL environment/policy isolation). - In Stage
S2A, two conceptual sub-states are recognized without adding extra stages:S2A-CNN(vision/convolutions) andS2A-Seq(NLP/embeddings/recurrent networks).
- The ML lifecycle is structured into 5 standard Stages:
-
Unified TypeSystem Facade:
- Single point of truth for port compatibility, family mapping (
family_of), Stage association (stage_of), and conversion graph resolution. - Exact mirror implementation in frontend TypeScript ensuring parity on complex dtypes (including PIL images, sequence lists, and union dtypes like
pd.DataFrame | numpy.ndarray).
- Single point of truth for port compatibility, family mapping (
-
Catalogue Reduction (~45 Blocks):
- Pure stateless functional operations are merged into their canonical module counterparts (
relu_layer,maxpool2d_layer,flatten_layer). - Deprecate standalone weightless tensor operations (
conv2d,linear) in favor of*_layercounterparts (resolving issue #14). - Collapse advanced activation variants (
gelu,selu,mish,elu, etc.) into an accessible sub-group.
- Pure stateless functional operations are merged into their canonical module counterparts (
-
Frontend UX via Astryx:
- The connection drop event on a
convertibleedge triggers an interactive Astryx Popover dialog: "Type convertible détecté : insérer automatiquement le bloc adaptateur [Nom] ?" with[Insérer]and[Annuler]actions. - Astryx badge rendering on
BlockNodeindicating the node's Stage (S0..S4,SX) with themed color accents. - Palette accordion grouped by the 5 Stages, with an expandable drawer for Advanced Blocks.
- The connection drop event on a
-
Reference Execution Matrix:
- 12 reference Pipelines (A1-A7 DL, B1-B3 ML, C1-C2 RL) codified in standard JSON format acting as regression acceptance suites.
- CartPole DQN (C2) is classified as a P1 feature needing a future
Adapter env ↔ tensor, keeping the initial v1 focus on C1 tabular isolation.
Testing Decisions
- Good test criteria: Tests must exercise the external interfaces of the validation and typing systems with full Pipeline payloads, avoiding coupling to internal AST traversal or catalog indexing internals.
- Backend testing: Exercised through
mlblock.validation.validate(pipeline_payload). Tests will execute against all 12 reference Pipelines and assert topological validity, Stage ordering checks (stage(dst) < stage(src)rejections), and port family verdicts. - Frontend testing: Exercised through Vitest specs mirroring
test_types.pyfor type parity (typeCheck.test.ts), verifying conversion graph reachability, and verifying adapter node insertion logic on document state. - Prior art: Existing unit suites in
backend/mlblock/tests/test_validation.pyandfrontend/src/utils/typeCheck.test.ts.
Out of Scope
- Sub-pipeline nesting (Composite pattern) or multi-canvas tabs.
- Dynamic GPU execution scheduler changes (execution protocol remains untouched).
- Implementation of the P1
Adapter env ↔ tensorbridge for CartPole DQN (deferred post-v1). - Visual canvas theme alterations beyond Astryx badge and popover integration.
Further Notes
- Tracked under roadmap
docs/UX_Blocks_Rework/and ADRdocs/adr/0001-staged-typing.md. - Directly addresses open issue #14.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with docs/adr/0001-staged-typing.md, backend/mlblock/tests/test_validation.py, and frontend/src/utils/typeCheck.test.ts. Run the existing backend and Vitest suites, then trace the validation and type-checking entry points before splitting the staged catalog, facade, and connection UX work. Done means the 12 reference pipelines and frontend parity tests pass, with adapter insertion and stage validation covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch, react, scikit-learn, typescript
- Domain
- backend, frontend, machine-learning, testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100