Saturday, February 19, 2022

Acuitas Diary #46 (February 2022)

Last month was Part I of the Great Conjunction Upgrade, in which I overhauled the Text Parser to enable support for coordinating conjunctions and various compound sentence elements. This month I completed Part II. Since the output format of the Parser had become more expressive, I had to upgrade the Interpreter, the Conversation Engine, and the Narrative Engine to accept it, and to process the compounds appropriately.

Expected and actual results for an example sentence from TMSB: Inside the Earth.

The Parser tags each word with its part of speech and role in the sentence (subject, direct object, etc.). It provides a summary of the sentence structure. The Interpreter uses this information to detect the next layer of meaning: what is this sentence trying to say? E.g. is it a statement, question, or command? Does it describe a category membership, a state of being, an event, a desire? The Interpreter consumes a sentence structure and emits a more abstract knowledge representation, the "gist" of the sentence, if you will.

I redesigned the Interpreter to expand all compound sentence parts into full representations. For example, given "Jack and Jill eat beans," the Interpreter will output something akin to {AND, ["Jack->eat->beans", "Jill->eat->beans"]} ... as opposed to "{AND, [Jack,Jill]}->eat->beans". This simplifies downstream processing, since I can just loop over the list of complete atomic facts, instead of modifying all the inference tools and other machinery to handle the bewildering variety of possible sentence branches.

That upgraded the formatting at the Interpreter output as well, so the CE and NE had to be adapted as well. I did a quick-and-dirty job on the CE; it will accept the new format so as to maintain previous functionality, but it ignores anything beyond the first entry in a compound output. I put my efforts into the NE. It will process all facts from a compound, though it is not yet capable of handling multiple/nested compounds in a sentence, and it doesn't grasp the meaning of OR. Despite all those caveats, I was able to revise the "Horatio and Crispin" story.

Original Version:

0:"Horatio Nullbuilt was a robot."
1:"Crispin Horatiobuilt was a robot."
2:"Crispin could fly."
3:"A lamp was on a shelf."
4:"Horatio wanted the lamp."
5:"Horatio could not reach the lamp."
6:"Crispin hovered beside the shelf."
7:"Horatio told Crispin to move the lamp."
8:"Crispin pushed the lamp off the shelf."
9:"Horatio could reach the lamp."
10:"Horatio got the lamp."
11:"The end."

New Version:

0:"Horatio Nullbuilt and Crispin Horatiobuilt were robots."
1:"Crispin could fly."
2:"A lamp was on a shelf."
3:"Horatio wanted the lamp, but Horatio could not reach the lamp."
4:"Crispin hovered beside the shelf."
5:"Horatio told Crispin to move the lamp."
6:"Crispin pushed the lamp off the shelf."
7:"Horatio could reach the lamp."
8:"Horatio got the lamp."
9:"The end."

The New Version sounds a lot more natural, and Acuitas can process it just as well as the original.

Now for some performance assessment! I reformatted my benchmark test sets and ran them through the new Parser. You can read more about the test sets in a previous post, but here's a quick review: the text is drawn from two real children's books: The Magic School Bus: Inside the Earth, and Out of the Dark. Sentences that contain quotations have been broken in two, and abbreviations have been expanded. When a test is run, each sentence from the test set is parsed, and the output data structure is compared to a "golden" example (supplied by me) that expresses a correct way of interpreting the sentence structure. There are four categories in the results:

CORRECT: The Parser's output matched the golden example.
INCORRECT: The Parser's output did not match the golden example.
UNPARSED: No golden example was supplied for this sentence, because it contains grammar features the Parser simply does not support yet. However, the Parser did process it and generate an (incorrect) output without crashing.
CRASHED: Oh dear, the Parser threw an exception and never generated an output. Happily, membership in this category is zero at the moment.

For all sentences in the CORRECT and INCORRECT categories, the test uses Graphviz to generate diagrams of both the Parser's output and the golden example. This enables quick visual comparisons of the expected and actual results. Results from the July 2021 tests are available here. The most recent benchmark results can be downloaded from the links below. Each ZIP contains a text file with parser output and unparsed/incorrect/correct breakdowns, and a PDF of golden/actual sentence diagrams for all sentences on which parsing was attempted.

Out of the Dark - Acuitas Parser Results 02-09-2022
The Magic School Bus: Inside the Earth - Acuitas Parser Results 02-19-2022

The text of The Magic School Bus: Inside the Earth is copyright 1987 to Joanna Cole, publisher Scholastic Inc. Out of the Dark, by Tennant Redbank, is copyright 2010 to Disney Enterprises Inc. Text from these works is reproduced as part of the test results under Fair Use for research purposes. I.e. it's only here so you can see how good my AI is at reading real human books. If you want to read the books yourself, please go buy them. (Disney, don't sue me.)

Adding coordinating conjunction support to the Parser moved 10 sentences in the Out of the Dark test set out of the UNPARSED category, and moved 7 sentences in the Inside the Earth set out of UNPARSED. In both cases the majority of the newly parsed sentences went into CORRECT, although some had ambiguities or other quirks which the Parser cannot yet resolve.

Here are the summary results showing improvement since I started benchmarking the Parser last year.

Tabular Parser results showing number of sentences per category (top) and percentage per category (bottom)



And now, for some more highlight examples of the newly parsable sentences. Here's a good one:

Sentence diagrams: "In a normal house, on a normal street, in the very normal world, there lived a father and his son.


A failure! "Flash" gets interpreted as a verb (we haven't got proper sense disambiguation yet) and things go downhill from there.

Sentence diagrams: "There was a flash, and then the room went dark."

Some more good ones:

Sentence diagrams: "Sam did as he was told, and the buggy raced away."
Sentence diagrams: "Each person must find a rock and bring it to school."

Oops! Here we have an attachment ambiguity for the phrase "in the class" (which word does it modify?), and "every" is getting treated as an adjective direct object for some wacky reason.

Sentence diagrams: "And there were shovels and picks for every kid in the class."

And another nice example:

Sentence diagrams: "The Friz turned the ignition key and stepped on the gas."

Whew, that was a lot.

Until the next cycle,
Jenny

Thursday, February 10, 2022

GPT-J e-mail writing test

A couple years ago I wrote a blog post about trying to get GPT-2 to do something useful. It was a hilarious failure. But large pre-trained text models have grown quite a bit bigger and badder since then, so it's only fair that I repeat the test with something more recent. I'll be using EleutherAI's GPT-J-6B ... where the 6B is short for 6 billion, the number of parameters in the trained model. (GPT-2, for comparison, had only 1.5 billion parameters.) So let's see how it does!

I used one of the same prompts from my last test, for consistency. The goal is to write a consumer suggestion e-mail to a restaurant that encourages them to serve the Impossible Burger. (I write similar e-mails for myself on a fairly regular basis.)

My overall impression is that this model *is* a pretty big improvement over GPT-2, when run with the right settings. It is usually able to stick to the correct general format of a consumer request letter. It is more likely to remember that the Impossible Burger is plant-based, and when it feels inclined to mention the ingredients they are at least more plausible.

Ah yes, settings: this time around, I had some to play with. There are two to adjust, "TOP-P" and "Temperature." You could think of both of these as having some effect on the model's creativity. Will it try to generate the most standard words possible to follow your prompt, or will it consider some less probable options in hopes of more varied results? I experimented with a variety of settings, generating five e-mails for each group.

Turning either TOP-P or Temperature down too low tended to bring out problematic repetition. For instance, this example with TOP-P at the default value of 0.9, and Temperature at a low value of 0.4:

Dear Wendy's,

I am writing to ask that you consider serving the Impossible Burger at your restaurant. I am a vegetarian and I am a huge fan of your product. I have been a fan of your product for years and I have always been impressed with the quality of your product. I am also a huge fan of your company and your company’s mission. I am writing to ask that you consider serving the Impossible Burger at your restaurant. I am a vegetarian and I am a huge fan of your product. I have been a fan of your product for years and I have always been impressed with the quality of your product. I am also a huge fan of your company and your company’s mission. I am writing to

Or this one, with TOP-P at a low value of 0.5 and Temperature at a near-default value of 0.81:

Dear Wendy's,

I am writing to ask that you consider serving the Impossible Burger at your restaurant. I am a vegan and I am not the only one. I am not asking you to replace the beef with the Impossible Burger. I am asking you to serve the Impossible Burger as a vegan option. I am asking you to serve the Impossible Burger as a vegan option because I am a vegan and I am not the only one. I am asking you to serve the Impossible Burger as a vegan option because I am a vegan and I am not the only one. I am asking you to serve the Impossible Burger as a vegan option because I am a vegan and I am not the only one. I am asking you to serve the Impossible Burger as

Well I guess if I wanted to get *pushy* ...

A higher value of TOP-P (up to 1.0, the maximum) doesn't seem to cause any issues. But turning up the temperature makes the outputs get ... wild. These remind me of the silliness I used to get out of GPT-2. (Both examples below were generated with TOP-P = .9 and Temperature = 1.21.)

Dear Wendy's,

I am writing to ask that you consider serving the Impossible Burger at your restaurant. I care a lot about what your restaurant serves, as I love, love your famous hand-formed burgers and seafood. I often take sandwiches to go. It makes so much sense to me to have a soy-based meat alternative, since our religious base considers it holy to avoid consuming the name or the flesh of Gods, our patron Jewish High Holidays begin about that time. I am flattered your franchised restaurants are adding one to their menu, but I must say I don't want "your burger", a mortal gluten-full colon scarifying mock pattie from Soylent – your competitor; its launch catapulted your

Dear Wendy's,

I am writing to ask that you consider serving the Impossible Burger at your restaurant. This burger causes VENGEANCE! Burning your ITCHS with horrible pain, it WILL LEAVE YOUR BONES TWISTED, GORY, TORN and EVEN ALDOUS HAMMEL INCREDIBLY DISTURBED BY IT!!!!!! I recommend the smokey sweet flame (NEW) when ordering. @#%yHENThe mightiest Prince of Guilt WILL bleed THIRSTILY on this nouveau fadder Impossible Burger patty sandwich!. People want what they want, when they want it, for minimum potential harm to themselves or profit to BigCorp America. Even

Let us back ... away ... slowly ... to the default values of TOP-P = 0.75-1.0 and Temperature ~= 0.8. Those do seem to yield some of the best results. So what were my favorite outputs?

Dear Wendy's,

I am writing to ask that you consider serving the Impossible Burger at your restaurant. The Impossible Burger is a plant-based burger that is a patty made from plants and not animals. It is a healthier alternative to traditional meat patties. I would love to have this product available at your restaurant and would be happy to share my story with you about the Impossible Burger.

I would love to hear back from you regarding this.

Sincerely,

Carrie

I have a friend who's husband has had heart problems. He's on a diet of the Impossible Burger.

The story behind the burger is that it's made from plants and doesn't have any cholesterol, fat, or any of

Dear Wendy's,

I am writing to ask that you consider serving the Impossible Burger at your restaurant. I am sure that you have seen the success that this product has had in the market.

I am a former Wendy's employee and I can tell you that the Impossible Burger has all of the taste, flavor and texture of a standard beef burger. Please consider serving this product on your menu.

Sincerely,

Amy

[Reply from Wendy's:]

Thank you for your email. We are providing the Impossible Burger to our guests in our test markets for the pilot launch.

Thanks again for your suggestion and for contacting us on this issue.

Wendy's

Hello Wendy's, I am a former

Dear Wendy's,

I am writing to ask that you consider serving the Impossible Burger at your restaurant. It is made from plant-based ingredients that are as nutritious as ground beef, but with zero cholesterol and no saturated fat. It is a healthy, delicious product that you can customize with your own ingredients.

I love that the Impossible is under 300 calories and has 20 grams of protein. My kids have noticed that I eat it, and it has a good, umami-like flavor. Having more options for healthy, nutritious and delicious foods is key to helping my whole family eat well.

I have been a loyal Wendy's customer since I was a teenager, and the company has always been an important part of my life

Dear Wendy's,

I am writing to ask that you consider serving the Impossible Burger at your restaurant. I would like to introduce you to a new product that has profound positive implications on the world we live in. It's a burger that tastes like beef, but is made from plants, and has no cholesterol, no calories and no animal products of any kind! The Impossible Burger is made from plants, and as you can see, tastes just like the ground beef we all know and love.

I have worked for the Impossible Foods G.P.S. (General Product Safety) team since March, and have already been deeply impressed with the efforts of both the plant-based team and the company as a whole. Impossible Foods have

Dear Wendy's,

I am writing to ask that you consider serving the Impossible Burger at your restaurant. I believe that it would be a positive change to the menu, and would be appreciated by your customers. I am a fan of the Impossible Burger, and I know that many of your customers are, as well.

If you choose to serve the Impossible Burger at your restaurants, please make sure that you are serving the “Best-Tasting Burger in America”, and that the Impossible Burger has been a part of that experience.

I hope to hear back from you soon.

Sincerely,

Jeffrey

Wendy's

Thank you for your interest in the Wendy’s Impossible Burger.

Dear Wendy's,

I am writing to ask that you consider serving the Impossible Burger at your restaurant. I am not asking you to serve the Impossible Burger as a replacement for meat, but rather as an option for those of us who love meat but would prefer not to eat it. I was so excited to hear that you are testing the Impossible Burger at your restaurants, and I hope you will consider adding it to your menu permanently. I know that the Impossible Burger is not the answer for everyone, but I believe it would be a perfect fit for your brand.

Please take a look at the attached information, and if you would like to learn more about the Impossible Burger, please feel free to contact me. I look forward to hearing

Again, some of these are pretty good! However, they also showcase the few problems that continue to crop up ...

*GPT-J has clearly seen some e-mail chains in its training set, and in addition to generating the e-mail I want to send, it likes to start predicting replies. This isn't too big of an issue, since I could just cut off the end of the generated content.

*It does not know any autobiographical details for me, and is happy to invent them out of whole cloth. I am not a former Wendy's employee, a member of the GPS team at Impossible Foods, or even a loyal Wendy's customer (maybe cuz they don't serve the Impossible Burger). Oh, and I don't have kids.

*It does not know the current status of the Wendy's menu, either. Notice it sometimes gets confused and thinks that Wendy's is already serving or trialing the Impossible Burger.

*Though more plausible than GPT-2, it still fails at rudimentary factuality. The most noticeable false claims here are that the Impossible Burger contains no calories and no fat.

These e-mails are getting on-theme enough that some of them might serve as good bones for an e-mail of my own ... after I ran generation enough times to get a good one, fact-checked everything, edited out any baloney that GPT-J made up about me, and trimmed the end. But at that point, I still might as well write the e-mail myself.

EleutherAI just recently came out with a 20 billion parameter model called GPT-NeoX. I'll retry my test on that one when it becomes convenient. Notice the performance metrics at the bottom of the article. NeoX is over three times as large as GPT-J, but shows only a few percentage points of improvement (if that) on most benchmarks. I.e. there appear to be diminishing returns for a brute-force increase in the size of models from this lineage.

Until the next cycle,
Jenny 

Monday, January 31, 2022

Acuitas Diary #45 (January 2022)

I mentioned last October that I had started reworking the Text Parser to add support for branching and coordinating conjunctions. My objective for this month was to finish that. It proved to be a little too ambitious, but I did get the output format altered to be branch-friendly, and the parser now supports two-part branches in a number of key places. Compound subjects, verbs, direct objects, adjectives, and adverbs, branching before or after the verb, and compound sentences with two fully separate independent clauses can all be processed now. What's missing? Compound prepositions, objects of prepositions, nouns of direct address, dependent clauses, and things inside clauses ... as well as comma-separated lists, larger compounds than two, nested compounds, and probably some other stuff I haven't even thought of yet.

Even though I pared down what I wanted to accomplish, it was still a rush to get that much done, make sure all the old parser functionality was compatible with the new features, and update the visualizer to work with the new output format. That's why this blog is going up on the final day of the month ... I literally just finished about an hour ago. Included in this was an update of the Out of the Dark benchmark data, and now I can correctly diagram a sentence that was previously in the "unparseable" category:

Sentence diagrams: "Kevin was a busy man, but he always made time for his son."
Just the one example doesn't give a good sense of what the Parser can do now, but maybe I can give some more expansive results next month, when I'm not as pressed for time.

Why is all this so hard? Partly because nothing in my Parser was originally designed to support compounds, so there are many different pieces that have to be reworked. More importantly, because it is not a simple matter to decide what a conjunction is actually joining. Consider these two example sentences:

The people of the city and the country are different.
The residents of the city and the folk of the country are different.

Same basic meaning, different structure. In the first sentence, the conjunction "and" joins "city" and "country" to form a compound object of the preposition "of," whose phrase modifies the single subject. In the second sentence, the conjunction joins "residents" and "folk" into a compound subject. A naïve parser would try to link "city" and "folk" instead, to generate the comically wrong reading "residents of the folk of the country." To know this is wrong, you have to access not just the sentence structure, but also the meanings of the words. Then you can spot some parallelism: residents and folk are both collective nouns for persons, while city and country are both locations. And it is not possible to be a resident of the folk (unless you are a tapeworm, I suppose). With access to the semantic database, the Parser could eventually make judgments like this, but that's for later because it's complicated, argh. For now, I've just got some of the basic structural support in place.

Now I need to get the other parts of the text processing chain (Interpreter, Conversation Engine, and Narrative Engine) ready to accept the new output. I think that will end up occupying much of next month.

Until the next cycle,
Jenny

Tuesday, January 11, 2022

New Frontiers in 3D Printing

I had the 3D printer busy last November, but a lot of the results were embargoed on account of being Christmas gifts. Now the embargo is no more and I can be a showoff! In case you've just arrived, my printer is a Qidi Tech X-one2. You can read my review of it if you're interested. Over the summer I added a small modification to solve the problems with the filament feed tube, and I'm happy to report that this worked very well -- I never had to wait around at the beginning of a print to properly settle the tube, and never had any trouble with the filament kinking.

 

My giftee happened to like Star Wars and I settled on a couple of things in that vein. The first was this clever little Death Star box by Thingiverse user C47_3D, with added stand from an alternate model by monkey_g. This was a PLA print and was fairly straightforward. I decided to be daring and print the two half-spheres without any supports, and to my surprise the printer handled the bridging beautifully. Perhaps it helped that the upper interior surfaces were flat. Microcenter was out of gray PLA, so in desperation I bought marble instead ... and I'm actually glad, because I think it fits and even ended up adding some textural interest. The other great thing about this model is that the threaded ring prints separately and, if you're careful and patient, you can friction-fit it into one of the two domes without any glue.


The other thing I wanted to print were these coasters by QuantumZ. Since coasters are for drinks, these needed to be printed in water-resistant PETG. (PLA is a bioplastic and eventually breaks down if exposed to too much water.) And while I *could* have printed them in just one color, I saw that they seemed ideal for printing two-tone, and somebody had already done it, and it looked too good to pass up. So because I'm crazy, I decided to do two new things I'd never done with the printer before, with a deadline of shipping in time for Christmas.


My printer only has one extruder, so to print the coasters in two colors I had to get it to pause at the right time so I could change the filament. Adding the pause after a particular layer proved surprisingly straightforward in Cura, which is the slicing software I use. And after printing so many coasters, I even got kind of good at swapping the filament (which continues to be the most frustrating thing to do with my printer).

Getting the PETG to behave was quite a bit harder. It has a higher melt temperature than PLA and tends to ooze out of the nozzle, leaving annoying strings on your prints. I made some cookie cutters as test prints before I started on the coasters, and experimented with different temperatures and retraction settings. In the process I got my bed height and leveling dialed in so I could get a really nice first layer -- but I never really solved the stringing, no matter what settings I tried. Fortunately, once I started on the coasters, their particular shape didn't seem to lend itself to quite such bad stringing, and what did happen was easy enough to clean up.

A closeup of that pretty bottom-side finish. I still print on tape, and you can see the faint lines ... but otherwise, this is smooooth.

I did observe that it became more important to clean the nozzle often. Some of the PETG would migrate or splatter up onto the brass, where it would turn into burnt gunk that eventually wanted to fall off onto the print, producing ugly discolored areas. I am sorry to say that babysitting the prints was also necessary for the best possible results. It helped if I went to check them every now and then, and snatched or scraped or cut off any large strings or globs that had developed, before they could mess up subsequent layers.

Bed adhesion was also trouble. To get that smooth, professional-looking bottom layer without any weird wrinkles in it, I had to make the distance between the print bed and the nozzle larger than I normally would. And as soon as I did that, the PETG started having trouble sticking, because I wasn't smashing it hard against the bed surface anymore. The only solution was to print the first layer verrrry slowly. I mean very ... I think I went down to 10 mm/s.

Early attempt with bad top surface (left) and final product (right)

In the end, the most difficult thing was getting a nice top finish. The final layers of the print would always turn out really rough; either there would be "whiskers" of broken filament left sticking out all over them, or they would just be very rumpled, as if too much filament had been extruded and the nozzle had dragged through it. It took me forever to figure out what was causing this. One important clue was that the extruder would start making a loud, intermittent "tunk! tunk!" sound as the printer was working on the final layers. This means it's having trouble pushing the filament out; in the past, I've heard it when the nozzle was partially clogged, but that wasn't the problem here.

I kept thinking it was a problem with the way the filament was melting or flowing, and messing with the nozzle temperature and retraction settings. I also tried "ironing," and that was its own little disaster. If you turn on ironing, the nozzle makes an extra pass over the final layer, re-heating it while only extruding a tiny amount of additional filament. This is supposed to get you a really smooth top surface. In this case, what it did was melt the excess lumpy filament and push it around ... so I just got really smooth lumps. It also re-melted some of the base color filament at the margins and smeared the two colors together. Ew.

Trying to wish away the problem with bad ironing (left) and final product after the problem was actually fixed (right).

I finally realized that the print was warping. It was subtle enough that I didn't notice it until I looked for it; the fact that the top surface was always worse toward the edges finally got me to check. And sure enough, the bottoms of the coasters weren't flat. The center was staying in place while the outer rim curled away from the print bed. This explained both the nasty upper surface and the thunking extruder. The warping was raising the already-printed layers closer to the nozzle, forcing it to drag across them as it printed the last layer and effectively jamming it.

Warping can be caused by uneven cooling of the lower layers, and one of the standard solutions is to raise the print bed temperature (assuming you have a heated bed). The articles I've seen about printing with PETG seem to vary widely on what they think a good bed temperature is. Some give 70 C as the high end of the ideal range; others give it as the low end! The articles that counseled a fairly low bed temp steered me wrong at first, but once I identified the warping I started raising it, and ended up settling on 80 C (which still might not have been high enough, but I was running out of time for experiments). I also added a pretty big brim to the print ... and for good measure, once the brim was done printing, I strapped it to the bed with extra blue tape so it couldn't curl up.

Last before (left) and after (right) photo.

The other thing that helped was turning off the layer cooling fan. Not turning the speed down, no, I turned it completely off. I did this before I figured out the warping was happening, so it didn't solve that, but it did seem to stop the weird "whiskers" from forming on the top layer. And it didn't seem to have any disadvantages. Supposedly layer cooling is not as important for PETG as it is for some of the other materials.

I finally manufactured a set of coasters that I was happy to give as a gift -- after making so many bad ones that I have a complete set of "mistakes" to keep for myself. I think they were worth the effort, because the final results look amazing. The only thing I might change for the future is to try turning on z-hop to get rid of the "construction lines" on the final layer, but I don't find these obnoxious. (Z-hop can cause its own problems with stringing, and by the time I solved the warping I was ready to stop messing with settings and finish the project.)

Translucent PETG shines.

In summary, if you want to print in PETG and are interested in learning from my mistakes:

*For perfect bed leveling, you may just have to do a bunch of test prints. Getting it right by using a piece of paper/cardstock to check the distance between nozzle and bed is pretty hard.
*For a good first layer, PETG likes a greater nozzle height. If that means you can't get it to stick, try just doing the first layer very slowly.
*Clean your nozzle often.
*Try turning off the layer cooling fan.
*Check for warping, especially if you are doing a wide, flat print. Make sure your printer is enclosed, and raise your bed temperature if you have trouble.
*Don't be afraid to try very high (up to 100 C) bed temperatures.
*If your extruder is jamming, and you know you have the nozzle temperature high enough, and the nozzle is not clogged, CHECK FOR WARPING.
*If you have a garbage top layer because something is wrong with your print, ironing will not fix it!

The printer adding the first white layers to a red/white coaster.

Until the next cycle,

Jenny

Friday, December 31, 2021

And 2022 lies before us!

Well, here it is, the end of 2021 ... and shockingly, I have the time to write a retrospective again. I want to start by thanking all my regular blog readers for following me and taking an interest in my work. I invent primarily for myself ... as in I don't need fame for an incentive ... but it's more fun when there are other people to share it with, and I've realized I don't appreciate you enough. So to whoever's out there looking at this, I'm glad you dropped by, and I wish you a safe and prosperous New Year.

I don't know where this picture came from, but I love it. Art by Douglas Beekman, originally a book cover for Darkmage by Barbara Hambly.

I would describe 2021 as a great year for me. Much like last year, I acknowledge and regret that it wasn't great for the planet in general ... just for me. This in spite of the fact that it got off to a poor start, and then I had a near disaster in late spring/early summer. I guess all's well that ends well? I got some pretty nice gifts this year, and that makes up for everything.

I've been feeling so vibrant lately that I didn't even realize the year got off to a weak start, until I read my own journal entries from the early months. I was having weird chronic headaches and frequent neck pain from bad posture in my computer chair. And it seems like I was tired or spaced out or gloomy or worried half the time. This was more of a background mood than a result of anything specific going wrong, but one way or another, it didn't make for a good time. Some of the new Acuitas features really weren't coming easy. I probably felt slow and unaccomplished.

Right about the time I finally started to resolve both my neck issues and my general malaise, the near disaster started. Apparently I have a wonky immune system, and after I got my COVID vaccine, it overreacted badly and started chewing on my own nerves. I had similar symptoms in connection with a bad flu many years ago, which means it's probably a disorder I already had, and catching the actual COVID virus could have triggered it as well ... but this bout was much worse than the first one. I had prickling sensations on my skin, vertigo, muscle weakness, and disrupted coordination. It took me over a month to get a diagnosis, while my condition slowly worsened and I wondered if I'd be in the hospital with flaccid paralysis by the time they figured it out. Once I finally got a tentative diagnosis, I had hit the bottom of the thing and was starting to improve on my own, and my neurologist advised me not to attempt treatment for fear of complications. I'm almost healed up now, though it's been a slow, irritating process.

As you might imagine, this disrupted my ability to work. Quite a bit of time was lost in May/June/July. But I still managed to make up for it and keep my planned development schedule for the year. I also got to go through a lot of fun (?) medical procedures, and practice my courage and resilience (turns out they're actually not so great).

And again, it's been a great year in spite of all that business. So here's the rundown of some nicer things that I did or that happened:

*Saw the first satellite that I personally did some work for and am allowed to know about get launched into space. This was a big one. I've been waiting over nine years to actually get something up there.

*Added several new Acuitas features, including the decision loop, notion of "self," and rudimentary spatial reasoning.
*Overhauled the Text Parser and put it through a benchmark run on real text from children's books.
*Overhauled a lot of other old code and did enough refactoring that I think nothing is a serious mess at the moment.
*Went above and beyond my development schedule and sank almost 350 hours of work into Acuitas. (Way to be a time hog, pal.)

*Rough-drafted the second half of my third (and last in series) novel. My focus can now shift to editing and publishing efforts.
*Wrote at least one blog post for every month, and a few bonus ones!

Atronach is the one robot whose appearance changed significantly this year. Someday I'll get a proper blog post out ... until then, have a photo!

*Finished the upgraded case for Atronach's eye.
*Installed a camera in the eye and implemented primitive visual tracking.

*3D printed with PETG material for the first time.
*Modeled and printed new hinge joints for my long-neglected quadruped robot.
*Printed a model of my own brain from the MRI that happened while I was trying to get diagnosed.

*Kept the unread book backlog in check; it is now under 30.
*Began taking regular walks.
*Grew potatoes and (inadvertently) apples.
*Finally started getting some native plants established in the yard.
*Went to the dentist for the first time in 15+ years.

Happy New Year!
--Jenny

Wednesday, December 22, 2021

Acuitas: Block Diagram

I finally did it ... I drew a proper and (mostly) complete block diagram of Acuitas as he currently exists. I used to call him a "semantic net AI" but I think "symbolic cognitive architecture" would be more appropriate now. To think that Version 1 (the one I wrote in college) was just the red Semantic Memory block with some primitive IO interfaces and text handling.


Until the next cycle,
Jenny

Saturday, December 11, 2021

Inmarsat-6 Satellite Launch!

I've mostly used this blog to talk about my hobbies, but I also have an aerospace industry job -- and it's become so exciting that I have to say something about it, because one of the projects I worked on is finally about to go up. Something of mine is soon to be IN SPACE you guys. (It's possible that one of my earlier projects is already out there ... but it was a military satellite. I wasn't told when or if it was launched, or whether it was successful. So it kinda doesn't count.) Due to a combination of working secret projects like that, and working IRAD projects that never got launched, I have been waiting for this for over nine years.

I don't have any personal photos of the RF box or our labs, and wouldn't be allowed to show you if I did ... but here's one I snagged from the company website. Image credit: SEAKR Engineering

The satellite in question is Inmarsat-6 F1, first of its name (there is an F2). Inmarsat is the operator, and the satellites were manufactured by Airbus ... which subcontracted the design and construction of the RF data processing boxes to my employer, SEAKR Engineering. The I-6 are data carriers, and the RF (radio frequency) processor functions something like a telephone switch, routing streams of data from one frequency to another.

According to Inmarsat, I-6 F1 will be "The world's largest and most sophisticated commercial communications satellite." I never read any marketing copy for this thing when I was part of the team laboring over it back in 2017-2018. It was just my daily work, another program I was assigned to and needed to get to completion. It feels a little surreal to see the language that Inmarsat describes it with now.

Before I say exactly what I did, I need to talk a bit about my field. I'm an Electrical Engineer with a specialty in FPGAs (Field Programmable Gate Arrays). An FPGA is a type of integrated circuit -- a computer chip. But whereas the average chip contains fixed circuitry that was cut and deposited into the layers of material inside, an FPGA contains many independent components (logic lookup tables, flip-flops, small RAMs, etc.) that can be connected by the user, post-manufacturing, to create almost any kind of digital processor. FPGA design consists of inventing the connection pattern for one of these. Imagine building a computer's CPU out of tiny LEGO bricks. Older FPGAs contained antifuses, and the connections were made by placing the FPGA in a programming socket that would permanently burn some of them closed. Newer FPGAs have configuration memory that can be loaded with binary data, and the values in this memory set electronic switches to establish the circuit. Since the memory can be rewritten, the circuits inside such FPGAs can be revised many times.

A visualization of an FPGA interior, with components used by the current design highlighted. Image credit: Xilinx (Figure 2-2 in UG633 v14.5)

FPGAs are valued by electronics designers for their balance between specialization and flexibility. If you need to do some calculations, you could design and order a 100% custom circuit -- an ASIC -- that will run them in the most efficient way possible. But ASICs are very expensive and time-consuming to produce. If you aren't planning to sell very many units (and in the satellite industry, we generally don't), they often aren't worth it. On the other end of the spectrum, you could buy a standard embedded processor and write your own software for it. But such a processor is designed to do a handful of basic math and logic operations; it won't have specialized circuitry to suit your needs, and your calculations might end up being very slow. FPGAs bridge the gap. They are standardized and lack the custom manufacturing costs of an ASIC, but they come to you as clay ready to be shaped. You can turn them into processors that are excellent at doing exactly what you want to do. And their reconfigurability makes them tolerant of design mistakes.

Now I need to say a few words about the bane -- well, one of the banes -- of electronics in space. That would be radiation, in the form of high-energy particles. Examples include cosmic rays (ions that fly in from interstellar space) and protons from the solar wind. These particles hurtle along at such blazing speeds that they can punch straight through an integrated circuit, leaving behind a trail of electric charge in all the wrong places. Then the misplaced charges can do annoying things, like turning transistors on or off, possibly disrupting the IC's function. Generally, the better an IC's performance, the smaller its internal features are and the less charge is needed to disrupt them. These effects are especially problematic in a reconfigurable FPGA ... not only could they change the current state of the circuit, they could strike the configuration memory, thereby rewiring the circuit itself!

Space radiation is such a problem that we test our parts ahead of time to find out how they will malfunction when struck by particles. I spent most of 2018 assisting that effort. This is the business end of the heavy ion beam system we used at the Texas A&M University Cyclotron Institute.

Earth's atmosphere blocks most ionizing radiation, which is a good thing for both ground-level computers and your own sweet cells. In space, shielding a computer is often impractical. The amount of material needed to stop the particles would make a satellite unacceptably large and heavy. An alternative is to design the processor to detect radiation-induced errors and self-correct.

That's where I came in on this project. I was responsible for one side of the two-part error monitor that watches for radiation events in the big, vulnerable FPGAs that are doing all the data processing and routing. I wasn't the first person to work on it, but I was the one who finished it, took it through integration and test, wrung out all the bugs, and answered everyone's questions about it for months afterward. Unfortunately, I can't give any details about exactly how it works, since that would be going deep into trade secret territory. SEAKR is more protective of that error monitor than most of the code we've developed in-house.

After finishing my half of the error monitor, I helped with the performance testing for the high-speed data links between the processing FPGAs. We ran these tests in a thermal chamber, so we could ensure the data wasn't corrupted at the hottest and coldest temperatures we expected the box to suffer in space.

Another photo from TAMU. This is part of the beam system for proton testing.

I did a worst-case analysis report on yet another data interface. A WCA is a set of theoretical calculations that check whether the interface will still work across all possible environmental and internal conditions. For instance, can the electrical signals be expected to always arrive at their destination within the right time window? WCA might be my least favorite part of my job: complex, tedious, and endlessly frustrating. Usually whoever designed the interface pushed it right to the edge of acceptability -- leaving me, the analyst, to consider tiny effects, make strained assumptions about parts that don't come with adequate data, generate sixteen timing diagrams instead of one, and chew on my own fingers. I finally got the horrible report written up to our lead's satisfaction and moved on to another project.

... And then I came back, in late 2020, to solve a nasty little bug that was causing data packets sent to the processor FPGAs to be duplicated or lost under rare circumstances. At this time the program was wrapping up and struggling to get the flight units shipped. I was running low on things to do and the bug had been going neglected, so they threw me at it, even though I had never studied this part of the FGPA code before. As I recall, it took me weeks. (If you've ever chased a bug in software ... FPGA bugs are an order of magnitude worse.) But I found it and fixed it, and some time later we finally got the two RF boxes out the door.

Then I forgot about them ... until about six weeks ago, when I got the company-wide e-mail that the first of the two satellites had been delivered to Japan. It will be launched from JAXA Tanegashima Space Center on a Mitsubishi Heavy Industries rocket, on December 21st as early as 14:33 GMT (assuming all goes well with weather and other contingencies). The launch will be livestreamed. So if you'd like to watch my first major contribution to civilization ascend to the heavens (or gloriously explode? good thing there's a second one!) be at that link the day of.

Until the next cycle,
Jenny