Posts

Azure foundry client code for using response API

OpenAI Respose API is supported by the framework and we can easily use the following code to call it.  from azure . ai . projects import AIProjectClient from azure . identity import DefaultAzureCredential project_client = AIProjectClient (     endpoint = " https://<your-resource>.services.ai.azure.com/api/projects/<your-project> " ,     credential = DefaultAzureCredential () ) # Get an OpenAI-compatible client scoped to this project openai_client = project_client . get_openai_client () # First turn response = openai_client . responses . create (     model = " gpt-4o " ,   # your deployment name     input = " What's the speed of light? " ) print ( response . output_text ) # Next turn — chain via previous_response_id, just send the new input response2 = openai_client . responses . create (     model = " gpt-4o " ,     input = " And what about sound? " ,     previous_response_id = respo...

model training underfitting, overfitting and more

Image
Common challenges in a model training are  1. overfitting - high train accuracy, terrible production performance  Red flag signals Train accuracy 98%+, val accuracy 65–70% Train loss keeps falling, val loss starts rising (divergence point) Large gap between train F1 and val F1 Model memorises noise — shuffling labels barely changes train loss Primary metrics to watch Train/val loss gap Generalisation gap Val accuracy Learning curves Val F1 Watch the gap , not the absolute numbers. Train acc 98% is fine if val acc is also 94%. The gap is the signal. Primary metrics to watch Train/val loss gap Generalisation gap Val accuracy Learning curves Val F1 Watch the gap , not the absolute numbers. Train acc 98% is fine if val acc is also 94%. The gap is the signal. This is what a overfitting learning curve graph looks like. As you can see the generalization gap higher than 0.15 is a red flag. In our case, it is 0.426.  One more thing to note is the red line will diverge and ...