Spaces:
Running
Running
Commit Β·
bdf376b
1
Parent(s): f7185ba
Moved environment files to repository root for HF Space compatibility
Browse filesFiles changed (23)
- MixedPrecisionEnv/.env.example β .env.exampleRenamed
- .gitignore+26-8
- DETAILED_PROJECT_CONTEXT.mdAdded+1002
- MixedPrecisionEnv/Dockerfile β DockerfileRenamed
- HACKATHON_RESEARCH.mdAdded+36
- MixedPrecisionEnv/.gitignoreDeleted-41
- MixedPrecisionEnv/README.md β README.mdRenamed
- Untitled-2026-04-02-2056.excalidrawAdded+2183
- MixedPrecisionEnv/app/__init__.py β app/__init__.pyRenamed
- MixedPrecisionEnv/app/main.py β app/main.pyRenamed
- MixedPrecisionEnv/app/models.py β app/models.pyRenamed
- MixedPrecisionEnv/app/routes/__init__.py β app/routes/__init__.pyRenamed
- MixedPrecisionEnv/environment/__init__.py β environment/__init__.pyRenamed
- MixedPrecisionEnv/environment/mixed_precision_env.py β environment/mixed_precision_env.pyRenamed
- MixedPrecisionEnv/environment/physics_model.py β environment/physics_model.pyRenamed
- MixedPrecisionEnv/inference.py β inference.pyRenamed+64-45
- MixedPrecisionEnv/openenv.yaml β openenv.yamlRenamed
- MixedPrecisionEnv/requirements.txt β requirements.txtRenamed
- MixedPrecisionEnv/scenarios/__init__.py β scenarios/__init__.pyRenamed
- MixedPrecisionEnv/scenarios/loader.py β scenarios/loader.pyRenamed
- MixedPrecisionEnv/scenarios/task1_scenarios.py β scenarios/task1_scenarios.pyRenamed
- MixedPrecisionEnv/scenarios/task2_scenarios.py β scenarios/task2_scenarios.pyRenamed
- MixedPrecisionEnv/scenarios/task3_scenarios.py β scenarios/task3_scenarios.pyRenamed
12234556789910111213141011121314151617181920212223242526272829303132333435363738394041# =============================================================# FigureOut β Root .gitignore# Mixed Precision Training Environment β .gitignore# =============================================================
# --- Secrets ---# --- Secrets (NEVER commit) ---.env*.env.local*.env.*.local
# --- Scratch / research files (not for the submission) ---DETAILED_PROJECT_CONTEXT.mdHACKATHON_RESEARCH.md*.excalidraw
# --- Python & venvs ---# --- Python ---__pycache__/*.py[cod]*.pyo*.pyd.Python*.egg*.egg-info/dist/build/.eggs/
# --- Virtual environments ---venv/.venv/env/ENV/
# --- IDE ---.vscode/.idea/*.swp*.swo.DS_Store
# --- Logs & temp ---*.log*.tmp*.bak
# --- Safe to commit ---# .env.example β intentionally NOT ignored (it's the safe template)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002# Mixed Precision Training Configuration β OpenEnv Environment**Hackathon:** Scalar Γ Meta PyTorch OpenEnv Hackathon 2026 **Submission Deadline:** April 8, 2026 (submitting April 7) **Participant:** Solo **Success Probability:** 75%
---
## Table of Contents1. [Terminology & Concepts](#1-terminology--concepts)2. [The Problem Domain](#2-the-problem-domain)3. [Environment Design: 3 Tasks Per Episode](#3-environment-design-3-tasks-per-episode)4. [Grader Design](#4-grader-design)5. [Scenario Design (25 Pre-Built)](#5-scenario-design-25-pre-built)6. [OpenEnv Specification](#6-openenv-specification)7. [Baseline Agent](#7-baseline-agent)8. [Project Structure](#8-project-structure)9. [Pre-Submission Checklist](#9-pre-submission-checklist)10. [Scoring Rubric](#10-scoring-rubric)11. [5-Day Build Timeline](#11-5-day-build-timeline)
---
# 1. Terminology & Concepts
Before diving into the project, here's every term you need to understand. This is your reference glossary.
---
## 1.1 Floating Point Precision Formats
Computers represent decimal numbers using **floating-point** formats. Each format uses a fixed number of **bits** (binary digits) to store a number, split into three parts:
```ββββββββ¬βββββββββββββββ¬ββββββββββββββββββββ Sign β Exponent β Mantissa ββ 1bit β (range) β (precision) βββββββββ΄βββββββββββββββ΄βββββββββββββββββββ```
- **Sign bit:** Is the number positive or negative? (1 bit)- **Exponent:** How large/small is the number? (determines **dynamic range**)- **Mantissa (Significand):** How precise is the number? (determines **accuracy**)
### FP32 β Single Precision (32 bits)```Format: 1 sign + 8 exponent + 23 mantissa = 32 bitsMemory: 4 bytes per numberRange: Β±1.18 Γ 10β»Β³βΈ to Β±3.40 Γ 10Β³βΈPrecision: ~7 decimal digits```- **The gold standard** for neural network training- Every parameter, gradient, and activation is stored in FP32 by default- **Pros:** Very accurate, huge range, no stability issues- **Cons:** Slow computation, uses the most memory (4 bytes per value)- **Used for:** Master weight copies, loss computation, gradient accumulation
### FP16 β Half Precision (16 bits)```Format: 1 sign + 5 exponent + 10 mantissa = 16 bitsMemory: 2 bytes per number (50% savings vs FP32)Range: Β±6.10 Γ 10β»β΅ to Β±65,504Precision: ~3.3 decimal digits```- **The workhorse** of mixed precision training- 2Γ less memory, 2-8Γ faster computation on modern GPUs (Tensor Cores)- **Pros:** Fast, good enough for most forward/backward pass operations- **Cons:** Limited range β very small gradients (< 6.1Γ10β»β΅) become zero (**underflow**)- **Requires:** Loss scaling to prevent gradient underflow- **Used for:** Attention layers, layer normalization, most computation
### BF16 β Brain Floating Point (16 bits)```Format: 1 sign + 8 exponent + 7 mantissa = 16 bitsMemory: 2 bytes per number (50% savings vs FP32)Range: Same as FP32 (Β±1.18 Γ 10β»Β³βΈ to Β±3.40 Γ 10Β³βΈ)Precision: ~2.4 decimal digits (less precise than FP16!)```- Invented by Google Brain β same range as FP32, but lower precision- **Pros:** No loss scaling needed (same range as FP32), drop-in replacement- **Cons:** Less precise than FP16 (only 7 mantissa bits vs 10)- **Used for:** When FP16 underflows too much; popular in LLaMA, GPT training
### FP8 β Quarter Precision (8 bits)```Two variants: E4M3: 1 sign + 4 exponent + 3 mantissa = 8 bits (more precision) E5M2: 1 sign + 5 exponent + 2 mantissa = 8 bits (more range)
Memory: 1 byte per number (75% savings vs FP32)Range: E4M3: Β±448, E5M2: Β±57,344Precision: ~1-2 decimal digits```- **Cutting edge** β only works on H100/H200 GPUs and newer- 4Γ less memory than FP32, potential 2Γ speedup over FP16- **Pros:** Maximum speed and memory savings- **Cons:** Very risky β can cause NaN/divergence if used on sensitive layers- **Used for:** FFN (feed-forward) layers with normalized inputs, where values are bounded
### Comparison Table
| Format | Bits | Bytes | Speed vs FP32 | Memory vs FP32 | Stability Risk | Best For ||--------|------|-------|---------------|----------------|----------------|----------|| FP32 | 32 | 4 | 1.0Γ | 100% | None | Embeddings, loss, master weights || BF16 | 16 | 2 | 2-4Γ | 50% | Low | General training (modern GPUs) || FP16 | 16 | 2 | 2-8Γ | 50% | Medium | Attention, normalized layers || FP8 | 8 | 1 | 4-16Γ | 25% | High | FFN layers with bounded values |
---
## 1.2 Neural Network Layer Types
### Embedding Layer```What it does: Converts token IDs (integers) into dense vectorsExample: Token "hello" (ID: 5923) β [0.012, -0.034, 0.089, ...]Values range: Tiny, unbounded (0.001 to 0.1 typically)Gradients: Very small (1e-5), high variance```- **Why FP32:** Gradients are so small they underflow to 0 in FP16/FP8, killing learning- **This is the first layer** β errors here propagate through the entire model
### Attention Layer (Self-Attention / Multi-Head Attention)```What it does: Lets the model "look at" all other tokens to understand contextComputation: Q Γ K^T / βd_k β Softmax β Γ VValues range: Normalized by LayerNorm, typically [-2, +2]Gradients: Medium magnitude, stable```- **Why FP16/BF16:** Values are normalized, midrange β FP16 handles this well- Contains the famous **Q, K, V** (Query, Key, Value) matrices
### Feed-Forward Network (FFN) Layer```What it does: Applies non-linear transformation: FFN(x) = GELU(xWβ + bβ)Wβ + bβValues range: Normalized inputs, bounded outputs [-1, +1]Gradients: Stable, well-behaved```- **Why FP8 is possible:** After LayerNorm, values are bounded β FP8 can represent them- **Largest compute cost** in a transformer β using FP8 here gives maximum speedup- **Risk:** If values occasionally spike, FP8 clips them β NaN propagation
### LayerNorm (Layer Normalization)```What it does: Normalizes activations to mean=0, variance=1Formula: LayerNorm(x) = (x - ΞΌ) / β(ΟΒ² + Ξ΅) Γ Ξ³ + Ξ²Values range: Output always centered around 0, spread ~[-3, +3]```- **Why FP16:** Normalization keeps values in a safe range for FP16- **Critical role:** Makes downstream layers (attention, FFN) safe for lower precision
### Output / LM Head Layer```What it does: Final projection to vocabulary size, produces logits for next tokenValues range: Can be large (logits range: -100 to +100)Gradients: Must be precise for correct loss computation```- **Why FP32:** Loss computation (cross-entropy) requires high precision- Wrong loss β wrong gradients β model learns the wrong thing
---
## 1.3 Training Concepts
### LossThe **loss** is a single number that measures how wrong the model's predictions are.- **Lower loss = better model**- Training minimizes loss over many iterations (steps)- Example: Cross-entropy loss for language models
### Loss Curve / Training Trajectory```A sequence of loss values over training steps:
Step 0: loss = 4.50 β Random model, high lossStep 100: loss = 3.20 β Learning patternsStep 500: loss = 1.50 β Getting betterStep 1000: loss = 0.87 β ConvergingStep 1500: loss = 0.85 β Almost converged```- **Healthy curve:** Monotonically decreasing, eventually plateaus- **Unstable curve:** Spikes, oscillations, or sudden NaN
### NaN (Not a Number)When a computation produces an invalid result (0/0, β-β, overflow):```Step 95: loss = 0.87Step 96: loss = 0.86Step 97: loss = 1e+15 β Explosion startsStep 98: loss = inf β OverflowStep 99: loss = NaN β Training is dead π```- **FP8 cause:** Small gradient underflows to 0 β division by zero β NaN- **FP16 cause:** Large activation overflows past 65,504 β inf β NaN- **Once NaN appears, training cannot recover** β it propagates everywhere
### GradientThe gradient tells each parameter how to change to reduce the loss:```gradient = βLoss / βparameter
If gradient is: +0.01 β decrease this parameter slightly -0.05 β increase this parameter more 0.0 β don't change (could be underflow!)```- **Gradient underflow:** When using FP16/FP8, very small gradients (< 6.1Γ10β»β΅) round to 0- **Gradient explosion:** When gradients become very large (> 65,504 in FP16) β inf β NaN
### Loss ScalingA technique to prevent gradient underflow in FP16:```1. Multiply loss by a large number (e.g., 1024) before backward pass2. This scales all gradients up by 1024Γ3. After computing gradients, divide by 1024 to get real values4. Now small gradients that would have been 0 are representable```- **Dynamic loss scaling:** Automatically adjusts the scale factor- **Not needed for BF16** (same exponent range as FP32)
### Mixed Precision Training (The Core Concept)Instead of using one precision for everything, **strategically mix** precisions:```ββββββββββββββββββββββββββββββββββββββββββββββββββββ Mixed Precision Pipeline ββ ββ Master Weights (FP32) ββ β cast to FP16 ββ Forward Pass (FP16) βββ Loss (FP32) ββ β β ββ Backward Pass (FP16) βββ Scaled Loss ββ β ββ Gradients (FP16) βββ Unscale βββ FP32 Gradientsββ β ββ Update Master Weights (FP32) ββββββββββββββββββββββββββββββββββββββββββββββββββββ```- **Per-layer precision:** Our environment goes further β each layer gets its own precision- This is what the RL agent must learn to configure
---
## 1.4 RL & OpenEnv Concepts
### Reinforcement Learning (RL)An agent learns by trial and error:```Agent ββ(action)βββ Environment ββ(observation + reward)βββ Agent β β ββββββββββββββββββββββββββββββββββββββ```- **Agent:** The AI that makes decisions (our baseline = rule-based agent)- **Environment:** The simulation (our mixed precision training simulator)- **Action:** What the agent does (assign FP32/FP16/FP8 to each layer)- **Observation:** What the agent sees (model architecture, loss curves, constraints)- **Reward:** Score for how good the action was (our grader computes this)
### EpisodeOne complete run through all tasks:```Episode = Reset β Task 1 β Task 2 β Task 3 β Done```Our environment has 3 tasks per episode, 25 scenarios total.
### OpenEnv FrameworkMeta's standard for packaging RL environments:- **Gymnasium-compatible API:** `reset()`, `step()`, `state()`- **Containerized:** Runs inside Docker- **HTTP endpoints:** `/tasks`, `/baseline`, `/grader` β accessible via REST API- **Deployed on:** HuggingFace Spaces- **Graders:** Must be **deterministic** β same input always produces same score
### GraderThe function that scores an agent's action:```pythondef grader(agent_action, ground_truth) -> float: # Returns a score (0-100) # MUST be deterministic (no randomness, no LLM calls)```- Our graders use **lookup tables** β pre-computed correct answers- This makes them fast, deterministic, and easy to validate
### Baseline AgentA simple, non-AI agent that demonstrates the environment works:```pythonclass BaselineAgent: def act(self, observation): # Simple rules, no ML needed if layer_type == "embedding": return "FP32" # Always safe elif layer_type == "attention": return "FP16" # Usually works ...```- Must score > 0 on at least one task (proves environment is solvable)- Judges use it to understand the environment quickly
---
## 1.5 Infrastructure Concepts
### DockerA container system that packages code + dependencies into a single image:```Dockerfile β docker build β Docker Image β docker run β Running Container```- **Why:** Ensures judges can run your environment on any machine- **Requirement:** Your Dockerfile must build without errors
### HuggingFace SpacesA platform to deploy and host ML applications:- **Your environment runs here** as a web service- Judges access your `/tasks`, `/baseline`, `/grader` endpoints- Must deploy successfully to be eligible for scoring
### API Endpoints (Required)```GET /tasks β Returns list of task IDs and descriptionsPOST /baseline β Runs baseline agent, returns actions + scoresPOST /grader β Accepts agent actions, returns scoresPOST /reset β Resets environment to new episodePOST /step β Executes one step in the environment```
---
# 2. The Problem Domain
## What Problem Are We Solving?
Training large neural networks is expensive. The #1 lever for reducing cost is **mixed precision training** β strategically using lower-precision number formats (FP16, FP8) instead of FP32 for different layers.
**Today:** ML engineers manually choose precision per layer through trial and error (takes days of experimentation per model).
**Our environment:** An RL agent learns the optimal precision assignment in seconds.
### Real-World Impact```Training a 7B parameter model (like LLaMA-7B):
β Naive approach (FP32 everywhere): Memory: 120 GB VRAM Time: 21 days on 8ΓA100 Cost: $50,000 Status: Doesn't fit on most GPU clusters
β
Smart mixed precision (what our agent learns): Memory: 45 GB VRAM (62% reduction) Time: 7 days (3Γ faster) Cost: $15,000 (70% savings) Status: Fits on a single A100```
### Why Meta Cares- Meta trains models like **LLaMA** (7B to 405B parameters)- Every training run costs **$1M-$100M** in compute- A 30% memory reduction saves **millions of dollars** per run- Mixed precision configuration is done manually today β **this is a real pain point**
---
# 3. Environment Design: 3 Tasks Per Episode
Each episode presents a model training scenario. The agent must complete 3 sequential tasks:
```Episode Flow:ββββββββββββ ββββββββββββββββ βββββββββοΏ½οΏ½βββββββββ Task 1 ββββββ Task 2 ββββββ Task 3 ββ Precision β β Instability β β Multi-Objective ββAssignment β β Detection β β Optimization βββββββββββββ ββββββββββββββββ ββββββββββββββββββ```
---
### Task 1: Static Precision Assignment
**Goal:** Assign FP32/FP16/FP8 to each layer of a given model architecture.
**What the agent sees (observation):**```json{ "scenario_id": "gpt2_1.5b", "model_architecture": [ { "layer_type": "embedding", "name": "token_embedding", "num_params": 300000000, "gradient_sensitivity": "high_variance", "activation_range": "unbounded" }, { "layer_type": "attention_block", "name": "attention_0", "num_params": 200000000, "gradient_sensitivity": "medium", "activation_range": "normalized" }, { "layer_type": "ffn", "name": "ffn_0", "num_params": 300000000, "gradient_sensitivity": "stable", "activation_range": "normalized" }, { "layer_type": "output", "name": "lm_head", "num_params": 200000000, "gradient_sensitivity": "high_precision_critical", "activation_range": "loss_computation" } ], "memory_budget_gb": 40, "speed_target_speedup": 2.5, "accuracy_threshold": 0.995}```
**What the agent outputs (action):**```json{ "precision_config": { "token_embedding": "FP32", "attention_0": "FP16", "ffn_0": "FP8", "lm_head": "FP32" }, "reasoning": "High-variance embedding needs FP32. Normalized attention safe for FP16. Stable FFN can handle FP8. Output must be FP32 for loss computation."}```
**Scoring:**- Exact match with optimal config β **100 points** + efficiency bonus- Valid alternative (stable but suboptimal) β **50-90 points**- Unstable config (would cause NaN) β **0 points**
---
### Task 2: Detecting Precision-Induced Instability
**Goal:** Given a training loss trajectory, detect if/when instability occurs and identify the cause.
**What the agent sees (observation):**```Training loss trajectory (100 steps):Step 0: loss = 4.50Step 10: loss = 3.20Step 20: loss = 2.15Step 50: loss = 1.20Step 75: loss = 0.98Step 95: loss = 0.87Step 100: loss = NaN π
Current precision config from Task 1```
**What the agent outputs (action):**```json{ "instability_detected": true, "step_detected": 95, "likely_cause": "FFN layer FP8 precision loss accumulating", "recommendation": "Change FFN layers to FP16", "confidence": 0.78}```
**Scoring:**- Correct detection (unstable/stable) β **30 points**- Early detection (before failure) β **+20 points**- Correct root cause identification β **+40 points**- Total possible: **90 points**
---
### Task 3: Multi-Objective Optimization
**Goal:** Given hard constraints (memory, time, accuracy), find the best precision strategy.
**What the agent sees (observation):**```json{ "constraints": { "memory_budget_gb": 24, "time_budget_days": 7, "accuracy_threshold": 0.98, "dataset_size": "2T tokens", "model": "GPT-3.5-class (175B params)" }, "current_baseline": { "all_fp32": { "memory_gb": 140, "time_days": 21, "accuracy": 1.0 } }}```
**What the agent outputs (action):**```json{ "precision_strategy": { "embedding": "FP32", "transformer_blocks": ["FP16", "FP16", "FP8", "FP8"], "output": "FP32" }, "predicted_metrics": { "memory_gb": 22, "time_days": 6.5, "accuracy": 0.989, "efficiency_gain": "2.8x faster, 6x less memory" }, "tradeoff_reasoning": "Fits 24GB budget. FP8 on FFN layers provides maximum speedup. Accuracy stays above 0.98 threshold."}```
**Scoring:**- Memory within budget β **20 points**- Time within budget β **20 points**- Accuracy above threshold β **20 points**- Pareto optimality (closeness to ideal) β **up to 40 points**- Total possible: **100 points**
---
# 4. Grader Design
All graders are **deterministic** β no randomness, no LLM calls, same input β same output.
### Task 1 Grader: Precision Config Grader```pythondef grade_precision_assignment(agent_config, scenario_id): """Lookup-table based grading""" ground_truth = PRECISION_CONFIGS_LOOKUP[scenario_id] # First: is the config stable? (won't cause NaN) if not is_stable_config(agent_config): return 0 # Unstable config = instant fail if agent_config == ground_truth["optimal"]: return 100 + efficiency_bonus(agent_config, scenario_id) else: # Partial credit for valid alternatives efficiency = compute_efficiency(agent_config) optimal_efficiency = compute_efficiency(ground_truth["optimal"]) return 50 + int((efficiency / optimal_efficiency) * 50)
def is_stable_config(config): """Rule-based stability validation""" STABILITY_RULES = { "embedding": ["FP32"], # MUST be FP32 "attention": ["FP16", "BF16", "FP32"], # FP16+ "ffn": ["FP8", "FP16", "BF16", "FP32"], # Any "layernorm": ["FP16", "BF16", "FP32"], # FP16+ "output": ["FP32"], # MUST be FP32 } for layer_type, allowed in STABILITY_RULES.items(): if config.get(layer_type) not in allowed: return False return True```
### Task 2 Grader: Instability Detection Grader```pythondef grade_instability_detection(agent_output, ground_truth): score = 0 # Correct detection (+30) if agent_output["instability_detected"] == ground_truth["is_unstable"]: score += 30 # Early detection bonus (+20 or +10) if ground_truth["is_unstable"]: failure_step = ground_truth["failure_step"] detected_step = agent_output["step_detected"] if detected_step < failure_step - 5: score += 20 # Caught it early elif detected_step <= failure_step: score += 10 # Caught it on time # Root cause identification (+40) cause_keywords = set(ground_truth["cause_keywords"]) agent_keywords = set(agent_output["likely_cause"].lower().split()) overlap = len(cause_keywords & agent_keywords) if overlap >= len(cause_keywords) * 0.5: score += 40 elif overlap > 0: score += 20 return score```
### Task 3 Grader: Multi-Objective Grader```pythondef grade_multi_objective(agent_strategy, constraints, ground_truth): score = 0 metrics = agent_strategy["predicted_metrics"] # Constraint satisfaction (20 each) if metrics["memory_gb"] <= constraints["memory_budget_gb"]: score += 20 if metrics["time_days"] <= constraints["time_budget_days"]: score += 20 if metrics["accuracy"] >= constraints["accuracy_threshold"]: score += 20 # Pareto distance scoring (0-40) pareto_distance = compute_pareto_distance( metrics, ground_truth["pareto_frontier"] ) score += max(0, int(40 * (1 - pareto_distance))) return score```
---
# 5. Scenario Design (25 Pre-Built)
### Category 1: Small Models (5 scenarios)| ID | Model | Params | Key Challenge ||----|-------|--------|---------------|| `small_1` | GPT-2 Small | 125M | Basic precision assignment || `small_2` | BERT Base | 110M | Bidirectional attention || `small_3` | DistilGPT-2 | 82M | Already compressed model || `small_4` | GPT-2 Medium | 355M | More layers, more decisions || `small_5` | T5 Small | 60M | Encoder-decoder architecture |
### Category 2: Medium Models (5 scenarios)| ID | Model | Params | Key Challenge ||----|-------|--------|---------------|| `medium_1` | GPT-2 XL | 1.5B | Large attention layers || `medium_2` | LLaMA-1.3B | 1.3B | Modern architecture || `medium_3` | Mistral-1.5B | 1.5B | Grouped-query attention || `medium_4` | Phi-2 | 2.7B | Efficient architecture || `medium_5` | CodeLLaMA-3B | 3B | Code-specific model |
### Category 3: Large Models (5 scenarios)| ID | Model | Params | Key Challenge ||----|-------|--------|---------------|| `large_1` | LLaMA-7B | 7B | Standard large model || `large_2` | LLaMA-13B | 13B | Memory-critical || `large_3` | Falcon-40B | 40B | Extreme memory pressure || `large_4` | LLaMA-70B | 70B | Multi-GPU required || `large_5` | GPT-175B | 175B | Maximum scale challenge |
### Category 4: Instability Scenarios (5 scenarios)| ID | Failure Type | Steps to NaN | Root Cause ||----|-------------|-------------|------------|| `unstable_1` | Gradient underflow | Step 847 | FP8 on embedding || `unstable_2` | Activation overflow | Step 234 | FP16 on unbounded FFN || `unstable_3` | Loss explosion | Step 1500 | Accumulated rounding error || `unstable_4` | Slow divergence | Step 5000 | FP8 attention with long context || `unstable_5` | Stable (no failure) | N/A | Correctly configured |
### Category 5: Multi-Objective Constraint Scenarios (5 scenarios)| ID | Memory Budget | Time Budget | Accuracy Floor | Difficulty ||----|--------------|-------------|----------------|------------|| `constraint_1` | 24 GB | 7 days | 0.98 | Tight memory || `constraint_2` | 80 GB | 3 days | 0.99 | Tight time || `constraint_3` | 16 GB | 14 days | 0.995 | Extreme memory || `constraint_4` | 40 GB | 5 days | 0.97 | Balanced || `constraint_5` | 8 GB | 30 days | 0.99 | Edge device |
---
# 6. OpenEnv Specification
```yaml# openenv.yamlname: MixedPrecisionTrainingEnvironmentversion: 1.0.0description: > RL environment for optimizing neural network training with mixed precision (FP32/FP16/BF16/FP8). Agent learns to assign precision formats to each layer of a transformer model to maximize training speed and minimize memory while maintaining accuracy.
tasks: - id: precision_assignment description: "Assign precision (FP32/FP16/FP8) to each layer of a model" observation_space: type: dict properties: model_architecture: type: array items: type: dict memory_budget_gb: type: number speed_target: type: number action_space: type: dict properties: precision_config: type: dict values: ["FP32", "FP16", "BF16", "FP8"] reward_function: "precision_config_grader"
- id: instability_detection description: "Detect precision-induced training instability from loss trajectories" observation_space: type: dict properties: training_loss_trajectory: type: array items: type: number current_config: type: dict step_count: type: integer action_space: type: dict properties: instability_detected: type: boolean step_detected: type: integer recommended_fix: type: string reward_function: "stability_detector_grader"
- id: multi_objective_optimization description: "Optimize memory/time/accuracy trade-offs under constraints" observation_space: type: dict properties: constraints: type: dict model_specs: type: dict action_space: type: dict properties: precision_strategy: type: dict predicted_metrics: type: dict reward_function: "pareto_optimizer_grader"
graders: - id: precision_config_grader type: lookup_table + stability_check implementation: graders/precision_grader.py
- id: stability_detector_grader type: trajectory_analysis implementation: graders/stability_grader.py
- id: pareto_optimizer_grader type: multi_objective_scoring implementation: graders/pareto_grader.py
episodes: - id: training_episode num_steps: 3 scenarios: 25 scenario_sampling: stratified_by_model_size
baseline_agent: agents/baseline_agent.py```
---
# 7. Baseline Agent
```python# agents/baseline_agent.pyimport numpy as np
class MixedPrecisionBaseline: """Rule-based baseline agent for Mixed Precision environment. Uses simple heuristics based on layer type to assign precision. No ML required β demonstrates the environment is solvable. """ def __init__(self): self.layer_rules = { "embedding": "FP32", # Always needs full precision (tiny gradients) "attention": "FP16", # Normalized activations, safe for FP16 "ffn": "FP8", # Robust to quantization after LayerNorm "output": "FP32", # Critical for loss computation "layernorm": "FP16", # Stabilizes values, safe for FP16 } def task_1_precision_assignment(self, model_architecture): config = {} for layer in model_architecture: layer_type = layer["type"] config[layer["name"]] = self.layer_rules.get(layer_type, "FP16") return {"precision_config": config} def task_2_instability_detection(self, loss_trajectory, current_config): losses = np.array(loss_trajectory) # Check for NaN if np.any(np.isnan(losses)): nan_step = int(np.argmax(np.isnan(losses))) return { "instability_detected": True, "step_detected": nan_step, "likely_cause": "Precision loss accumulation in low-precision layers", "recommendation": "Increase precision on FFN layers from FP8 to FP16", "confidence": 0.8 } # Check for loss explosion if len(losses) > 10 and losses[-1] > losses[0] * 100: return { "instability_detected": True, "step_detected": len(losses) - 1, "likely_cause": "Gradient explosion from precision overflow", "recommendation": "Use FP32 for gradient accumulation", "confidence": 0.6 } return { "instability_detected": False, "step_detected": len(losses), "likely_cause": "None", "recommendation": "No action needed", "confidence": 0.9 } def task_3_multi_objective(self, constraints, model_specs): mem_budget = constraints["memory_budget_gb"] baseline_mem = model_specs.get("baseline_memory_gb", 100) if mem_budget < baseline_mem * 0.3: # Aggressive: need maximum compression strategy = { "embedding": "FP32", "attention": "FP16", "ffn": "FP8", "output": "FP32" } speedup, mem_saved, accuracy = 2.8, 60, 0.995 else: # Conservative: prioritize stability strategy = { "embedding": "FP32", "attention": "FP16", "ffn": "FP16", "output": "FP32" } speedup, mem_saved, accuracy = 1.8, 35, 0.999 return { "precision_strategy": strategy, "predicted_metrics": { "speedup": speedup, "memory_saved_percent": mem_saved, "accuracy": accuracy } }```
---
# 8. Project Structure
```MixedPrecisionEnv/ββββ README.md # Project overview, setup, usageβββ openenv.yaml # OpenEnv manifest (required)βββ Dockerfile # Container definition (required)βββ requirements.txt # Python dependenciesβββ .env.example # Environment variable templateββββ app/ # Main application (FastAPI server)β βββ __init__.pyβ βββ main.py # FastAPI app, all endpointsβ βββ config.py # App configurationβ βββ routes/β βββ __init__.pyβ βββ tasks.py # GET /tasks endpointβ βββ baseline.py # POST /baseline endpointβ βββ grader.py # POST /grader endpointβ βββ environment.py # POST /reset, /step endpointsββββ environment/ # Core RL environmentβ βββ __init__.pyβ βββ mixed_precision_env.py # Main Gymnasium-compatible env classβ βββ state.py # Environment state managementβ βββ utils.py # Helper functionsββββ scenarios/ # Pre-built training scenariosβ βββ __init__.pyβ βββ scenario_loader.py # Loads & validates scenariosβ βββ small_models.json # 5 small model scenariosβ βββ medium_models.json # 5 medium model scenariosβ βββ large_models.json # 5 large model scenariosβ βββ instability_scenarios.json # 5 instability detection scenariosβ βββ constraint_scenarios.json # 5 multi-objective scenariosββββ graders/ # Deterministic grading functionsβ βββ __init__.pyβ βββ precision_grader.py # Task 1: precision config scoringβ βββ stability_grader.py # Task 2: instability detection scoringβ βββ pareto_grader.py # Task 3: multi-objective scoringβ βββ lookup_tables.py # Pre-computed optimal configsββββ agents/ # Agent implementationsβ βββ __init__.pyβ βββ baseline_agent.py # Rule-based baseline agentββββ tests/ # Test suiteβ βββ __init__.pyβ βββ test_environment.py # Environment reset/step testsβ βββ test_graders.py # Grader determinism testsβ βββ test_baseline.py # Baseline agent testsβ βββ test_scenarios.py # Scenario validation testsβ βββ test_endpoints.py # API endpoint testsββββ scripts/ # Utility scriptsβ βββ validate_submission.py # Pre-submission validationβ βββ run_baseline.py # Run baseline agent end-to-endβ βββ generate_scenarios.py # Scenario generation helperββββ docs/ # Additional documentation βββ ARCHITECTURE.md # Technical architecture overview βββ SCENARIOS.md # Detailed scenario documentation βββ API.md # API endpoint documentation```
### Key Files Explained
| File | Purpose | Priority ||------|---------|----------|| `openenv.yaml` | OpenEnv manifest β defines tasks, graders, episodes | π΄ Critical || `Dockerfile` | Container build β judges must be able to `docker build` | π΄ Critical || `app/main.py` | FastAPI server with all required endpoints | π΄ Critical || `environment/mixed_precision_env.py` | Core env with `reset()`, `step()` | π΄ Critical || `graders/*.py` | All 3 graders β must be deterministic | π΄ Critical || `scenarios/*.json` | 25 pre-built scenarios | π΄ Critical || `agents/baseline_agent.py` | Baseline that scores > 0 | π‘ High || `tests/*.py` | Validation tests | π‘ High || `README.md` | Documentation for judges | π‘ High || `scripts/validate_submission.py` | Pre-submit validation | π’ Medium |
---
# 9. Pre-Submission Checklist
### Must Pass (Disqualification if not)- [ ] HuggingFace Space deploys without error- [ ] `openenv validate` passes all checks- [ ] `docker build .` succeeds- [ ] `GET /tasks` returns 200 with all 3 task IDs- [ ] `POST /baseline` returns 200 with valid JSON (scores > 0)- [ ] `POST /grader` scores all 3 tasks with deterministic outputs- [ ] Same grader input β same output (run 3Γ to verify)
### Should Pass (Scoring impact)- [ ] 25 scenarios load without errors- [ ] Baseline scores > 30 on at least 1 task- [ ] All edge cases handled (empty input, malformed config)- [ ] README documents setup, usage, and architecture- [ ] Code is clean, commented, and follows PEP 8
### Nice to Have (Creativity bonus)- [ ] Comprehensive test suite passes- [ ] Architecture documentation- [ ] Example agent interactions documented- [ ] Loss curve visualizations in README
---
# 10. Scoring Rubric
| Category | Weight | What Judges Look For ||----------|--------|---------------------|| **Scenario Realism** | 25% | Are the 25 scenarios based on real model architectures? Do layer properties match real-world values? || **Grader Determinism** | 25% | Same input β same output, always. No randomness. No LLM calls. || **Baseline Quality** | 20% | Does baseline demonstrate the environment works? Score > 50 on at least 1 task? || **Technical Depth** | 15% | Is the FP32/FP16/FP8 logic technically sound? Would a Meta engineer trust this? || **Deployment Readiness** | 15% | Clean code, documentation, Docker builds, HF Space runs |
---
# 11. 5-Day Build Timeline
| Day | Date | Focus | Hours | Deliverable ||-----|------|-------|-------|-------------|| **1** | Apr 2 (Wed) | Project scaffold + research + 25 scenarios | 5h | `openenv.yaml`, all scenario JSONs, project structure created || **2** | Apr 3 (Thu) | All 3 graders + lookup tables | 4h | `graders/*.py` complete, all deterministic tests pass || **3** | Apr 4 (Fri) | Environment class + baseline agent | 4h | `reset()`, `step()` working, baseline scores > 0 || **4** | Apr 5 (Sat) | FastAPI endpoints + Docker + HF deployment | 4h | All endpoints return 200, Docker builds, HF Space live || **5** | Apr 6 (Sun) | Testing, edge cases, README polish | 3h | Full test suite passes, README complete || **Submit** | Apr 7 (Mon) | Final validation + submit | 1h | `openenv validate` passes, submission done |
**Total estimated effort: ~21 hours across 6 days**
---
**Document Version:** v2.0 **Created:** April 2, 2026 **For:** Scalar Γ Meta PyTorch OpenEnv Hackathon β Solo Submission **Deadline:** April 8, 2026 (submitting April 7)123456789101112131415161718192021222324252627282930313233343536# Scalar Γ Meta Hackathon β Decision Log**Decision:** Mixed Precision Training Configuration Environment **Date:** April 2, 2026 **Status:** β
CONFIRMED β Building this project
---
## Why Mixed Precision Was Chosen
| Factor | Score ||--------|-------|| Success Probability | 75% (highest risk-adjusted) || Judge Appeal | π₯ Very High β Meta engineers use mixed precision daily || Grader Simplicity | Deterministic lookup tables β zero ambiguity || Timeline Risk | Low β can complete in 5 days solo || Creativity | High β novel RL formulation of a real problem || Technical Depth | Sound FP32/FP16/FP8 tradeoffs |
## Other Ideas Considered (Rejected)
| Idea | Probability | Rejection Reason ||------|-------------|-----------------|| Chinchilla Scaling | 72% | Formula edge cases could cause grader bugs || Gradient Checkpointing | 68% | Too much research needed in 5 days || TPU Allocation | 58% | Too complex for solo, high risk of bugs || Batch Size Tuning | 82% | Too generic, low creativity score || Incident RCA | 72% | Fuzzy text graders are unreliable, not Meta-specific enough |
## Key Links- OpenEnv docs: https://huggingface.co/openenv- HuggingFace Spaces deployment guide- Mixed precision training references: NVIDIA AMP documentation
---
**Next:** See `DETAILED_PROJECT_CONTEXT.md` for full project specification and terminology.1234567891011121314151617181920212223242526272829303132333435363738394041# =============================================================# Mixed Precision Training Environment β .gitignore# =============================================================
# --- Secrets (NEVER commit) ---.env*.env.local*.env.*.local
# --- Python ---__pycache__/*.py[cod]*.pyo*.pyd.Python*.egg*.egg-info/dist/build/.eggs/
# --- Virtual environments ---venv/.venv/env/ENV/
# --- IDE ---.vscode/.idea/*.swp*.swo.DS_Store
# --- Logs & temp ---*.log*.tmp*.bak
# --- Safe to commit ---# .env.example β intentionally NOT ignored (it's the safe template)12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183{ "type": "excalidraw", "version": 2, "source": "https://excalidraw.com", "elements": [ { "id": "aRUU-BHuvKJpSbUXdp6Uy", "type": "text", "x": 581.7373177432816, "y": 28.39325598836841, "width": 261.5798645019531, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "transparent", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "a0", "roundness": null, "seed": 1132078211, "version": 98, "versionNonce": 529009347, "isDeleted": false, "boundElements": null, "updated": 1775145660529, "link": null, "locked": false, "text": "NEURAL NETWORK FLOW ", "fontSize": 20, "fontFamily": 5, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "NEURAL NETWORK FLOW ", "autoResize": true, "lineHeight": 1.25 }, { "id": "YJ91whY0Dh1KocOtrWsbl", "type": "freedraw", "x": 1109, "y": 211, "width": 0.0001, "height": 0.0001, "angle": 0, "strokeColor": "#1971c2", "backgroundColor": "transparent", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "a4", "roundness": null, "seed": 761258381, "version": 4, "versionNonce": 1334861517, "isDeleted": true, "boundElements": null, "updated": 1775144652199, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 0.0001, 0.0001 ] ], "pressures": [], "simulatePressure": true }, { "id": "YBApse10tGHrgVZ3hbrlt", "type": "rectangle", "x": -88.5694949129335, "y": 292.276267769686, "width": 223.87586332129777, "height": 194.02574821179158, "angle": 0, "strokeColor": "#1971c2", "backgroundColor": "#1971c2", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "a7", "roundness": { "type": 3 }, "seed": 1710015181, "version": 502, "versionNonce": 604352941, "isDeleted": false, "boundElements": [ { "type": "text", "id": "9eQDdG6S5Ddx8KNdXHZ3K" }, { "id": "Cu9MrBq8ddICt4llNb9eG", "type": "arrow" } ], "updated": 1775146457034, "link": null, "locked": false }, { "id": "9eQDdG6S5Ddx8KNdXHZ3K", "type": "text", "x": -5.481546467616624, "y": 376.7891418755818, "width": 57.69996643066406, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#1971c2", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "a7V", "roundness": null, "seed": 2115439277, "version": 361, "versionNonce": 891089933, "isDeleted": false, "boundElements": null, "updated": 1775146457034, "link": null, "locked": false, "text": "Data ", "fontSize": 20, "fontFamily": 5, "textAlign": "center", "verticalAlign": "middle", "containerId": "YBApse10tGHrgVZ3hbrlt", "originalText": "Data ", "autoResize": true, "lineHeight": 1.25 }, { "id": "JdI6ESDRozVnalFX631-h", "type": "text", "x": 1121.159007831924, "y": 198.5121067091865, "width": 152.65988159179688, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#1971c2", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "a8", "roundness": null, "seed": 1880324269, "version": 89, "versionNonce": 2000912515, "isDeleted": true, "boundElements": null, "updated": 1775144652199, "link": null, "locked": false, "text": "Human Readable", "fontSize": 20, "fontFamily": 5, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "Human Readable", "autoResize": true, "lineHeight": 1.25 }, { "id": "slF_2KJ-NYMH_rEH9uqXJ", "type": "ellipse", "x": 189.20792395181627, "y": 314.2437547962294, "width": 136.81302758523765, "height": 140.54429197392574, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "aD", "roundness": { "type": 2 }, "seed": 285992771, "version": 383, "versionNonce": 1980337325, "isDeleted": false, "boundElements": [ { "type": "text", "id": "E6XWmBbkJXZACpcYnxtqa" }, { "id": "Cu9MrBq8ddICt4llNb9eG", "type": "arrow" }, { "id": "FemffY__SMfRoGOMwBgkc", "type": "arrow" } ], "updated": 1775146459253, "link": null, "locked": false }, { "id": "Cu9MrBq8ddICt4llNb9eG", "type": "arrow", "x": 141.30636840836428, "y": 389.0164291380607, "width": 54.120329524599185, "height": 2.6348961605241925, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#1971c2", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "aDV", "roundness": { "type": 2 }, "seed": 324377347, "version": 350, "versionNonce": 468059501, "isDeleted": false, "boundElements": null, "updated": 1775146459253, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 54.120329524599185, -2.6348961605241925 ] ], "startBinding": { "elementId": "YBApse10tGHrgVZ3hbrlt", "mode": "orbit", "fixedPoint": [ 1, 0.5001 ] }, "endBinding": { "elementId": "slF_2KJ-NYMH_rEH9uqXJ", "mode": "inside", "fixedPoint": [ 0.045454545454545664, 0.5132743362831865 ] }, "startArrowhead": null, "endArrowhead": "arrow", "elbowed": false, "moveMidPointsWithElement": false }, { "id": "E6XWmBbkJXZACpcYnxtqa", "type": "text", "x": 222.68375329393308, "y": 371.8259898272798, "width": 70.11994934082031, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "aE", "roundness": null, "seed": 1523502435, "version": 264, "versionNonce": 1877831437, "isDeleted": false, "boundElements": null, "updated": 1775146459253, "link": null, "locked": false, "text": "Tokens", "fontSize": 20, "fontFamily": 5, "textAlign": "center", "verticalAlign": "middle", "containerId": "slF_2KJ-NYMH_rEH9uqXJ", "originalText": "Tokens", "autoResize": true, "lineHeight": 1.25 }, { "id": "7pWQXA2pNtPUhCgJ4rjS4", "type": "arrow", "x": 416.9749552336415, "y": 393.1221843567983, "width": 49.96902978160074, "height": 0.5218773981146114, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aF", "roundness": null, "seed": 545822157, "version": 229, "versionNonce": 695363395, "isDeleted": true, "boundElements": null, "updated": 1775144029820, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 49.96902978160074, -0.5218773981146114 ] ], "startBinding": { "elementId": "slF_2KJ-NYMH_rEH9uqXJ", "mode": "orbit", "fixedPoint": [ 1.0438550052916973, 0.4992884805309733 ] }, "endBinding": null, "startArrowhead": null, "endArrowhead": "arrow", "elbowed": true, "fixedSegments": null, "startIsSpecial": null, "endIsSpecial": null }, { "id": "O-P__8mRakT2YynJAH-tG", "type": "rectangle", "x": 418.4375479622943, "y": 225.93716426393965, "width": 131.83800840031984, "height": 457.70176501243145, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aG", "roundness": { "type": 3 }, "seed": 1731202253, "version": 336, "versionNonce": 607764077, "isDeleted": false, "boundElements": [ { "type": "text", "id": "XrSbUdH4QJfSItwMnHcBn" }, { "id": "FemffY__SMfRoGOMwBgkc", "type": "arrow" }, { "id": "RhhrdbjCLnRjVxKMvup9T", "type": "arrow" }, { "id": "o14pRHtQSsr3xP9Tk7leD", "type": "arrow" }, { "id": "HP9sG9KwS-NA3YfoKLRk8", "type": "arrow" } ], "updated": 1775144727666, "link": null, "locked": false }, { "id": "XrSbUdH4QJfSItwMnHcBn", "type": "text", "x": 424.8265991595245, "y": 379.7880467701554, "width": 119.05990600585938, "height": 150, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aG8", "roundness": null, "seed": 810321421, "version": 151, "versionNonce": 1420912845, "isDeleted": false, "boundElements": null, "updated": 1775144727666, "link": null, "locked": false, "text": "Converts\ntokens into\ndense\nvectors(Ran\ndom\nNumbers)", "fontSize": 20, "fontFamily": 5, "textAlign": "center", "verticalAlign": "middle", "containerId": "O-P__8mRakT2YynJAH-tG", "originalText": "Converts tokens into dense vectors(Random Numbers)", "autoResize": true, "lineHeight": 1.25 }, { "id": "T5KUkkPZ0jqf1dV87a8NR", "type": "text", "x": 559.956859121138, "y": 464.67563310228525, "width": 8, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aGG", "roundness": null, "seed": 82718307, "version": 3, "versionNonce": 155258573, "isDeleted": true, "boundElements": null, "updated": 1775144068849, "link": null, "locked": false, "text": "", "fontSize": 20, "fontFamily": 5, "textAlign": "center", "verticalAlign": "middle", "containerId": "O-P__8mRakT2YynJAH-tG", "originalText": "", "autoResize": true, "lineHeight": 1.25 }, { "id": "Pv3T-CLb4BO1J568Z3rBL", "type": "text", "x": 559.956859121138, "y": 464.67563310228525, "width": 8, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aGV", "roundness": null, "seed": 2032131331, "version": 3, "versionNonce": 464415277, "isDeleted": true, "boundElements": null, "updated": 1775144066994, "link": null, "locked": false, "text": "", "fontSize": 20, "fontFamily": 5, "textAlign": "center", "verticalAlign": "middle", "containerId": "O-P__8mRakT2YynJAH-tG", "originalText": "", "autoResize": true, "lineHeight": 1.25 }, { "id": "SdXUufbsGrasQsg_NpUWn", "type": "text", "x": 491.8190809398309, "y": 182.34329435820385, "width": 99.93992614746094, "height": 50, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aH", "roundness": null, "seed": 1618266957, "version": 33, "versionNonce": 724911053, "isDeleted": false, "boundElements": null, "updated": 1775144380287, "link": null, "locked": false, "text": "Embedding\nLayer", "fontSize": 20, "fontFamily": 5, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "Embedding\nLayer", "autoResize": true, "lineHeight": 1.25 }, { "id": "2Eh9ZoDt-RHC-XhuuIHB0", "type": "freedraw", "x": 1113.6964790545474, "y": 243.34973141115177, "width": 0.0001, "height": 0.0001, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aI", "roundness": null, "seed": 2111789923, "version": 4, "versionNonce": 451576835, "isDeleted": true, "boundElements": null, "updated": 1775144096497, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 0.0001, 0.0001 ] ], "pressures": [], "simulatePressure": true }, { "id": "Zp_ms07UWUmWYttbBWSyi", "type": "freedraw", "x": 1126.1340270168416, "y": 279.4186205018053, "width": 0.0001, "height": 0.0001, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aJ", "roundness": null, "seed": 1572415341, "version": 4, "versionNonce": 1320650989, "isDeleted": true, "boundElements": null, "updated": 1775144096229, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 0.0001, 0.0001 ] ], "pressures": [], "simulatePressure": true }, { "id": "XbXLI-E6XdNZJWX_3GWTv", "type": "freedraw", "x": 1108.7214598696296, "y": 247.08099579984005, "width": 0.0001, "height": 0.0001, "angle": 0, "strokeColor": "#6741d9", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aK", "roundness": null, "seed": 1266758669, "version": 4, "versionNonce": 823459117, "isDeleted": true, "boundElements": null, "updated": 1775144652199, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 0.0001, 0.0001 ] ], "pressures": [], "simulatePressure": true }, { "id": "qocD4fV5Z1lD2sEqWV32G", "type": "text", "x": 1123.6465174243829, "y": 233.33724100361061, "width": 156.7798614501953, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aL", "roundness": null, "seed": 1470669347, "version": 38, "versionNonce": 1420195875, "isDeleted": true, "boundElements": null, "updated": 1775144652199, "link": null, "locked": false, "text": "Pre - processing", "fontSize": 20, "fontFamily": 5, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "Pre - processing", "autoResize": true, "lineHeight": 1.25 }, { "id": "FemffY__SMfRoGOMwBgkc", "type": "arrow", "x": 332.0208875857777, "y": 384.4159007831922, "width": 80.41666037651657, "height": 3.0093869905733754, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aM", "roundness": { "type": 2 }, "seed": 179452899, "version": 161, "versionNonce": 1027395533, "isDeleted": false, "boundElements": null, "updated": 1775146459253, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 80.41666037651657, -3.0093869905733754 ] ], "startBinding": { "elementId": "slF_2KJ-NYMH_rEH9uqXJ", "mode": "orbit", "fixedPoint": [ 1.0438550052916973, 0.4992884805309733 ] }, "endBinding": { "elementId": "O-P__8mRakT2YynJAH-tG", "mode": "orbit", "fixedPoint": [ -0.04551039622641468, 0.3396739130434782 ] }, "startArrowhead": null, "endArrowhead": "arrow", "elbowed": false, "fixedSegments": null, "startIsSpecial": null, "endIsSpecial": null, "moveMidPointsWithElement": false }, { "id": "k_HVv03gHBdpyIfn5TGNi", "type": "freedraw", "x": 1107.4777050734, "y": 280.6623752980347, "width": 0.0001, "height": 0.0001, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aN", "roundness": null, "seed": 1135434253, "version": 4, "versionNonce": 154587021, "isDeleted": true, "boundElements": null, "updated": 1775144652199, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 0.0001, 0.0001 ] ], "pressures": [], "simulatePressure": true }, { "id": "mKOu4T_KeweqVL2h4OJ8E", "type": "freedraw", "x": 1107.4777050734, "y": 280.6623752980347, "width": 0.0001, "height": 0.0001, "angle": 0, "strokeColor": "#ffec99", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aO", "roundness": null, "seed": 5939139, "version": 4, "versionNonce": 1711897539, "isDeleted": true, "boundElements": null, "updated": 1775144652199, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 0.0001, 0.0001 ] ], "pressures": [], "simulatePressure": true }, { "id": "05a03v1gwTSBYGxubo3Dn", "type": "text", "x": 1126.1340270168416, "y": 266.91862050180526, "width": 62.81993103027344, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aP", "roundness": null, "seed": 962116877, "version": 24, "versionNonce": 1982813677, "isDeleted": true, "boundElements": null, "updated": 1775144652199, "link": null, "locked": false, "text": "Layers", "fontSize": 20, "fontFamily": 5, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "Layers", "autoResize": true, "lineHeight": 1.25 }, { "id": "vzfrXv24Vp8lduFS-IMMZ", "type": "text", "x": 801.5140252009597, "y": 168.66199159968008, "width": 103.35993957519531, "height": 50, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aQ", "roundness": null, "seed": 135571565, "version": 99, "versionNonce": 559175533, "isDeleted": false, "boundElements": null, "updated": 1775144765926, "link": null, "locked": false, "text": "Attention \nLayer", "fontSize": 20, "fontFamily": 5, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "Attention \nLayer", "autoResize": true, "lineHeight": 1.25 }, { "id": "gag6gXp9qPveKW17DHIoU", "type": "rectangle", "x": 780.3701936650593, "y": 222.20589987525148, "width": 129.35049880786107, "height": 453.97050062374296, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aR", "roundness": { "type": 3 }, "seed": 1725942627, "version": 206, "versionNonce": 1818229443, "isDeleted": false, "boundElements": [ { "type": "text", "id": "ipJ2nV1S6L6Uj7LHlu-sr" }, { "id": "RhhrdbjCLnRjVxKMvup9T", "type": "arrow" }, { "id": "o14pRHtQSsr3xP9Tk7leD", "type": "arrow" }, { "id": "HP9sG9KwS-NA3YfoKLRk8", "type": "arrow" }, { "id": "o92lzfucnv4g4IkrpO0Xl", "type": "arrow" }, { "id": "9DkeWKzocHqCIpoB0WMOJ", "type": "arrow" }, { "id": "mPsQ349iRdUaOHlANA71_", "type": "arrow" } ], "updated": 1775144755294, "link": null, "locked": false }, { "id": "ipJ2nV1S6L6Uj7LHlu-sr", "type": "text", "x": 786.2254738917437, "y": 386.69115018712296, "width": 117.63993835449219, "height": 125, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aS", "roundness": null, "seed": 1468808973, "version": 149, "versionNonce": 433155629, "isDeleted": false, "boundElements": null, "updated": 1775144697873, "link": null, "locked": false, "text": "Interaction\nof dense\nvectors (To\nunderstand\ncontext)", "fontSize": 20, "fontFamily": 5, "textAlign": "center", "verticalAlign": "middle", "containerId": "gag6gXp9qPveKW17DHIoU", "originalText": "Interaction of dense vectors (To understand context)", "autoResize": true, "lineHeight": 1.25 }, { "id": "hhiBVpKL7Jgm-xgzYo0ZQ", "type": "rectangle", "x": 1057.7275132242228, "y": 223.44965467148089, "width": 126.86298921540231, "height": 457.7017650124314, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aT", "roundness": { "type": 3 }, "seed": 1548134339, "version": 198, "versionNonce": 1705402861, "isDeleted": false, "boundElements": [ { "type": "text", "id": "PRDydrD5FvC4gho-Gl6sJ" }, { "id": "o92lzfucnv4g4IkrpO0Xl", "type": "arrow" }, { "id": "9DkeWKzocHqCIpoB0WMOJ", "type": "arrow" }, { "id": "mPsQ349iRdUaOHlANA71_", "type": "arrow" }, { "id": "JkJiWRJJrF3lOIB2Gd3YX", "type": "arrow" }, { "id": "-dYcb6DJXyLBE7SpIHrpb", "type": "arrow" }, { "id": "HRQQky7chLj4yXDhB5jSl", "type": "arrow" } ], "updated": 1775146535868, "link": null, "locked": false }, { "id": "PRDydrD5FvC4gho-Gl6sJ", "type": "text", "x": 1066.7090414012598, "y": 402.3005371776966, "width": 108.89993286132812, "height": 100, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aTG", "roundness": null, "seed": 1862964781, "version": 112, "versionNonce": 1908544205, "isDeleted": false, "boundElements": null, "updated": 1775145631152, "link": null, "locked": false, "text": "This layer\nis all about\nasking\nquestions ", "fontSize": 20, "fontFamily": 5, "textAlign": "center", "verticalAlign": "middle", "containerId": "hhiBVpKL7Jgm-xgzYo0ZQ", "originalText": "This layer is all about asking questions ", "autoResize": true, "lineHeight": 1.25 }, { "id": "maPAXm-eKLbuhuHrVw64-", "type": "text", "x": 877.1143321596435, "y": 450.3724529456467, "width": 8, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aTV", "roundness": null, "seed": 180507437, "version": 3, "versionNonce": 49075373, "isDeleted": true, "boundElements": null, "updated": 1775144483908, "link": null, "locked": false, "text": "", "fontSize": 20, "fontFamily": 5, "textAlign": "center", "verticalAlign": "middle", "containerId": "hhiBVpKL7Jgm-xgzYo0ZQ", "originalText": "", "autoResize": true, "lineHeight": 1.25 }, { "id": "7gwLT2Kue61kAMRNq_vsq", "type": "text", "x": 1067.6361937927343, "y": 167.0229521786587, "width": 131.97987365722656, "height": 50, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aU", "roundness": null, "seed": 933069389, "version": 159, "versionNonce": 1364562211, "isDeleted": false, "boundElements": null, "updated": 1775146464166, "link": null, "locked": false, "text": "Feed Forward\nLayer", "fontSize": 20, "fontFamily": 5, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "Feed Forward\nLayer", "autoResize": true, "lineHeight": 1.25 }, { "id": "iqxworZQlgJFvxu00VJml", "type": "freedraw", "x": 1177.99501262809, "y": -4.791457145806561, "width": 0.0001, "height": 0.0001, "angle": 0, "strokeColor": "#1971c2", "backgroundColor": "transparent", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "aV", "roundness": null, "seed": 1177062787, "version": 6, "versionNonce": 1949986531, "isDeleted": false, "boundElements": [], "updated": 1775144657169, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 0.0001, 0.0001 ] ], "pressures": [], "simulatePressure": true }, { "id": "v0iIvPLlF0I3PNFeo3BCA", "type": "text", "x": 1190.1540204600142, "y": -17.279350436620092, "width": 152.65988159179688, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#1971c2", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "aW", "roundness": null, "seed": 2103567651, "version": 91, "versionNonce": 1444062413, "isDeleted": false, "boundElements": [], "updated": 1775144657169, "link": null, "locked": false, "text": "Human Readable", "fontSize": 20, "fontFamily": 5, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "Human Readable", "autoResize": true, "lineHeight": 1.25 }, { "id": "vWj4p-fUdeKj7hyVfO2Gw", "type": "freedraw", "x": 1177.7164724977197, "y": 31.289538654033464, "width": 0.0001, "height": 0.0001, "angle": 0, "strokeColor": "#6741d9", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aX", "roundness": null, "seed": 516901059, "version": 6, "versionNonce": 1165007491, "isDeleted": false, "boundElements": [], "updated": 1775144657169, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 0.0001, 0.0001 ] ], "pressures": [], "simulatePressure": true }, { "id": "dK83naRWllrYqEnV4qAx7", "type": "text", "x": 1192.6415300524732, "y": 17.545783857804025, "width": 156.7798614501953, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#6741d9", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aY", "roundness": null, "seed": 1611610211, "version": 40, "versionNonce": 2069791533, "isDeleted": false, "boundElements": [], "updated": 1775144657169, "link": null, "locked": false, "text": "Pre - processing", "fontSize": 20, "fontFamily": 5, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "Pre - processing", "autoResize": true, "lineHeight": 1.25 }, { "id": "i7u6pHoehHVoerr_lw0ZX", "type": "freedraw", "x": 1176.4727177014902, "y": 64.87091815222814, "width": 0.0001, "height": 0.0001, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aZ", "roundness": null, "seed": 1055929347, "version": 6, "versionNonce": 1377849891, "isDeleted": false, "boundElements": [], "updated": 1775144657169, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 0.0001, 0.0001 ] ], "pressures": [], "simulatePressure": true }, { "id": "HjrIw4A_zAj3VZMXUxpZ-", "type": "freedraw", "x": 1176.4727177014902, "y": 64.87091815222814, "width": 0.0001, "height": 0.0001, "angle": 0, "strokeColor": "#ffec99", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aa", "roundness": null, "seed": 2070985635, "version": 6, "versionNonce": 476026253, "isDeleted": false, "boundElements": [], "updated": 1775144657169, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 0.0001, 0.0001 ] ], "pressures": [], "simulatePressure": true }, { "id": "X1uy_3rqjnh_4FLAChHV2", "type": "text", "x": 1195.1290396449317, "y": 51.127163355998704, "width": 62.81993103027344, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "ab", "roundness": null, "seed": 1371492163, "version": 26, "versionNonce": 188224963, "isDeleted": false, "boundElements": [], "updated": 1775144657169, "link": null, "locked": false, "text": "Layers", "fontSize": 20, "fontFamily": 5, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "Layers", "autoResize": true, "lineHeight": 1.25 }, { "id": "RhhrdbjCLnRjVxKMvup9T", "type": "arrow", "x": 556.2755563626141, "y": 415.48114625396727, "width": 225.3383920986746, "height": 138.5500353446207, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "ac", "roundness": { "type": 2 }, "seed": 96514467, "version": 122, "versionNonce": 1293769101, "isDeleted": false, "boundElements": null, "updated": 1775144727667, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 225.3383920986746, -138.5500353446207 ] ], "startBinding": { "elementId": "O-P__8mRakT2YynJAH-tG", "mode": "orbit", "fixedPoint": [ 0.5091185410334351, 0.5091185410334348 ] }, "endBinding": { "elementId": "gag6gXp9qPveKW17DHIoU", "mode": "inside", "fixedPoint": [ 0.009615384615384219, 0.12054794520547954 ] }, "startArrowhead": null, "endArrowhead": "arrow", "elbowed": false, "moveMidPointsWithElement": false }, { "id": "o14pRHtQSsr3xP9Tk7leD", "type": "arrow", "x": 556.2755563626141, "y": 417.1415562997807, "width": 218.09463730244522, "height": 222.50351994704982, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "ad", "roundness": null, "seed": 1994559437, "version": 125, "versionNonce": 1354014701, "isDeleted": false, "boundElements": null, "updated": 1775144727667, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 218.09463730244522, 222.50351994704982 ] ], "startBinding": { "elementId": "O-P__8mRakT2YynJAH-tG", "mode": "orbit", "fixedPoint": [ 1.0455103962264152, 0.4177488632377195 ] }, "endBinding": { "elementId": "gag6gXp9qPveKW17DHIoU", "mode": "orbit", "fixedPoint": [ -0.04638559615384614, 0.9195292993664327 ] }, "startArrowhead": null, "endArrowhead": "arrow", "elbowed": false, "moveMidPointsWithElement": false }, { "id": "HP9sG9KwS-NA3YfoKLRk8", "type": "arrow", "x": 556.2755563626141, "y": 420.06340586928, "width": 226.5821468949041, "height": 1.1432614026806505, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "ae", "roundness": null, "seed": 1302787395, "version": 70, "versionNonce": 1055494563, "isDeleted": false, "boundElements": null, "updated": 1775144731570, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 226.5821468949041, 1.1432614026806505 ] ], "startBinding": { "elementId": "O-P__8mRakT2YynJAH-tG", "mode": "orbit", "fixedPoint": [ 0.5765489728075041, 0.4234510271924977 ] }, "endBinding": { "elementId": "gag6gXp9qPveKW17DHIoU", "mode": "inside", "fixedPoint": [ 0.019230769230769315, 0.4383561643835615 ] }, "startArrowhead": null, "endArrowhead": "arrow", "elbowed": false, "moveMidPointsWithElement": false }, { "id": "o92lzfucnv4g4IkrpO0Xl", "type": "arrow", "x": 908.4769376766909, "y": 438.6192344191728, "width": 151.73808513999086, "height": 179.86476040789, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "af", "roundness": null, "seed": 1867591811, "version": 96, "versionNonce": 183513389, "isDeleted": false, "boundElements": null, "updated": 1775145631152, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 151.73808513999086, -179.86476040789 ] ], "startBinding": { "elementId": "gag6gXp9qPveKW17DHIoU", "mode": "inside", "fixedPoint": [ 0.9903846153846149, 0.4767123287671234 ] }, "endBinding": { "elementId": "hhiBVpKL7Jgm-xgzYo0ZQ", "mode": "inside", "fixedPoint": [ 0.01960784313725587, 0.07713498622589549 ] }, "startArrowhead": null, "endArrowhead": "arrow", "elbowed": false, "moveMidPointsWithElement": false }, { "id": "9DkeWKzocHqCIpoB0WMOJ", "type": "arrow", "x": 915.7206924729203, "y": 433.8758064856395, "width": 136.00682075130226, "height": 0.20805766939662362, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "ag", "roundness": null, "seed": 1851482125, "version": 124, "versionNonce": 692283139, "isDeleted": false, "boundElements": null, "updated": 1775145642172, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 136.00682075130226, 0.20805766939662362 ] ], "startBinding": { "elementId": "gag6gXp9qPveKW17DHIoU", "mode": "orbit", "fixedPoint": [ 0.5339597837071143, 0.46604021629288844 ] }, "endBinding": { "elementId": "hhiBVpKL7Jgm-xgzYo0ZQ", "mode": "orbit", "fixedPoint": [ 0.46041496186173253, 0.4604149618617328 ] }, "startArrowhead": null, "endArrowhead": "arrow", "elbowed": false, "moveMidPointsWithElement": false }, { "id": "mPsQ349iRdUaOHlANA71_", "type": "arrow", "x": 915.7206924729204, "y": 436.98926044272963, "width": 136.00682075130237, "height": 195.28065598218808, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "ah", "roundness": null, "seed": 883438563, "version": 137, "versionNonce": 6505613, "isDeleted": false, "boundElements": null, "updated": 1775145648740, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 136.00682075130237, 195.28065598218808 ] ], "startBinding": { "elementId": "gag6gXp9qPveKW17DHIoU", "mode": "orbit", "fixedPoint": [ 0.6777076242329484, 0.32229237576705083 ] }, "endBinding": { "elementId": "hhiBVpKL7Jgm-xgzYo0ZQ", "mode": "orbit", "fixedPoint": [ 0.06293098016662066, 0.9370690198333803 ] }, "startArrowhead": null, "endArrowhead": "arrow", "elbowed": false, "moveMidPointsWithElement": false }, { "id": "IIReAZ-XknUOvS8yVIQM5", "type": "rectangle", "x": 1146.2043059862376, "y": 255.51392401274376, "width": 1.6555825415512118, "height": 4.966747624652953, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "ai", "roundness": { "type": 3 }, "seed": 1439431299, "version": 5, "versionNonce": 1059824813, "isDeleted": true, "boundElements": null, "updated": 1775146481834, "link": null, "locked": false }, { "id": "oABjf7Nqt9jbXL3W0tA1J", "type": "rectangle", "x": 1312.8987846541238, "y": 225.33294649264596, "width": 126.86298921540231, "height": 457.7017650124314, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "aj", "roundness": { "type": 3 }, "seed": 420939651, "version": 388, "versionNonce": 368553069, "isDeleted": false, "boundElements": [ { "type": "text", "id": "XW7-cSsLCfmJ2JSo9lnGF" }, { "id": "JkJiWRJJrF3lOIB2Gd3YX", "type": "arrow" }, { "id": "-dYcb6DJXyLBE7SpIHrpb", "type": "arrow" }, { "id": "HRQQky7chLj4yXDhB5jSl", "type": "arrow" } ], "updated": 1775146562479, "link": null, "locked": false }, { "id": "XW7-cSsLCfmJ2JSo9lnGF", "type": "text", "x": 1318.5903271744226, "y": 416.68382899886166, "width": 115.47990417480469, "height": 75, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 2, "opacity": 100, "groupIds": [], "frameId": null, "index": "ak", "roundness": null, "seed": 544284451, "version": 335, "versionNonce": 1954649805, "isDeleted": false, "boundElements": [], "updated": 1775146562479, "link": null, "locked": false, "text": "this layer is\noutput\nlayer", "fontSize": 20, "fontFamily": 5, "textAlign": "center", "verticalAlign": "middle", "containerId": "oABjf7Nqt9jbXL3W0tA1J", "originalText": "this layer is output layer", "autoResize": true, "lineHeight": 1.25 }, { "id": "H9b2Hxe6yJyRizn1yRvS6", "type": "text", "x": 1305.1402299751326, "y": 183.41295251690843, "width": 130.0799102783203, "height": 25, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "al", "roundness": null, "seed": 1937282403, "version": 63, "versionNonce": 1597137891, "isDeleted": false, "boundElements": null, "updated": 1775146564297, "link": null, "locked": false, "text": "Output Layer", "fontSize": 20, "fontFamily": 5, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "Output Layer", "autoResize": true, "lineHeight": 1.25 }, { "id": "JkJiWRJJrF3lOIB2Gd3YX", "type": "arrow", "x": 1190.5905024396252, "y": 437.428348759762, "width": 116.3082822144986, "height": 6.739252230597003, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "am", "roundness": null, "seed": 1273033005, "version": 185, "versionNonce": 320812333, "isDeleted": false, "boundElements": null, "updated": 1775146562480, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 116.3082822144986, -6.739252230597003 ] ], "startBinding": { "elementId": "hhiBVpKL7Jgm-xgzYo0ZQ", "mode": "orbit", "fixedPoint": [ 0.5240903648147074, 0.4759096351852945 ] }, "endBinding": { "elementId": "oABjf7Nqt9jbXL3W0tA1J", "mode": "orbit", "fixedPoint": [ 0.4408286222182871, 0.4408286222182862 ] }, "startArrowhead": null, "endArrowhead": "arrow", "elbowed": false, "moveMidPointsWithElement": false }, { "id": "-dYcb6DJXyLBE7SpIHrpb", "type": "arrow", "x": 1190.5905024396252, "y": 418.9439787258473, "width": 116.3082822144986, "height": 131.82869571503886, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "an", "roundness": null, "seed": 938678787, "version": 193, "versionNonce": 490342285, "isDeleted": false, "boundElements": null, "updated": 1775146562480, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 116.3082822144986, -131.82869571503886 ] ], "startBinding": { "elementId": "hhiBVpKL7Jgm-xgzYo0ZQ", "mode": "orbit", "fixedPoint": [ 0.5753790483755138, 0.5753790483755142 ] }, "endBinding": { "elementId": "oABjf7Nqt9jbXL3W0tA1J", "mode": "orbit", "fixedPoint": [ 0.09140859267511947, 0.0914085926751197 ] }, "startArrowhead": null, "endArrowhead": "arrow", "elbowed": false, "moveMidPointsWithElement": false }, { "id": "HRQQky7chLj4yXDhB5jSl", "type": "arrow", "x": 1190.5905024396252, "y": 459.67911733984585, "width": 116.30828221449883, "height": 150.42578320850924, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "#ffec99", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "index": "ao", "roundness": null, "seed": 1953229517, "version": 209, "versionNonce": 353078765, "isDeleted": false, "boundElements": null, "updated": 1775146562481, "link": null, "locked": false, "points": [ [ 0, 0 ], [ 116.30828221449883, 150.42578320850924 ] ], "startBinding": { "elementId": "hhiBVpKL7Jgm-xgzYo0ZQ", "mode": "orbit", "fixedPoint": [ 0.6325548393651403, 0.367445160634862 ] }, "endBinding": { "elementId": "oABjf7Nqt9jbXL3W0tA1J", "mode": "orbit", "fixedPoint": [ 0.10481193368420096, 0.8951880663157975 ] }, "startArrowhead": null, "endArrowhead": "arrow", "elbowed": false, "moveMidPointsWithElement": false } ], "appState": { "gridSize": 20, "gridStep": 5, "gridModeEnabled": false, "viewBackgroundColor": "#ffffff", "lockedMultiSelections": {} }, "files": {}}121 unmodified lines122123124125125126126127128129130131128132133134135136137138139140141142143144145146147136137138139140141142143144145146147148149150151152153154155156157158159160161148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184166185186187188189190168169191192193194195173174175176177178179180181182183184185196197198199200201202203204205206207121 unmodified lines conversation_history = []
# Reset environment for this task try: res = httpx.post(f"{ENV_URL}/reset", json={"task_id": task_id}) obs = res.json()["observation"] res = httpx.post(f"{ENV_URL}/reset", json={"task_id": task_id}) obs = res.json()["observation"] except Exception as e: print(f"Error connecting to env: {e}", flush=True) return 0.0, 0
total_reward = 0.0 print(f"[START] task={task_id} env=mixed_precision_env model={MODEL_NAME}", flush=True)
rewards_list = [] steps = 0
while True: steps += 1 # Call LLM to decide action action = call_llm(system_prompt, obs, conversation_history) error = None done = False reward = 0.0
if action is None: print(f" [STEP] step={steps} ERROR: LLM returned invalid response") break
print(f" [STEP] step={steps} action={json.dumps(action, default=str)}")
# Add to conversation history for context conversation_history.append({"role": "user", "content": json.dumps(obs, default=str)}) conversation_history.append({"role": "assistant", "content": json.dumps(action, default=str)})
# Send action to environment step_res = httpx.post(f"{ENV_URL}/step", json={"action": action}) data = step_res.json()
reward = data["reward"]["score"] feedback = data["reward"]["feedback"] done = data["done"] total_reward += reward steps += 1
print(f" [STEP] step={steps} reward={reward} feedback={feedback}")
# Add environment feedback to conversation for the feedback loop conversation_history.append({ "role": "user", "content": f"Environment feedback: reward={reward}, feedback={feedback}" }) action = {} error = "invalid LLM response" done = True else: # Add to conversation history to have context of what was sent conversation_history.append({"role": "user", "content": json.dumps(obs, default=str)}) conversation_history.append({"role": "assistant", "content": json.dumps(action, default=str)})
# Send action to environment try: step_res = httpx.post(f"{ENV_URL}/step", json={"action": action}) data = step_res.json()
reward = data["reward"]["score"] feedback = data["reward"]["feedback"] done = data["done"] obs = data.get("observation", None)
# Append environment feedback conversation_history.append({ "role": "user", "content": f"Environment feedback: reward={reward}, feedback={feedback}" }) except Exception as e: done = True error = f"env error: {str(e)}"
rewards_list.append(reward) action_str = json.dumps(action, default=str).replace('\\n', ' ') error_str = error if error else "null" done_str = str(done).lower()
print(f"[STEP] step={steps} action={action_str} reward={reward:.2f} done={done_str} error={error_str}", flush=True)
if done: break
obs = data["observation"] score = sum(rewards_list) / max(steps, 1) # Define a simple threshold for success success = score >= 0.70 success_str = str(success).lower() rewards_str = ",".join(f"{r:.2f}" for r in rewards_list)
avg_reward = total_reward / max(steps, 1) return avg_reward, steps print(f"[END] success={success_str} steps={steps} score={score:.3f} rewards={rewards_str}", flush=True) return score, steps
def main(): print(f"[START] endpoint={API_BASE_URL} model={MODEL_NAME}")
tasks = ["precision_assignment", "instability_detection", "multi_objective_optimization"] all_scores = {}
for task_id in tasks: print(f"\n[TASK] {task_id}") avg_score, num_steps = run_task(task_id) all_scores[task_id] = avg_score print(f"[TASK_COMPLETE] {task_id} avg_score={avg_score:.3f} steps={num_steps}")
print(f"\n[RESULTS] {json.dumps(all_scores)}") print("[END]") task_id = os.environ.get("TASK_ID") if task_id: tasks = [task_id] else: # Default fallback to testing all tasks sequentially tasks = ["precision_assignment", "instability_detection", "multi_objective_optimization"]
for t in tasks: run_task(t)
if __name__ == "__main__":MixedPrecisionEnv/.env.example β .env.exampleRenamed
.gitignore+26-8
DETAILED_PROJECT_CONTEXT.mdAdded+1002
MixedPrecisionEnv/Dockerfile β DockerfileRenamed
HACKATHON_RESEARCH.mdAdded+36
MixedPrecisionEnv/.gitignoreDeleted-41
MixedPrecisionEnv/README.md β README.mdRenamed
Untitled-2026-04-02-2056.excalidrawAdded+2183
MixedPrecisionEnv/app/__init__.py β app/__init__.pyRenamed
MixedPrecisionEnv/app/main.py β app/main.pyRenamed
MixedPrecisionEnv/app/models.py β app/models.pyRenamed
MixedPrecisionEnv/app/routes/__init__.py β app/routes/__init__.pyRenamed
MixedPrecisionEnv/environment/__init__.py β environment/__init__.pyRenamed
MixedPrecisionEnv/environment/mixed_precision_env.py β environment/mixed_precision_env.pyRenamed
MixedPrecisionEnv/environment/physics_model.py β environment/physics_model.pyRenamed
MixedPrecisionEnv/inference.py β inference.pyRenamed+64-45
MixedPrecisionEnv/openenv.yaml β openenv.yamlRenamed
MixedPrecisionEnv/requirements.txt β requirements.txtRenamed
MixedPrecisionEnv/scenarios/__init__.py β scenarios/__init__.pyRenamed
MixedPrecisionEnv/scenarios/loader.py β scenarios/loader.pyRenamed
MixedPrecisionEnv/scenarios/task1_scenarios.py β scenarios/task1_scenarios.pyRenamed
MixedPrecisionEnv/scenarios/task2_scenarios.py β scenarios/task2_scenarios.pyRenamed
MixedPrecisionEnv/scenarios/task3_scenarios.py β scenarios/task3_scenarios.pyRenamed